Closed by commit rL219939 (authored by @sbenza).
REPOSITORY
rL LLVM
http://reviews.llvm.org/D5826
Files:
cfe/trunk/lib/ASTMatchers/ASTMatchersInternal.cpp
Index: cfe/trunk/lib/ASTMatchers/ASTMatchersInternal.cpp
===================================================================
--- cfe/trunk/lib/ASTMatchers/ASTMatchersInternal.cpp
+++ cfe/trunk/lib/ASTMatchers/ASTMatchersInternal.cpp
@@ -232,28 +232,29 @@
if (Node.getIdentifier()) {
// Simple name.
return Name == Node.getName();
- } else if (Node.getDeclName()) {
+ }
+ if (Node.getDeclName()) {
// Name needs to be constructed.
llvm::SmallString<128> NodeName;
llvm::raw_svector_ostream OS(NodeName);
Node.printName(OS);
return Name == OS.str();
- } else {
- return false;
}
+ return false;
}
bool HasNameMatcher::matchesNodeFull(const NamedDecl &Node) const {
llvm::SmallString<128> NodeName = StringRef("::");
llvm::raw_svector_ostream OS(NodeName);
Node.printQualifiedName(OS);
const StringRef FullName = OS.str();
const StringRef Pattern = Name;
- if (Pattern.startswith("::")) {
+
+ if (Pattern.startswith("::"))
return FullName == Pattern;
- } else {
- return FullName.endswith(("::" + Pattern).str());
- }
+
+ return FullName.endswith(Pattern) &&
+ FullName.drop_back(Pattern.size()).endswith("::");
}
bool HasNameMatcher::matchesNode(const NamedDecl &Node) const {
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits