diff options
author | Benjamin Kramer <benny.kra@googlemail.com> | 2017-10-10 07:21:34 +0000 |
---|---|---|
committer | Benjamin Kramer <benny.kra@googlemail.com> | 2017-10-10 07:21:34 +0000 |
commit | d89b5f87c94eef6e83389be238f3473f51649c30 (patch) | |
tree | 92b4694fb0bf50530904eb045ac539a8a81b6dbd | |
parent | 1c1f51cab8a09f9216bfa51aaca373d35af9393c (diff) |
[ASTMatchers] Don't create a copy of a std::set when iterating over it.
This is a bit awkward because lookup returns a copy instead of a
reference. No functionality change intended.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@315276 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/ASTMatchers/ASTMatchFinder.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/ASTMatchers/ASTMatchFinder.cpp b/lib/ASTMatchers/ASTMatchFinder.cpp index 49b15ee685..02aee4b46d 100644 --- a/lib/ASTMatchers/ASTMatchFinder.cpp +++ b/lib/ASTMatchers/ASTMatchFinder.cpp @@ -734,7 +734,10 @@ private: BoundNodesTreeBuilder *Builder) { const Type *const CanonicalType = ActiveASTContext->getCanonicalType(TypeNode); - for (const TypedefNameDecl *Alias : TypeAliases.lookup(CanonicalType)) { + auto Aliases = TypeAliases.find(CanonicalType); + if (Aliases == TypeAliases.end()) + return false; + for (const TypedefNameDecl *Alias : Aliases->second) { BoundNodesTreeBuilder Result(*Builder); if (Matcher.matches(*Alias, this, &Result)) { *Builder = std::move(Result); |