[PATCH] Allow users to specify NULL like macros to be replaced

Manuel Klimek klimek at google.com
Tue Mar 26 02:36:15 PDT 2013


  Dmitri: while I think a tool to find user-null-macros is useful, this change seems fine on its own - if the user knows the macro, we're done. I agree that it sounds like a nice addition, especially for larger code-bases, though.


================
Comment at: cpp11-migrate/UseNullptr/NullptrActions.h:37
@@ -38,1 +36,3 @@
+  typedef llvm::SmallVector<llvm::StringRef, 1> StringsVec;
+  StringsVec UserNullMacros;
 };
----------------
I'm opposed to this typedef - I don't think it aids too much in readability. Vectors of strings are so fundamental that I find hiding that we're using a vector of StringRef confusing. (also, I'm opposed to "Vec" when it's just 3 keystrokes (fewer if you use a decent code completion tool))

================
Comment at: cpp11-migrate/UseNullptr/NullptrActions.cpp:171
@@ +170,3 @@
+      // Check to see if the user wants to replace the macro being expanded.
+      bool ReplaceNullMacro = false;
+      for (StringsVec::iterator it = UserNullMacros.begin(),
----------------
Does: ReplaceNullMacro = std::find(UserNullMacros.begin(), UserNullMacros.end(), OutermostMacroName) != UserNullMacros.end();
not work?


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



More information about the cfe-commits mailing list