summaryrefslogtreecommitdiffstats
path: root/clang
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2017-02-01 03:28:59 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2017-02-01 03:28:59 +0000
commit776e9c35b57330acf7cf29f99ce04ee19a04b103 (patch)
treee54e5733e4e38c0b15545048d9b0868e5ed7777d /clang
parent455382ea220b0d432aec8b7153b6d8384f032000 (diff)
downloadbcm5719-llvm-776e9c35b57330acf7cf29f99ce04ee19a04b103.tar.gz
bcm5719-llvm-776e9c35b57330acf7cf29f99ce04ee19a04b103.zip
Remove apparently-unnecessary copy of constructor lookup result.
Contrary to the comment, DeclContext intends to guarantee that the lookup results for a particular name will be stable across non-AST-mutating operations, so a copy here should not be necessary. Further, if a copy *is* necessary, the other four instances of this pattern within this file would also be wrong, and we have no evidence of any problems with them; if this change unearths problems, we should fix all the instances of this pattern. llvm-svn: 293740
Diffstat (limited to 'clang')
-rw-r--r--clang/lib/Sema/SemaInit.cpp10
1 files changed, 1 insertions, 9 deletions
diff --git a/clang/lib/Sema/SemaInit.cpp b/clang/lib/Sema/SemaInit.cpp
index aae08a9132f..8a70d50a78c 100644
--- a/clang/lib/Sema/SemaInit.cpp
+++ b/clang/lib/Sema/SemaInit.cpp
@@ -4679,15 +4679,7 @@ static void TryUserDefinedConversion(Sema &S,
// Try to complete the type we're converting to.
if (S.isCompleteType(Kind.getLocation(), DestType)) {
- DeclContext::lookup_result R = S.LookupConstructors(DestRecordDecl);
- // The container holding the constructors can under certain conditions
- // be changed while iterating. To be safe we copy the lookup results
- // to a new container.
- SmallVector<NamedDecl*, 8> CopyOfCon(R.begin(), R.end());
- for (SmallVectorImpl<NamedDecl *>::iterator
- Con = CopyOfCon.begin(), ConEnd = CopyOfCon.end();
- Con != ConEnd; ++Con) {
- NamedDecl *D = *Con;
+ for (NamedDecl *D : S.LookupConstructors(DestRecordDecl)) {
auto Info = getConstructorInfo(D);
if (!Info.Constructor)
continue;
OpenPOWER on IntegriCloud