[PATCH] Adding 4 ASTMatchers: typedefDecl, isInMainFile, isInSystemFile, isInFileMatchingName

Manuel Klimek klimek at google.com
Thu Oct 23 19:40:31 PDT 2014


Thanks a lot for working on this - we're getting close :) Sorry for the delay in the review.

================
Comment at: include/clang/ASTMatchers/ASTMatchers.h:169
@@ +168,3 @@
+/// Usable as: Matcher<Decl>, Matcher<Stmt>, Matcher<TypeLoc>
+AST_POLYMORPHIC_MATCHER(isInMainFile,
+                        AST_POLYMORPHIC_SUPPORTED_TYPES_3(Decl, Stmt,
----------------
Perhaps call it isExpansionInMainFile? Because we might want isSpellingInMainFile at some point. Same below.

================
Comment at: include/clang/ASTMatchers/ASTMatchers.h:215
@@ +214,3 @@
+/// Usable as: Matcher<Decl>, Matcher<Stmt>, Matcher<TypeLoc>
+AST_POLYMORPHIC_MATCHER_P(isInFileMatchingName,
+                          AST_POLYMORPHIC_SUPPORTED_TYPES_3(Decl, Stmt,
----------------
I'd again add Expansion and then leave the name out: isExpansionInFileMatching("...") seems to read nicely ...

================
Comment at: include/clang/Tooling/Tooling.h:155
@@ -154,4 +154,3 @@
 /// \return - True if 'ToolAction' was successfully executed.
-bool runToolOnCodeWithArgs(clang::FrontendAction *ToolAction, const Twine &Code,
-                           const std::vector<std::string> &Args,
-                           const Twine &FileName = "input.cc");
+bool runToolOnCodeWithArgs(
+    clang::FrontendAction *ToolAction, const Twine &Code,
----------------
Yea, typedef seems in order - perhaps FileMappings? OverlayMappings? OverlayedFileMappings? OverlayedFileContent? FileContentMappings? just throwing a few ideas out. The right spot is to put it into this header, perhaps directly above where it's first used (which for now is probably here).

http://reviews.llvm.org/D4283






More information about the cfe-commits mailing list