[PATCH] D16700: [Clang-tidy] Make null pointer literals for fixes configurable for two checks

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Thu Feb 4 05:42:28 PST 2016


aaron.ballman added inline comments.

================
Comment at: clang-tidy/readability/ImplicitBoolCastCheck.h:32
@@ -30,1 +31,3 @@
+            Options.get("NullPointerLiteral",
+            Context->getLangOpts().CPlusPlus11 ? "nullptr" : "0")) {}
   void registerMatchers(ast_matchers::MatchFinder *Finder) override;
----------------
Eugene.Zelenko wrote:
> LegalizeAdulthood wrote:
> > aaron.ballman wrote:
> > > I know you are following the pattern used in the code here, but I think this class needs a storeOptions() function as well. See AssertSideEffectCheck as an example.
> > This will need rebasing on the existing code, which is using "NULL" as the pre-C++11 fallback default, not "0".
> This was in original code. I just didn't want to change default.
If the code is using NULL as the pre-C++11 fallback, don't we also need an include for stddef.h/cstddef?

================
Comment at: clang-tidy/readability/ImplicitBoolCastCheck.h:36-38
@@ -32,1 +35,5 @@
 
+  StringRef getNullPointerLiteral() const {
+    return NullPointerLiteral;
+  }
+
----------------
LegalizeAdulthood wrote:
> I don't understand why the checks need a public getter for the nullptr literal being used.
Agreed, good catch.


Repository:
  rL LLVM

http://reviews.llvm.org/D16700





More information about the cfe-commits mailing list