[PATCH] D15506: [ASTMatchers] Allow hasName() to look through inline namespaces
Yaron Keren via cfe-commits
cfe-commits at lists.llvm.org
Mon Dec 14 14:02:27 PST 2015
yaron.keren added inline comments.
================
Comment at: lib/ASTMatchers/ASTMatchersInternal.cpp:322
@@ +321,3 @@
+ for (bool SkipUnwritten : SkipUnwrittenCases) {
+ llvm::SmallString<128> NodeName = StringRef("::");
+ llvm::raw_svector_ostream OS(NodeName);
----------------
StringRef not needed, simply
llvm::SmallString<128> NodeName = "::";
================
Comment at: lib/ASTMatchers/ASTMatchersInternal.cpp:323-331
@@ -326,1 +322,11 @@
+ llvm::SmallString<128> NodeName = StringRef("::");
+ llvm::raw_svector_ostream OS(NodeName);
+
+ if (SkipUnwritten) {
+ PrintingPolicy Policy = Node.getASTContext().getPrintingPolicy();
+ Policy.SuppressUnwrittenScope = true;
+ Node.printQualifiedName(OS, Policy);
+ } else {
+ Node.printQualifiedName(OS);
+ }
----------------
You may be able to do without the if
PrintingPolicy Policy = Node.getASTContext().getPrintingPolicy();
Policy.SuppressUnwrittenScope = SkipUnwritten;
Node.printQualifiedName(OS, Policy);
http://reviews.llvm.org/D15506
More information about the cfe-commits
mailing list