From db4818ec01f2c7ab001b808e03d66e5ac0af7872 Mon Sep 17 00:00:00 2001 From: Benjamin Kramer Date: Tue, 10 Oct 2017 07:21:34 +0000 Subject: [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. llvm-svn: 315276 --- clang/lib/ASTMatchers/ASTMatchFinder.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'clang/lib/ASTMatchers/ASTMatchFinder.cpp') diff --git a/clang/lib/ASTMatchers/ASTMatchFinder.cpp b/clang/lib/ASTMatchers/ASTMatchFinder.cpp index 49b15ee6850..02aee4b46dd 100644 --- a/clang/lib/ASTMatchers/ASTMatchFinder.cpp +++ b/clang/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); -- cgit v1.2.3