Update SetVector to rely on the underlying set's insert to return a pair<iterator, bool>

This is to be consistent with StringSet and ultimately with the standard
library's associative container insert function.

This lead to updating SmallSet::insert to return pair<iterator, bool>,
and then to update SmallPtrSet::insert to return pair<iterator, bool>,
and then to update all the existing users of those functions...

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222334 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
David Blaikie
2014-11-19 07:49:26 +00:00
parent 0e8675a621
commit 5401ba7099
107 changed files with 255 additions and 228 deletions

View File

@@ -480,7 +480,7 @@ void Verifier::visitGlobalVariable(const GlobalVariable &GV) {
while (!WorkStack.empty()) {
const Value *V = WorkStack.pop_back_val();
if (!Visited.insert(V))
if (!Visited.insert(V).second)
continue;
if (const User *U = dyn_cast<User>(V)) {
@@ -510,7 +510,7 @@ void Verifier::visitAliaseeSubExpr(SmallPtrSetImpl<const GlobalAlias*> &Visited,
Assert1(!GV->isDeclaration(), "Alias must point to a definition", &GA);
if (const auto *GA2 = dyn_cast<GlobalAlias>(GV)) {
Assert1(Visited.insert(GA2), "Aliases cannot form a cycle", &GA);
Assert1(Visited.insert(GA2).second, "Aliases cannot form a cycle", &GA);
Assert1(!GA2->mayBeOverridden(), "Alias cannot point to a weak alias",
&GA);
@@ -568,7 +568,7 @@ void Verifier::visitNamedMDNode(const NamedMDNode &NMD) {
void Verifier::visitMDNode(MDNode &MD, Function *F) {
// Only visit each node once. Metadata can be mutually recursive, so this
// avoids infinite recursion here, as well as being an optimization.
if (!MDNodes.insert(&MD))
if (!MDNodes.insert(&MD).second)
return;
for (unsigned i = 0, e = MD.getNumOperands(); i != e; ++i) {
@@ -1218,7 +1218,7 @@ void Verifier::visitSwitchInst(SwitchInst &SI) {
for (SwitchInst::CaseIt i = SI.case_begin(), e = SI.case_end(); i != e; ++i) {
Assert1(i.getCaseValue()->getType() == SwitchTy,
"Switch constants must all be same type as switch value!", &SI);
Assert2(Constants.insert(i.getCaseValue()),
Assert2(Constants.insert(i.getCaseValue()).second,
"Duplicate integer as switch case", &SI, i.getCaseValue());
}
@@ -2253,7 +2253,7 @@ void Verifier::visitInstruction(Instruction &I) {
while (!Stack.empty()) {
const ConstantExpr *V = Stack.pop_back_val();
if (!Visited.insert(V))
if (!Visited.insert(V).second)
continue;
VerifyConstantExprBitcastType(V);