[PATCH] D23544: [clang-tidy] readability-implicit-bool-cast forgets to store its options.

Haojian Wu via cfe-commits cfe-commits at lists.llvm.org
Tue Aug 16 04:23:05 PDT 2016


This revision was automatically updated to reflect the committed changes.
Closed by commit rL278791: [clang-tidy] readability-implicit-bool-cast forgets to store its options. (authored by hokein).

Changed prior to commit:
  https://reviews.llvm.org/D23544?vs=68154&id=68158#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D23544

Files:
  clang-tools-extra/trunk/clang-tidy/readability/ImplicitBoolCastCheck.cpp
  clang-tools-extra/trunk/clang-tidy/readability/ImplicitBoolCastCheck.h

Index: clang-tools-extra/trunk/clang-tidy/readability/ImplicitBoolCastCheck.cpp
===================================================================
--- clang-tools-extra/trunk/clang-tidy/readability/ImplicitBoolCastCheck.cpp
+++ clang-tools-extra/trunk/clang-tidy/readability/ImplicitBoolCastCheck.cpp
@@ -299,6 +299,22 @@
 
 } // anonymous namespace
 
+ImplicitBoolCastCheck::ImplicitBoolCastCheck(StringRef Name,
+                                             ClangTidyContext *Context)
+    : ClangTidyCheck(Name, Context),
+      AllowConditionalIntegerCasts(
+          Options.get("AllowConditionalIntegerCasts", false)),
+      AllowConditionalPointerCasts(
+          Options.get("AllowConditionalPointerCasts", false)) {}
+
+void ImplicitBoolCastCheck::storeOptions(
+    ClangTidyOptions::OptionMap &Opts) {
+  Options.store(Opts, "AllowConditionalIntegerCasts",
+                AllowConditionalIntegerCasts);
+  Options.store(Opts, "AllowConditionalPointerCasts",
+                AllowConditionalPointerCasts);
+}
+
 void ImplicitBoolCastCheck::registerMatchers(MatchFinder *Finder) {
   // This check doesn't make much sense if we run it on language without
   // built-in bool support.
Index: clang-tools-extra/trunk/clang-tidy/readability/ImplicitBoolCastCheck.h
===================================================================
--- clang-tools-extra/trunk/clang-tidy/readability/ImplicitBoolCastCheck.h
+++ clang-tools-extra/trunk/clang-tidy/readability/ImplicitBoolCastCheck.h
@@ -22,12 +22,9 @@
 /// http://clang.llvm.org/extra/clang-tidy/checks/readability-implicit-bool-cast.html
 class ImplicitBoolCastCheck : public ClangTidyCheck {
 public:
-  ImplicitBoolCastCheck(StringRef Name, ClangTidyContext *Context)
-      : ClangTidyCheck(Name, Context),
-        AllowConditionalIntegerCasts(
-            Options.get("AllowConditionalIntegerCasts", 0) != 0),
-        AllowConditionalPointerCasts(
-            Options.get("AllowConditionalPointerCasts", 0) != 0) {}
+  ImplicitBoolCastCheck(StringRef Name, ClangTidyContext *Context);
+  void storeOptions(ClangTidyOptions::OptionMap &Opts) override;
+
   void registerMatchers(ast_matchers::MatchFinder *Finder) override;
   void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D23544.68158.patch
Type: text/x-patch
Size: 2275 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160816/f1720631/attachment.bin>


More information about the cfe-commits mailing list