[PATCH] Added comprehensive macro arg usage logic to Use-Nullptr Transform

Manuel Klimek klimek at google.com
Fri May 3 00:40:50 PDT 2013


  My main concern is that it looks as though we're reimplementing things here that should be made easier within Clang proper instead - for example by adding stuff to Tooling or fixing the existing behavior for makeFileCharRange (I am working on a CL regarding problems there for example).

  That doesn't mean I think we should not make this change, but at least I think it warrants careful documentation of what the alternatives are and why we cannot currently use them, in combination with some FIXMEs.


================
Comment at: cpp11-migrate/UseNullptr/NullptrActions.cpp:88-89
@@ +87,4 @@
+/// SourceLocation pointing within the definition of another macro.
+bool getMacroAndArgLocations(SourceLocation Loc, const SourceManager &SM,
+                             SourceLocation &ArgLoc, SourceLocation &MacroLoc) {
+  assert(Loc.isMacroID() && "Only reasonble to call this on macros");
----------------
If Lexer::makeFileCharRange doesn't do the right thing, we might want to fix it rather than reimplementing it here - or is this function supposed to do something completely different?

================
Comment at: cpp11-migrate/UseNullptr/NullptrActions.cpp:288
@@ +287,3 @@
+/// \brief Tests that all expansions of a macro arg, one of which expands to
+/// result in \p CE, yeild NullTo(Member)Pointer casts.
+bool allArgUsesValid(const CastExpr *CE, ASTContext &Context) {
----------------
s/yeild/yield/


http://llvm-reviews.chandlerc.com/D732



More information about the cfe-commits mailing list