ソースを参照

[analyzer][NFC] Fix inconsistent references to checkers as "checks"

Traditionally, clang-tidy uses the term check, and the analyzer uses checker,
but in the very early years, this wasn't the case, and code originating from the
early 2010's still incorrectly refer to checkers as checks.

This patch attempts to hunt down most of these, aiming to refer to checkers as
checkers, but preserve references to callback functions (like checkPreCall) as
checks.

Differential Revision: https://reviews.llvm.org/D67140

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@371760 91177308-0d34-0410-b5e6-96231b3b80d8
Kristof Umann 6 年 前
コミット
692350b332
32 ファイル変更180 行追加175 行削除
  1. 3 3
      include/clang/Analysis/PathDiagnostic.h
  2. 49 39
      include/clang/StaticAnalyzer/Core/AnalyzerOptions.h
  3. 2 2
      include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h
  4. 20 20
      include/clang/StaticAnalyzer/Core/BugReporter/BugType.h
  5. 2 2
      include/clang/StaticAnalyzer/Core/Checker.h
  6. 12 11
      include/clang/StaticAnalyzer/Core/CheckerManager.h
  7. 1 1
      include/clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h
  8. 2 2
      lib/Analysis/PathDiagnostic.cpp
  9. 1 1
      lib/Analysis/plugins/SampleAnalyzer/MainCallChecker.cpp
  10. 1 1
      lib/Frontend/CompilerInvocation.cpp
  11. 9 11
      lib/StaticAnalyzer/Checkers/CStringChecker.cpp
  12. 4 4
      lib/StaticAnalyzer/Checkers/CallAndMessageChecker.cpp
  13. 16 18
      lib/StaticAnalyzer/Checkers/CheckSecuritySyntaxOnly.cpp
  14. 1 1
      lib/StaticAnalyzer/Checkers/DeleteWithNonVirtualDtorChecker.cpp
  15. 1 1
      lib/StaticAnalyzer/Checkers/ExprInspectionChecker.cpp
  16. 3 5
      lib/StaticAnalyzer/Checkers/IteratorChecker.cpp
  17. 6 8
      lib/StaticAnalyzer/Checkers/IvarInvalidationChecker.cpp
  18. 5 6
      lib/StaticAnalyzer/Checkers/MallocChecker.cpp
  19. 7 7
      lib/StaticAnalyzer/Checkers/NullabilityChecker.cpp
  20. 1 1
      lib/StaticAnalyzer/Checkers/UndefinedArraySubscriptChecker.cpp
  21. 3 2
      lib/StaticAnalyzer/Checkers/ValistChecker.cpp
  22. 6 6
      lib/StaticAnalyzer/Checkers/VirtualCallChecker.cpp
  23. 6 6
      lib/StaticAnalyzer/Core/BugReporter.cpp
  24. 4 4
      lib/StaticAnalyzer/Core/Checker.cpp
  25. 1 1
      lib/StaticAnalyzer/Core/CheckerManager.cpp
  26. 2 1
      lib/StaticAnalyzer/Core/ExprEngineCXX.cpp
  27. 3 2
      lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp
  28. 2 2
      lib/StaticAnalyzer/Core/PlistDiagnostics.cpp
  29. 4 4
      lib/StaticAnalyzer/Core/SarifDiagnostics.cpp
  30. 1 1
      lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp
  31. 1 1
      lib/StaticAnalyzer/Frontend/CheckerRegistry.cpp
  32. 1 1
      unittests/StaticAnalyzer/RegisterCustomCheckersTest.cpp

+ 3 - 3
include/clang/Analysis/PathDiagnostic.h

@@ -725,7 +725,7 @@ using FilesToLineNumsMap = std::map<FileID, std::set<unsigned>>;
 ///  diagnostic.  It represents an ordered-collection of PathDiagnosticPieces,
 ///  diagnostic.  It represents an ordered-collection of PathDiagnosticPieces,
 ///  each which represent the pieces of the path.
 ///  each which represent the pieces of the path.
 class PathDiagnostic : public llvm::FoldingSetNode {
 class PathDiagnostic : public llvm::FoldingSetNode {
-  std::string CheckName;
+  std::string CheckerName;
   const Decl *DeclWithIssue;
   const Decl *DeclWithIssue;
   std::string BugType;
   std::string BugType;
   std::string VerboseDesc;
   std::string VerboseDesc;
@@ -749,7 +749,7 @@ class PathDiagnostic : public llvm::FoldingSetNode {
 
 
 public:
 public:
   PathDiagnostic() = delete;
   PathDiagnostic() = delete;
-  PathDiagnostic(StringRef CheckName, const Decl *DeclWithIssue,
+  PathDiagnostic(StringRef CheckerName, const Decl *DeclWithIssue,
                  StringRef bugtype, StringRef verboseDesc, StringRef shortDesc,
                  StringRef bugtype, StringRef verboseDesc, StringRef shortDesc,
                  StringRef category, PathDiagnosticLocation LocationToUnique,
                  StringRef category, PathDiagnosticLocation LocationToUnique,
                  const Decl *DeclToUnique,
                  const Decl *DeclToUnique,
@@ -798,7 +798,7 @@ public:
     return ShortDesc.empty() ? VerboseDesc : ShortDesc;
     return ShortDesc.empty() ? VerboseDesc : ShortDesc;
   }
   }
 
 
-  StringRef getCheckName() const { return CheckName; }
+  StringRef getCheckerName() const { return CheckerName; }
   StringRef getBugType() const { return BugType; }
   StringRef getBugType() const { return BugType; }
   StringRef getCategory() const { return Category; }
   StringRef getCategory() const { return Category; }
 
 

+ 49 - 39
include/clang/StaticAnalyzer/Core/AnalyzerOptions.h

@@ -163,41 +163,15 @@ class AnalyzerOptions : public RefCountedBase<AnalyzerOptions> {
 public:
 public:
   using ConfigTable = llvm::StringMap<std::string>;
   using ConfigTable = llvm::StringMap<std::string>;
 
 
+  /// Retrieves the list of checkers generated from Checkers.td. This doesn't
+  /// contain statically linked but non-generated checkers and plugin checkers!
   static std::vector<StringRef>
   static std::vector<StringRef>
-  getRegisteredCheckers(bool IncludeExperimental = false) {
-    static const StringRef StaticAnalyzerChecks[] = {
-#define GET_CHECKERS
-#define CHECKER(FULLNAME, CLASS, HELPTEXT, DOC_URI, IS_HIDDEN) FULLNAME,
-#include "clang/StaticAnalyzer/Checkers/Checkers.inc"
-#undef CHECKER
-#undef GET_CHECKERS
-    };
-    std::vector<StringRef> Checkers;
-    for (StringRef CheckerName : StaticAnalyzerChecks) {
-      if (!CheckerName.startswith("debug.") &&
-          (IncludeExperimental || !CheckerName.startswith("alpha.")))
-        Checkers.push_back(CheckerName);
-    }
-    return Checkers;
-  }
+  getRegisteredCheckers(bool IncludeExperimental = false);
 
 
+  /// Retrieves the list of packages generated from Checkers.td. This doesn't
+  /// contain statically linked but non-generated packages and plugin packages!
   static std::vector<StringRef>
   static std::vector<StringRef>
-  getRegisteredPackages(bool IncludeExperimental = false) {
-    static const StringRef StaticAnalyzerPackages[] = {
-#define GET_PACKAGES
-#define PACKAGE(FULLNAME) FULLNAME,
-#include "clang/StaticAnalyzer/Checkers/Checkers.inc"
-#undef PACKAGE
-#undef GET_PACKAGES
-    };
-    std::vector<StringRef> Packages;
-    for (StringRef PackageName : StaticAnalyzerPackages) {
-      if (PackageName != "debug" &&
-          (IncludeExperimental || PackageName != "alpha"))
-        Packages.push_back(PackageName);
-    }
-    return Packages;
-  }
+  getRegisteredPackages(bool IncludeExperimental = false);
 
 
   /// Convenience function for printing options or checkers and their
   /// Convenience function for printing options or checkers and their
   /// description in a formatted manner. If \p MinLineWidth is set to 0, no line
   /// description in a formatted manner. If \p MinLineWidth is set to 0, no line
@@ -247,12 +221,12 @@ public:
   /// The maximum number of times the analyzer visits a block.
   /// The maximum number of times the analyzer visits a block.
   unsigned maxBlockVisitOnPath;
   unsigned maxBlockVisitOnPath;
 
 
-  /// Disable all analyzer checks.
+  /// Disable all analyzer checkers.
   ///
   ///
-  /// This flag allows one to disable analyzer checks on the code processed by
+  /// This flag allows one to disable analyzer checkers on the code processed by
   /// the given analysis consumer. Note, the code will get parsed and the
   /// the given analysis consumer. Note, the code will get parsed and the
   /// command-line options will get checked.
   /// command-line options will get checked.
-  unsigned DisableAllChecks : 1;
+  unsigned DisableAllCheckers : 1;
 
 
   unsigned ShowCheckerHelp : 1;
   unsigned ShowCheckerHelp : 1;
   unsigned ShowCheckerHelpAlpha : 1;
   unsigned ShowCheckerHelpAlpha : 1;
@@ -327,7 +301,7 @@ public:
   }
   }
 
 
   AnalyzerOptions()
   AnalyzerOptions()
-      : DisableAllChecks(false), ShowCheckerHelp(false),
+      : DisableAllCheckers(false), ShowCheckerHelp(false),
         ShowCheckerHelpAlpha(false), ShowCheckerHelpDeveloper(false),
         ShowCheckerHelpAlpha(false), ShowCheckerHelpDeveloper(false),
         ShowCheckerOptionList(false), ShowCheckerOptionAlphaList(false),
         ShowCheckerOptionList(false), ShowCheckerOptionAlphaList(false),
         ShowCheckerOptionDeveloperList(false), ShowEnabledCheckerList(false),
         ShowCheckerOptionDeveloperList(false), ShowEnabledCheckerList(false),
@@ -345,7 +319,7 @@ public:
   /// If an option value is not provided, returns the given \p DefaultVal.
   /// If an option value is not provided, returns the given \p DefaultVal.
   /// @param [in] CheckerName The *full name* of the checker. One may retrieve
   /// @param [in] CheckerName The *full name* of the checker. One may retrieve
   /// this from the checker object's field \c Name, or through \c
   /// this from the checker object's field \c Name, or through \c
-  /// CheckerManager::getCurrentCheckName within the checker's registry
+  /// CheckerManager::getCurrentCheckerName within the checker's registry
   /// function.
   /// function.
   /// Checker options are retrieved in the following format:
   /// Checker options are retrieved in the following format:
   /// `-analyzer-config CheckerName:OptionName=Value.
   /// `-analyzer-config CheckerName:OptionName=Value.
@@ -365,7 +339,7 @@ public:
   /// If an option value is not provided, returns the given \p DefaultVal.
   /// If an option value is not provided, returns the given \p DefaultVal.
   /// @param [in] CheckerName The *full name* of the checker. One may retrieve
   /// @param [in] CheckerName The *full name* of the checker. One may retrieve
   /// this from the checker object's field \c Name, or through \c
   /// this from the checker object's field \c Name, or through \c
-  /// CheckerManager::getCurrentCheckName within the checker's registry
+  /// CheckerManager::getCurrentCheckerName within the checker's registry
   /// function.
   /// function.
   /// Checker options are retrieved in the following format:
   /// Checker options are retrieved in the following format:
   /// `-analyzer-config CheckerName:OptionName=Value.
   /// `-analyzer-config CheckerName:OptionName=Value.
@@ -385,7 +359,7 @@ public:
   /// If an option value is not provided, returns the given \p DefaultVal.
   /// If an option value is not provided, returns the given \p DefaultVal.
   /// @param [in] CheckerName The *full name* of the checker. One may retrieve
   /// @param [in] CheckerName The *full name* of the checker. One may retrieve
   /// this from the checker object's field \c Name, or through \c
   /// this from the checker object's field \c Name, or through \c
-  /// CheckerManager::getCurrentCheckName within the checker's registry
+  /// CheckerManager::getCurrentCheckerName within the checker's registry
   /// function.
   /// function.
   /// Checker options are retrieved in the following format:
   /// Checker options are retrieved in the following format:
   /// `-analyzer-config CheckerName:OptionName=Value.
   /// `-analyzer-config CheckerName:OptionName=Value.
@@ -439,6 +413,42 @@ inline UserModeKind AnalyzerOptions::getUserMode() const {
   return K.getValue();
   return K.getValue();
 }
 }
 
 
+inline std::vector<StringRef>
+AnalyzerOptions::getRegisteredCheckers(bool IncludeExperimental) {
+  static const StringRef StaticAnalyzerCheckerNames[] = {
+#define GET_CHECKERS
+#define CHECKER(FULLNAME, CLASS, HELPTEXT, DOC_URI, IS_HIDDEN) FULLNAME,
+#include "clang/StaticAnalyzer/Checkers/Checkers.inc"
+#undef CHECKER
+#undef GET_CHECKERS
+  };
+  std::vector<StringRef> Checkers;
+  for (StringRef CheckerName : StaticAnalyzerCheckerNames) {
+    if (!CheckerName.startswith("debug.") &&
+        (IncludeExperimental || !CheckerName.startswith("alpha.")))
+      Checkers.push_back(CheckerName);
+  }
+  return Checkers;
+}
+
+inline std::vector<StringRef>
+AnalyzerOptions::getRegisteredPackages(bool IncludeExperimental) {
+  static const StringRef StaticAnalyzerPackageNames[] = {
+#define GET_PACKAGES
+#define PACKAGE(FULLNAME) FULLNAME,
+#include "clang/StaticAnalyzer/Checkers/Checkers.inc"
+#undef PACKAGE
+#undef GET_PACKAGES
+  };
+  std::vector<StringRef> Packages;
+  for (StringRef PackageName : StaticAnalyzerPackageNames) {
+    if (PackageName != "debug" &&
+        (IncludeExperimental || PackageName != "alpha"))
+      Packages.push_back(PackageName);
+  }
+  return Packages;
+}
+
 } // namespace clang
 } // namespace clang
 
 
 #endif // LLVM_CLANG_STATICANALYZER_CORE_ANALYZEROPTIONS_H
 #endif // LLVM_CLANG_STATICANALYZER_CORE_ANALYZEROPTIONS_H

+ 2 - 2
include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h

@@ -621,7 +621,7 @@ public:
                        ArrayRef<SourceRange> Ranges = None,
                        ArrayRef<SourceRange> Ranges = None,
                        ArrayRef<FixItHint> Fixits = None);
                        ArrayRef<FixItHint> Fixits = None);
 
 
-  void EmitBasicReport(const Decl *DeclWithIssue, CheckName CheckName,
+  void EmitBasicReport(const Decl *DeclWithIssue, CheckerNameRef CheckerName,
                        StringRef BugName, StringRef BugCategory,
                        StringRef BugName, StringRef BugCategory,
                        StringRef BugStr, PathDiagnosticLocation Loc,
                        StringRef BugStr, PathDiagnosticLocation Loc,
                        ArrayRef<SourceRange> Ranges = None,
                        ArrayRef<SourceRange> Ranges = None,
@@ -632,7 +632,7 @@ private:
 
 
   /// Returns a BugType that is associated with the given name and
   /// Returns a BugType that is associated with the given name and
   /// category.
   /// category.
-  BugType *getBugTypeForName(CheckName CheckName, StringRef name,
+  BugType *getBugTypeForName(CheckerNameRef CheckerName, StringRef name,
                              StringRef category);
                              StringRef category);
 
 
   virtual BugReport *
   virtual BugReport *

+ 20 - 20
include/clang/StaticAnalyzer/Core/BugReporter/BugType.h

@@ -28,8 +28,8 @@ class ExprEngine;
 
 
 class BugType {
 class BugType {
 private:
 private:
-  const CheckName Check;
-  const std::string Name;
+  const CheckerNameRef CheckerName;
+  const std::string Description;
   const std::string Category;
   const std::string Category;
   const CheckerBase *Checker;
   const CheckerBase *Checker;
   bool SuppressOnSink;
   bool SuppressOnSink;
@@ -37,28 +37,27 @@ private:
   virtual void anchor();
   virtual void anchor();
 
 
 public:
 public:
-  BugType(CheckName Check, StringRef Name, StringRef Cat,
-          bool SuppressOnSink=false)
-      : Check(Check), Name(Name), Category(Cat), Checker(nullptr),
-        SuppressOnSink(SuppressOnSink) {}
+  BugType(CheckerNameRef CheckerName, StringRef Name, StringRef Cat,
+          bool SuppressOnSink = false)
+      : CheckerName(CheckerName), Description(Name), Category(Cat),
+        Checker(nullptr), SuppressOnSink(SuppressOnSink) {}
   BugType(const CheckerBase *Checker, StringRef Name, StringRef Cat,
   BugType(const CheckerBase *Checker, StringRef Name, StringRef Cat,
-          bool SuppressOnSink=false)
-      : Check(Checker->getCheckName()), Name(Name), Category(Cat),
-        Checker(Checker), SuppressOnSink(SuppressOnSink) {}
+          bool SuppressOnSink = false)
+      : CheckerName(Checker->getCheckerName()), Description(Name),
+        Category(Cat), Checker(Checker), SuppressOnSink(SuppressOnSink) {}
   virtual ~BugType() = default;
   virtual ~BugType() = default;
 
 
-  StringRef getName() const { return Name; }
+  StringRef getDescription() const { return Description; }
   StringRef getCategory() const { return Category; }
   StringRef getCategory() const { return Category; }
-  StringRef getCheckName() const {
-    // FIXME: This is a workaround to ensure that the correct check name is used
-    // The check names are set after the constructors are run.
+  StringRef getCheckerName() const {
+    // FIXME: This is a workaround to ensure that the correct checerk name is
+    // used. The checker names are set after the constructors are run.
     // In case the BugType object is initialized in the checker's ctor
     // In case the BugType object is initialized in the checker's ctor
-    // the Check field will be empty. To circumvent this problem we use
+    // the CheckerName field will be empty. To circumvent this problem we use
     // CheckerBase whenever it is possible.
     // CheckerBase whenever it is possible.
-    StringRef CheckName =
-        Checker ? Checker->getCheckName().getName() : Check.getName();
-    assert(!CheckName.empty() && "Check name is not set properly.");
-    return CheckName;
+    StringRef Ret = Checker ? Checker->getCheckerName() : CheckerName;
+    assert(!Ret.empty() && "Checker name is not set properly.");
+    return Ret;
   }
   }
 
 
   /// isSuppressOnSink - Returns true if bug reports associated with this bug
   /// isSuppressOnSink - Returns true if bug reports associated with this bug
@@ -71,8 +70,9 @@ class BuiltinBug : public BugType {
   const std::string desc;
   const std::string desc;
   void anchor() override;
   void anchor() override;
 public:
 public:
-  BuiltinBug(class CheckName check, const char *name, const char *description)
-      : BugType(check, name, categories::LogicError), desc(description) {}
+  BuiltinBug(class CheckerNameRef checker, const char *name,
+             const char *description)
+      : BugType(checker, name, categories::LogicError), desc(description) {}
 
 
   BuiltinBug(const CheckerBase *checker, const char *name,
   BuiltinBug(const CheckerBase *checker, const char *name,
              const char *description)
              const char *description)

+ 2 - 2
include/clang/StaticAnalyzer/Core/Checker.h

@@ -490,12 +490,12 @@ public:
 } // end eval namespace
 } // end eval namespace
 
 
 class CheckerBase : public ProgramPointTag {
 class CheckerBase : public ProgramPointTag {
-  CheckName Name;
+  CheckerNameRef Name;
   friend class ::clang::ento::CheckerManager;
   friend class ::clang::ento::CheckerManager;
 
 
 public:
 public:
   StringRef getTagDescription() const override;
   StringRef getTagDescription() const override;
-  CheckName getCheckName() const;
+  CheckerNameRef getCheckerName() const;
 
 
   /// See CheckerManager::runCheckersForPrintState.
   /// See CheckerManager::runCheckersForPrintState.
   virtual void printState(raw_ostream &Out, ProgramStateRef State,
   virtual void printState(raw_ostream &Out, ProgramStateRef State,

+ 12 - 11
include/clang/StaticAnalyzer/Core/CheckerManager.h

@@ -90,19 +90,20 @@ enum PointerEscapeKind {
   PSK_EscapeOther
   PSK_EscapeOther
 };
 };
 
 
-// This wrapper is used to ensure that only StringRefs originating from the
-// CheckerRegistry are used as check names. We want to make sure all check
-// name strings have a lifetime that keeps them alive at least until the path
-// diagnostics have been processed.
-class CheckName {
+/// This wrapper is used to ensure that only StringRefs originating from the
+/// CheckerRegistry are used as check names. We want to make sure all checker
+/// name strings have a lifetime that keeps them alive at least until the path
+/// diagnostics have been processed, since they are expected to be constexpr
+/// string literals (most likely generated by TblGen).
+class CheckerNameRef {
   friend class ::clang::ento::CheckerRegistry;
   friend class ::clang::ento::CheckerRegistry;
 
 
   StringRef Name;
   StringRef Name;
 
 
-  explicit CheckName(StringRef Name) : Name(Name) {}
+  explicit CheckerNameRef(StringRef Name) : Name(Name) {}
 
 
 public:
 public:
-  CheckName() = default;
+  CheckerNameRef() = default;
 
 
   StringRef getName() const { return Name; }
   StringRef getName() const { return Name; }
   operator StringRef() const { return Name; }
   operator StringRef() const { return Name; }
@@ -118,7 +119,7 @@ class CheckerManager {
   ASTContext &Context;
   ASTContext &Context;
   const LangOptions LangOpts;
   const LangOptions LangOpts;
   AnalyzerOptions &AOptions;
   AnalyzerOptions &AOptions;
-  CheckName CurrentCheckName;
+  CheckerNameRef CurrentCheckerName;
 
 
 public:
 public:
   CheckerManager(ASTContext &Context, AnalyzerOptions &AOptions)
   CheckerManager(ASTContext &Context, AnalyzerOptions &AOptions)
@@ -126,8 +127,8 @@ public:
 
 
   ~CheckerManager();
   ~CheckerManager();
 
 
-  void setCurrentCheckName(CheckName name) { CurrentCheckName = name; }
-  CheckName getCurrentCheckName() const { return CurrentCheckName; }
+  void setCurrentCheckerName(CheckerNameRef name) { CurrentCheckerName = name; }
+  CheckerNameRef getCurrentCheckerName() const { return CurrentCheckerName; }
 
 
   bool hasPathSensitiveCheckers() const;
   bool hasPathSensitiveCheckers() const;
 
 
@@ -163,7 +164,7 @@ public:
     assert(!ref && "Checker already registered, use getChecker!");
     assert(!ref && "Checker already registered, use getChecker!");
 
 
     CHECKER *checker = new CHECKER(std::forward<AT>(Args)...);
     CHECKER *checker = new CHECKER(std::forward<AT>(Args)...);
-    checker->Name = CurrentCheckName;
+    checker->Name = CurrentCheckerName;
     CheckerDtors.push_back(CheckerDtor(checker, destruct<CHECKER>));
     CheckerDtors.push_back(CheckerDtor(checker, destruct<CHECKER>));
     CHECKER::_register(checker, *this);
     CHECKER::_register(checker, *this);
     ref = checker;
     ref = checker;

+ 1 - 1
include/clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h

@@ -666,7 +666,7 @@ public:
                                   const LocationContext *LCtx,
                                   const LocationContext *LCtx,
                                   ProgramStateRef State);
                                   ProgramStateRef State);
 
 
-  /// Evaluate a call, running pre- and post-call checks and allowing checkers
+  /// Evaluate a call, running pre- and post-call checkers and allowing checkers
   /// to be responsible for handling the evaluation of the call itself.
   /// to be responsible for handling the evaluation of the call itself.
   void evalCall(ExplodedNodeSet &Dst, ExplodedNode *Pred,
   void evalCall(ExplodedNodeSet &Dst, ExplodedNode *Pred,
                 const CallEvent &Call);
                 const CallEvent &Call);

+ 2 - 2
lib/Analysis/PathDiagnostic.cpp

@@ -117,11 +117,11 @@ void PathPieces::flattenTo(PathPieces &Primary, PathPieces &Current,
 PathDiagnostic::~PathDiagnostic() = default;
 PathDiagnostic::~PathDiagnostic() = default;
 
 
 PathDiagnostic::PathDiagnostic(
 PathDiagnostic::PathDiagnostic(
-    StringRef CheckName, const Decl *declWithIssue, StringRef bugtype,
+    StringRef CheckerName, const Decl *declWithIssue, StringRef bugtype,
     StringRef verboseDesc, StringRef shortDesc, StringRef category,
     StringRef verboseDesc, StringRef shortDesc, StringRef category,
     PathDiagnosticLocation LocationToUnique, const Decl *DeclToUnique,
     PathDiagnosticLocation LocationToUnique, const Decl *DeclToUnique,
     std::unique_ptr<FilesToLineNumsMap> ExecutedLines)
     std::unique_ptr<FilesToLineNumsMap> ExecutedLines)
-    : CheckName(CheckName), DeclWithIssue(declWithIssue),
+    : CheckerName(CheckerName), DeclWithIssue(declWithIssue),
       BugType(StripTrailingDots(bugtype)),
       BugType(StripTrailingDots(bugtype)),
       VerboseDesc(StripTrailingDots(verboseDesc)),
       VerboseDesc(StripTrailingDots(verboseDesc)),
       ShortDesc(StripTrailingDots(shortDesc)),
       ShortDesc(StripTrailingDots(shortDesc)),

+ 1 - 1
lib/Analysis/plugins/SampleAnalyzer/MainCallChecker.cpp

@@ -37,7 +37,7 @@ void MainCallChecker::checkPreStmt(const CallExpr *CE,
       BT.reset(new BugType(this, "call to main", "example analyzer plugin"));
       BT.reset(new BugType(this, "call to main", "example analyzer plugin"));
 
 
     auto report =
     auto report =
-        std::make_unique<PathSensitiveBugReport>(*BT, BT->getName(), N);
+        std::make_unique<PathSensitiveBugReport>(*BT, BT->getDescription(), N);
     report->addRange(Callee->getSourceRange());
     report->addRange(Callee->getSourceRange());
     C.emitReport(std::move(report));
     C.emitReport(std::move(report));
   }
   }

+ 1 - 1
lib/Frontend/CompilerInvocation.cpp

@@ -303,7 +303,7 @@ static bool ParseAnalyzerArgs(AnalyzerOptions &Opts, ArgList &Args,
         .Case("true", true)
         .Case("true", true)
         .Case("false", false)
         .Case("false", false)
         .Default(false);
         .Default(false);
-  Opts.DisableAllChecks = Args.hasArg(OPT_analyzer_disable_all_checks);
+  Opts.DisableAllCheckers = Args.hasArg(OPT_analyzer_disable_all_checks);
 
 
   Opts.visualizeExplodedGraphWithGraphViz =
   Opts.visualizeExplodedGraphWithGraphViz =
     Args.hasArg(OPT_analyzer_viz_egraph_graphviz);
     Args.hasArg(OPT_analyzer_viz_egraph_graphviz);

+ 9 - 11
lib/StaticAnalyzer/Checkers/CStringChecker.cpp

@@ -48,10 +48,10 @@ public:
     DefaultBool CheckCStringBufferOverlap;
     DefaultBool CheckCStringBufferOverlap;
     DefaultBool CheckCStringNotNullTerm;
     DefaultBool CheckCStringNotNullTerm;
 
 
-    CheckName CheckNameCStringNullArg;
-    CheckName CheckNameCStringOutOfBounds;
-    CheckName CheckNameCStringBufferOverlap;
-    CheckName CheckNameCStringNotNullTerm;
+    CheckerNameRef CheckNameCStringNullArg;
+    CheckerNameRef CheckNameCStringOutOfBounds;
+    CheckerNameRef CheckNameCStringBufferOverlap;
+    CheckerNameRef CheckNameCStringNotNullTerm;
   };
   };
 
 
   CStringChecksFilter Filter;
   CStringChecksFilter Filter;
@@ -2409,14 +2409,12 @@ bool ento::shouldRegisterCStringModeling(const LangOptions &LO) {
   void ento::register##name(CheckerManager &mgr) {                             \
   void ento::register##name(CheckerManager &mgr) {                             \
     CStringChecker *checker = mgr.getChecker<CStringChecker>();                \
     CStringChecker *checker = mgr.getChecker<CStringChecker>();                \
     checker->Filter.Check##name = true;                                        \
     checker->Filter.Check##name = true;                                        \
-    checker->Filter.CheckName##name = mgr.getCurrentCheckName();               \
+    checker->Filter.CheckName##name = mgr.getCurrentCheckerName();             \
   }                                                                            \
   }                                                                            \
                                                                                \
                                                                                \
-  bool ento::shouldRegister##name(const LangOptions &LO) {                     \
-    return true;                                                               \
-  }
+  bool ento::shouldRegister##name(const LangOptions &LO) { return true; }
 
 
-  REGISTER_CHECKER(CStringNullArg)
-  REGISTER_CHECKER(CStringOutOfBounds)
-  REGISTER_CHECKER(CStringBufferOverlap)
+REGISTER_CHECKER(CStringNullArg)
+REGISTER_CHECKER(CStringOutOfBounds)
+REGISTER_CHECKER(CStringBufferOverlap)
 REGISTER_CHECKER(CStringNotNullTerm)
 REGISTER_CHECKER(CStringNotNullTerm)

+ 4 - 4
lib/StaticAnalyzer/Checkers/CallAndMessageChecker.cpp

@@ -49,7 +49,7 @@ class CallAndMessageChecker
 
 
 public:
 public:
   DefaultBool Check_CallAndMessageUnInitRefArg;
   DefaultBool Check_CallAndMessageUnInitRefArg;
-  CheckName CheckName_CallAndMessageUnInitRefArg;
+  CheckerNameRef CheckName_CallAndMessageUnInitRefArg;
 
 
   void checkPreStmt(const CallExpr *CE, CheckerContext &C) const;
   void checkPreStmt(const CallExpr *CE, CheckerContext &C) const;
   void checkPreStmt(const CXXDeleteExpr *DE, CheckerContext &C) const;
   void checkPreStmt(const CXXDeleteExpr *DE, CheckerContext &C) const;
@@ -95,7 +95,7 @@ void CallAndMessageChecker::emitBadCall(BugType *BT, CheckerContext &C,
   if (!N)
   if (!N)
     return;
     return;
 
 
-  auto R = std::make_unique<PathSensitiveBugReport>(*BT, BT->getName(), N);
+  auto R = std::make_unique<PathSensitiveBugReport>(*BT, BT->getDescription(), N);
   if (BadE) {
   if (BadE) {
     R->addRange(BadE->getSourceRange());
     R->addRange(BadE->getSourceRange());
     if (BadE->isGLValue())
     if (BadE->isGLValue())
@@ -482,7 +482,7 @@ void CallAndMessageChecker::checkPreObjCMessage(const ObjCMethodCall &msg,
       }
       }
       assert(BT && "Unknown message kind.");
       assert(BT && "Unknown message kind.");
 
 
-      auto R = std::make_unique<PathSensitiveBugReport>(*BT, BT->getName(), N);
+      auto R = std::make_unique<PathSensitiveBugReport>(*BT, BT->getDescription(), N);
       const ObjCMessageExpr *ME = msg.getOriginExpr();
       const ObjCMessageExpr *ME = msg.getOriginExpr();
       R->addRange(ME->getReceiverRange());
       R->addRange(ME->getReceiverRange());
 
 
@@ -612,7 +612,7 @@ bool ento::shouldRegisterCallAndMessageChecker(const LangOptions &LO) {
 void ento::registerCallAndMessageUnInitRefArg(CheckerManager &mgr) {
 void ento::registerCallAndMessageUnInitRefArg(CheckerManager &mgr) {
   CallAndMessageChecker *Checker = mgr.getChecker<CallAndMessageChecker>();
   CallAndMessageChecker *Checker = mgr.getChecker<CallAndMessageChecker>();
   Checker->Check_CallAndMessageUnInitRefArg = true;
   Checker->Check_CallAndMessageUnInitRefArg = true;
-  Checker->CheckName_CallAndMessageUnInitRefArg = mgr.getCurrentCheckName();
+  Checker->CheckName_CallAndMessageUnInitRefArg = mgr.getCurrentCheckerName();
 }
 }
 
 
 bool ento::shouldRegisterCallAndMessageUnInitRefArg(const LangOptions &LO) {
 bool ento::shouldRegisterCallAndMessageUnInitRefArg(const LangOptions &LO) {

+ 16 - 18
lib/StaticAnalyzer/Checkers/CheckSecuritySyntaxOnly.cpp

@@ -50,19 +50,19 @@ struct ChecksFilter {
   DefaultBool check_FloatLoopCounter;
   DefaultBool check_FloatLoopCounter;
   DefaultBool check_UncheckedReturn;
   DefaultBool check_UncheckedReturn;
 
 
-  CheckName checkName_bcmp;
-  CheckName checkName_bcopy;
-  CheckName checkName_bzero;
-  CheckName checkName_gets;
-  CheckName checkName_getpw;
-  CheckName checkName_mktemp;
-  CheckName checkName_mkstemp;
-  CheckName checkName_strcpy;
-  CheckName checkName_DeprecatedOrUnsafeBufferHandling;
-  CheckName checkName_rand;
-  CheckName checkName_vfork;
-  CheckName checkName_FloatLoopCounter;
-  CheckName checkName_UncheckedReturn;
+  CheckerNameRef checkName_bcmp;
+  CheckerNameRef checkName_bcopy;
+  CheckerNameRef checkName_bzero;
+  CheckerNameRef checkName_gets;
+  CheckerNameRef checkName_getpw;
+  CheckerNameRef checkName_mktemp;
+  CheckerNameRef checkName_mkstemp;
+  CheckerNameRef checkName_strcpy;
+  CheckerNameRef checkName_DeprecatedOrUnsafeBufferHandling;
+  CheckerNameRef checkName_rand;
+  CheckerNameRef checkName_vfork;
+  CheckerNameRef checkName_FloatLoopCounter;
+  CheckerNameRef checkName_UncheckedReturn;
 };
 };
 
 
 class WalkAST : public StmtVisitor<WalkAST> {
 class WalkAST : public StmtVisitor<WalkAST> {
@@ -1015,14 +1015,12 @@ bool ento::shouldRegisterSecuritySyntaxChecker(const LangOptions &LO) {
 
 
 #define REGISTER_CHECKER(name)                                                 \
 #define REGISTER_CHECKER(name)                                                 \
   void ento::register##name(CheckerManager &mgr) {                             \
   void ento::register##name(CheckerManager &mgr) {                             \
-    SecuritySyntaxChecker *checker =  mgr.getChecker<SecuritySyntaxChecker>(); \
+    SecuritySyntaxChecker *checker = mgr.getChecker<SecuritySyntaxChecker>();  \
     checker->filter.check_##name = true;                                       \
     checker->filter.check_##name = true;                                       \
-    checker->filter.checkName_##name = mgr.getCurrentCheckName();              \
+    checker->filter.checkName_##name = mgr.getCurrentCheckerName();            \
   }                                                                            \
   }                                                                            \
                                                                                \
                                                                                \
-  bool ento::shouldRegister##name(const LangOptions &LO) {                     \
-    return true;                                                               \
-  }
+  bool ento::shouldRegister##name(const LangOptions &LO) { return true; }
 
 
 REGISTER_CHECKER(bcmp)
 REGISTER_CHECKER(bcmp)
 REGISTER_CHECKER(bcopy)
 REGISTER_CHECKER(bcopy)

+ 1 - 1
lib/StaticAnalyzer/Checkers/DeleteWithNonVirtualDtorChecker.cpp

@@ -92,7 +92,7 @@ void DeleteWithNonVirtualDtorChecker::checkPreStmt(const CXXDeleteExpr *DE,
                          "Logic error"));
                          "Logic error"));
 
 
   ExplodedNode *N = C.generateNonFatalErrorNode();
   ExplodedNode *N = C.generateNonFatalErrorNode();
-  auto R = std::make_unique<PathSensitiveBugReport>(*BT, BT->getName(), N);
+  auto R = std::make_unique<PathSensitiveBugReport>(*BT, BT->getDescription(), N);
 
 
   // Mark region of problematic base class for later use in the BugVisitor.
   // Mark region of problematic base class for later use in the BugVisitor.
   R->markInteresting(BaseClassRegion);
   R->markInteresting(BaseClassRegion);

+ 1 - 1
lib/StaticAnalyzer/Checkers/ExprInspectionChecker.cpp

@@ -305,7 +305,7 @@ void ExprInspectionChecker::analyzerHashDump(const CallExpr *CE,
   const SourceManager &SM = C.getSourceManager();
   const SourceManager &SM = C.getSourceManager();
   FullSourceLoc FL(CE->getArg(0)->getBeginLoc(), SM);
   FullSourceLoc FL(CE->getArg(0)->getBeginLoc(), SM);
   std::string HashContent =
   std::string HashContent =
-      GetIssueString(SM, FL, getCheckName().getName(), "Category",
+      GetIssueString(SM, FL, getCheckerName().getName(), "Category",
                      C.getLocationContext()->getDecl(), Opts);
                      C.getLocationContext()->getDecl(), Opts);
 
 
   reportBug(HashContent, C);
   reportBug(HashContent, C);

+ 3 - 5
lib/StaticAnalyzer/Checkers/IteratorChecker.cpp

@@ -248,7 +248,7 @@ public:
   };
   };
 
 
   DefaultBool ChecksEnabled[CK_NumCheckKinds];
   DefaultBool ChecksEnabled[CK_NumCheckKinds];
-  CheckName CheckNames[CK_NumCheckKinds];
+  CheckerNameRef CheckNames[CK_NumCheckKinds];
 
 
   void checkPreCall(const CallEvent &Call, CheckerContext &C) const;
   void checkPreCall(const CallEvent &Call, CheckerContext &C) const;
   void checkPostCall(const CallEvent &Call, CheckerContext &C) const;
   void checkPostCall(const CallEvent &Call, CheckerContext &C) const;
@@ -2380,12 +2380,10 @@ bool ento::shouldRegisterIteratorModeling(const LangOptions &LO) {
     auto *checker = Mgr.getChecker<IteratorChecker>();                         \
     auto *checker = Mgr.getChecker<IteratorChecker>();                         \
     checker->ChecksEnabled[IteratorChecker::CK_##name] = true;                 \
     checker->ChecksEnabled[IteratorChecker::CK_##name] = true;                 \
     checker->CheckNames[IteratorChecker::CK_##name] =                          \
     checker->CheckNames[IteratorChecker::CK_##name] =                          \
-        Mgr.getCurrentCheckName();                                             \
+        Mgr.getCurrentCheckerName();                                           \
   }                                                                            \
   }                                                                            \
                                                                                \
                                                                                \
-  bool ento::shouldRegister##name(const LangOptions &LO) {                     \
-    return true;                                                               \
-  }
+  bool ento::shouldRegister##name(const LangOptions &LO) { return true; }
 
 
 REGISTER_CHECKER(IteratorRangeChecker)
 REGISTER_CHECKER(IteratorRangeChecker)
 REGISTER_CHECKER(MismatchedIteratorChecker)
 REGISTER_CHECKER(MismatchedIteratorChecker)

+ 6 - 8
lib/StaticAnalyzer/Checkers/IvarInvalidationChecker.cpp

@@ -48,8 +48,8 @@ struct ChecksFilter {
   /// Check that all ivars are invalidated.
   /// Check that all ivars are invalidated.
   DefaultBool check_InstanceVariableInvalidation;
   DefaultBool check_InstanceVariableInvalidation;
 
 
-  CheckName checkName_MissingInvalidationMethod;
-  CheckName checkName_InstanceVariableInvalidation;
+  CheckerNameRef checkName_MissingInvalidationMethod;
+  CheckerNameRef checkName_InstanceVariableInvalidation;
 };
 };
 
 
 class IvarInvalidationCheckerImpl {
 class IvarInvalidationCheckerImpl {
@@ -199,7 +199,7 @@ class IvarInvalidationCheckerImpl {
                         const ObjCIvarDecl *IvarDecl,
                         const ObjCIvarDecl *IvarDecl,
                         const IvarToPropMapTy &IvarToPopertyMap);
                         const IvarToPropMapTy &IvarToPopertyMap);
 
 
-  void reportNoInvalidationMethod(CheckName CheckName,
+  void reportNoInvalidationMethod(CheckerNameRef CheckName,
                                   const ObjCIvarDecl *FirstIvarDecl,
                                   const ObjCIvarDecl *FirstIvarDecl,
                                   const IvarToPropMapTy &IvarToPopertyMap,
                                   const IvarToPropMapTy &IvarToPopertyMap,
                                   const ObjCInterfaceDecl *InterfaceD,
                                   const ObjCInterfaceDecl *InterfaceD,
@@ -526,7 +526,7 @@ visit(const ObjCImplementationDecl *ImplD) const {
 }
 }
 
 
 void IvarInvalidationCheckerImpl::reportNoInvalidationMethod(
 void IvarInvalidationCheckerImpl::reportNoInvalidationMethod(
-    CheckName CheckName, const ObjCIvarDecl *FirstIvarDecl,
+    CheckerNameRef CheckName, const ObjCIvarDecl *FirstIvarDecl,
     const IvarToPropMapTy &IvarToPopertyMap,
     const IvarToPropMapTy &IvarToPopertyMap,
     const ObjCInterfaceDecl *InterfaceD, bool MissingDeclaration) const {
     const ObjCInterfaceDecl *InterfaceD, bool MissingDeclaration) const {
   SmallString<128> sbuf;
   SmallString<128> sbuf;
@@ -748,12 +748,10 @@ bool ento::shouldRegisterIvarInvalidationModeling(const LangOptions &LO) {
     IvarInvalidationChecker *checker =                                         \
     IvarInvalidationChecker *checker =                                         \
         mgr.getChecker<IvarInvalidationChecker>();                             \
         mgr.getChecker<IvarInvalidationChecker>();                             \
     checker->Filter.check_##name = true;                                       \
     checker->Filter.check_##name = true;                                       \
-    checker->Filter.checkName_##name = mgr.getCurrentCheckName();              \
+    checker->Filter.checkName_##name = mgr.getCurrentCheckerName();            \
   }                                                                            \
   }                                                                            \
                                                                                \
                                                                                \
-  bool ento::shouldRegister##name(const LangOptions &LO) {                     \
-    return true;                                                               \
-  }
+  bool ento::shouldRegister##name(const LangOptions &LO) { return true; }
 
 
 REGISTER_CHECKER(InstanceVariableInvalidation)
 REGISTER_CHECKER(InstanceVariableInvalidation)
 REGISTER_CHECKER(MissingInvalidationMethod)
 REGISTER_CHECKER(MissingInvalidationMethod)

+ 5 - 6
lib/StaticAnalyzer/Checkers/MallocChecker.cpp

@@ -208,7 +208,7 @@ public:
   DefaultBool IsOptimistic;
   DefaultBool IsOptimistic;
 
 
   DefaultBool ChecksEnabled[CK_NumCheckKinds];
   DefaultBool ChecksEnabled[CK_NumCheckKinds];
-  CheckName CheckNames[CK_NumCheckKinds];
+  CheckerNameRef CheckNames[CK_NumCheckKinds];
 
 
   void checkPreCall(const CallEvent &Call, CheckerContext &C) const;
   void checkPreCall(const CallEvent &Call, CheckerContext &C) const;
   void checkPostStmt(const CallExpr *CE, CheckerContext &C) const;
   void checkPostStmt(const CallExpr *CE, CheckerContext &C) const;
@@ -3140,7 +3140,7 @@ void ento::registerInnerPointerCheckerAux(CheckerManager &mgr) {
   MallocChecker *checker = mgr.getChecker<MallocChecker>();
   MallocChecker *checker = mgr.getChecker<MallocChecker>();
   checker->ChecksEnabled[MallocChecker::CK_InnerPointerChecker] = true;
   checker->ChecksEnabled[MallocChecker::CK_InnerPointerChecker] = true;
   checker->CheckNames[MallocChecker::CK_InnerPointerChecker] =
   checker->CheckNames[MallocChecker::CK_InnerPointerChecker] =
-      mgr.getCurrentCheckName();
+      mgr.getCurrentCheckerName();
 }
 }
 
 
 void ento::registerDynamicMemoryModeling(CheckerManager &mgr) {
 void ento::registerDynamicMemoryModeling(CheckerManager &mgr) {
@@ -3157,12 +3157,11 @@ bool ento::shouldRegisterDynamicMemoryModeling(const LangOptions &LO) {
   void ento::register##name(CheckerManager &mgr) {                             \
   void ento::register##name(CheckerManager &mgr) {                             \
     MallocChecker *checker = mgr.getChecker<MallocChecker>();                  \
     MallocChecker *checker = mgr.getChecker<MallocChecker>();                  \
     checker->ChecksEnabled[MallocChecker::CK_##name] = true;                   \
     checker->ChecksEnabled[MallocChecker::CK_##name] = true;                   \
-    checker->CheckNames[MallocChecker::CK_##name] = mgr.getCurrentCheckName(); \
+    checker->CheckNames[MallocChecker::CK_##name] =                            \
+        mgr.getCurrentCheckerName();                                           \
   }                                                                            \
   }                                                                            \
                                                                                \
                                                                                \
-  bool ento::shouldRegister##name(const LangOptions &LO) {                     \
-    return true;                                                               \
-  }
+  bool ento::shouldRegister##name(const LangOptions &LO) { return true; }
 
 
 REGISTER_CHECKER(MallocChecker)
 REGISTER_CHECKER(MallocChecker)
 REGISTER_CHECKER(NewDeleteChecker)
 REGISTER_CHECKER(NewDeleteChecker)

+ 7 - 7
lib/StaticAnalyzer/Checkers/NullabilityChecker.cpp

@@ -112,11 +112,11 @@ public:
     DefaultBool CheckNullablePassedToNonnull;
     DefaultBool CheckNullablePassedToNonnull;
     DefaultBool CheckNullableReturnedFromNonnull;
     DefaultBool CheckNullableReturnedFromNonnull;
 
 
-    CheckName CheckNameNullPassedToNonnull;
-    CheckName CheckNameNullReturnedFromNonnull;
-    CheckName CheckNameNullableDereferenced;
-    CheckName CheckNameNullablePassedToNonnull;
-    CheckName CheckNameNullableReturnedFromNonnull;
+    CheckerNameRef CheckNameNullPassedToNonnull;
+    CheckerNameRef CheckNameNullReturnedFromNonnull;
+    CheckerNameRef CheckNameNullableDereferenced;
+    CheckerNameRef CheckNameNullablePassedToNonnull;
+    CheckerNameRef CheckNameNullableReturnedFromNonnull;
   };
   };
 
 
   NullabilityChecksFilter Filter;
   NullabilityChecksFilter Filter;
@@ -1201,12 +1201,12 @@ bool ento::shouldRegisterNullabilityBase(const LangOptions &LO) {
   void ento::register##name##Checker(CheckerManager &mgr) {                    \
   void ento::register##name##Checker(CheckerManager &mgr) {                    \
     NullabilityChecker *checker = mgr.getChecker<NullabilityChecker>();        \
     NullabilityChecker *checker = mgr.getChecker<NullabilityChecker>();        \
     checker->Filter.Check##name = true;                                        \
     checker->Filter.Check##name = true;                                        \
-    checker->Filter.CheckName##name = mgr.getCurrentCheckName();               \
+    checker->Filter.CheckName##name = mgr.getCurrentCheckerName();             \
     checker->NeedTracking = checker->NeedTracking || trackingRequired;         \
     checker->NeedTracking = checker->NeedTracking || trackingRequired;         \
     checker->NoDiagnoseCallsToSystemHeaders =                                  \
     checker->NoDiagnoseCallsToSystemHeaders =                                  \
         checker->NoDiagnoseCallsToSystemHeaders ||                             \
         checker->NoDiagnoseCallsToSystemHeaders ||                             \
         mgr.getAnalyzerOptions().getCheckerBooleanOption(                      \
         mgr.getAnalyzerOptions().getCheckerBooleanOption(                      \
-                      checker, "NoDiagnoseCallsToSystemHeaders", true);        \
+            checker, "NoDiagnoseCallsToSystemHeaders", true);                  \
   }                                                                            \
   }                                                                            \
                                                                                \
                                                                                \
   bool ento::shouldRegister##name##Checker(const LangOptions &LO) {            \
   bool ento::shouldRegister##name##Checker(const LangOptions &LO) {            \

+ 1 - 1
lib/StaticAnalyzer/Checkers/UndefinedArraySubscriptChecker.cpp

@@ -52,7 +52,7 @@ UndefinedArraySubscriptChecker::checkPreStmt(const ArraySubscriptExpr *A,
     BT.reset(new BuiltinBug(this, "Array subscript is undefined"));
     BT.reset(new BuiltinBug(this, "Array subscript is undefined"));
 
 
   // Generate a report for this bug.
   // Generate a report for this bug.
-  auto R = std::make_unique<PathSensitiveBugReport>(*BT, BT->getName(), N);
+  auto R = std::make_unique<PathSensitiveBugReport>(*BT, BT->getDescription(), N);
   R->addRange(A->getIdx()->getSourceRange());
   R->addRange(A->getIdx()->getSourceRange());
   bugreporter::trackExpressionValue(N, A->getIdx(), *R);
   bugreporter::trackExpressionValue(N, A->getIdx(), *R);
   C.emitReport(std::move(R));
   C.emitReport(std::move(R));

+ 3 - 2
lib/StaticAnalyzer/Checkers/ValistChecker.cpp

@@ -46,7 +46,7 @@ public:
   };
   };
 
 
   DefaultBool ChecksEnabled[CK_NumCheckKinds];
   DefaultBool ChecksEnabled[CK_NumCheckKinds];
-  CheckName CheckNames[CK_NumCheckKinds];
+  CheckerNameRef CheckNames[CK_NumCheckKinds];
 
 
   void checkPreStmt(const VAArgExpr *VAA, CheckerContext &C) const;
   void checkPreStmt(const VAArgExpr *VAA, CheckerContext &C) const;
   void checkPreCall(const CallEvent &Call, CheckerContext &C) const;
   void checkPreCall(const CallEvent &Call, CheckerContext &C) const;
@@ -412,7 +412,8 @@ bool ento::shouldRegisterValistBase(const LangOptions &LO) {
   void ento::register##name##Checker(CheckerManager &mgr) {                    \
   void ento::register##name##Checker(CheckerManager &mgr) {                    \
     ValistChecker *checker = mgr.getChecker<ValistChecker>();                  \
     ValistChecker *checker = mgr.getChecker<ValistChecker>();                  \
     checker->ChecksEnabled[ValistChecker::CK_##name] = true;                   \
     checker->ChecksEnabled[ValistChecker::CK_##name] = true;                   \
-    checker->CheckNames[ValistChecker::CK_##name] = mgr.getCurrentCheckName(); \
+    checker->CheckNames[ValistChecker::CK_##name] =                            \
+        mgr.getCurrentCheckerName();                                           \
   }                                                                            \
   }                                                                            \
                                                                                \
                                                                                \
   bool ento::shouldRegister##name##Checker(const LangOptions &LO) {            \
   bool ento::shouldRegister##name##Checker(const LangOptions &LO) {            \

+ 6 - 6
lib/StaticAnalyzer/Checkers/VirtualCallChecker.cpp

@@ -206,20 +206,20 @@ void ento::registerVirtualCallModeling(CheckerManager &Mgr) {
 
 
 void ento::registerPureVirtualCallChecker(CheckerManager &Mgr) {
 void ento::registerPureVirtualCallChecker(CheckerManager &Mgr) {
   auto *Chk = Mgr.getChecker<VirtualCallChecker>();
   auto *Chk = Mgr.getChecker<VirtualCallChecker>();
-  Chk->BT_Pure = std::make_unique<BugType>(
-      Mgr.getCurrentCheckName(), "Pure virtual method call",
-      categories::CXXObjectLifecycle);
+  Chk->BT_Pure = std::make_unique<BugType>(Mgr.getCurrentCheckerName(),
+                                           "Pure virtual method call",
+                                           categories::CXXObjectLifecycle);
 }
 }
 
 
 void ento::registerVirtualCallChecker(CheckerManager &Mgr) {
 void ento::registerVirtualCallChecker(CheckerManager &Mgr) {
   auto *Chk = Mgr.getChecker<VirtualCallChecker>();
   auto *Chk = Mgr.getChecker<VirtualCallChecker>();
   if (!Mgr.getAnalyzerOptions().getCheckerBooleanOption(
   if (!Mgr.getAnalyzerOptions().getCheckerBooleanOption(
-          Mgr.getCurrentCheckName(), "PureOnly")) {
+          Mgr.getCurrentCheckerName(), "PureOnly")) {
     Chk->BT_Impure = std::make_unique<BugType>(
     Chk->BT_Impure = std::make_unique<BugType>(
-        Mgr.getCurrentCheckName(), "Unexpected loss of virtual dispatch",
+        Mgr.getCurrentCheckerName(), "Unexpected loss of virtual dispatch",
         categories::CXXObjectLifecycle);
         categories::CXXObjectLifecycle);
     Chk->ShowFixIts = Mgr.getAnalyzerOptions().getCheckerBooleanOption(
     Chk->ShowFixIts = Mgr.getAnalyzerOptions().getCheckerBooleanOption(
-        Mgr.getCurrentCheckName(), "ShowFixIts");
+        Mgr.getCurrentCheckerName(), "ShowFixIts");
   }
   }
 }
 }
 
 

+ 6 - 6
lib/StaticAnalyzer/Core/BugReporter.cpp

@@ -1312,7 +1312,7 @@ static std::unique_ptr<PathDiagnostic>
 generateDiagnosticForBasicReport(const BasicBugReport *R) {
 generateDiagnosticForBasicReport(const BasicBugReport *R) {
   const BugType &BT = R->getBugType();
   const BugType &BT = R->getBugType();
   return std::make_unique<PathDiagnostic>(
   return std::make_unique<PathDiagnostic>(
-      BT.getCheckName(), R->getDeclWithIssue(), BT.getName(),
+      BT.getCheckerName(), R->getDeclWithIssue(), BT.getDescription(),
       R->getDescription(), R->getShortDescription(/*UseFallback=*/false),
       R->getDescription(), R->getShortDescription(/*UseFallback=*/false),
       BT.getCategory(), R->getUniqueingLocation(), R->getUniqueingDecl(),
       BT.getCategory(), R->getUniqueingLocation(), R->getUniqueingDecl(),
       std::make_unique<FilesToLineNumsMap>());
       std::make_unique<FilesToLineNumsMap>());
@@ -1323,7 +1323,7 @@ generateEmptyDiagnosticForReport(const PathSensitiveBugReport *R,
                                  const SourceManager &SM) {
                                  const SourceManager &SM) {
   const BugType &BT = R->getBugType();
   const BugType &BT = R->getBugType();
   return std::make_unique<PathDiagnostic>(
   return std::make_unique<PathDiagnostic>(
-      BT.getCheckName(), R->getDeclWithIssue(), BT.getName(),
+      BT.getCheckerName(), R->getDeclWithIssue(), BT.getDescription(),
       R->getDescription(), R->getShortDescription(/*UseFallback=*/false),
       R->getDescription(), R->getShortDescription(/*UseFallback=*/false),
       BT.getCategory(), R->getUniqueingLocation(), R->getUniqueingDecl(),
       BT.getCategory(), R->getUniqueingLocation(), R->getUniqueingDecl(),
       findExecutedLines(SM, R->getErrorNode()));
       findExecutedLines(SM, R->getErrorNode()));
@@ -3235,12 +3235,12 @@ void BugReporter::EmitBasicReport(const Decl *DeclWithIssue,
                                   PathDiagnosticLocation Loc,
                                   PathDiagnosticLocation Loc,
                                   ArrayRef<SourceRange> Ranges,
                                   ArrayRef<SourceRange> Ranges,
                                   ArrayRef<FixItHint> Fixits) {
                                   ArrayRef<FixItHint> Fixits) {
-  EmitBasicReport(DeclWithIssue, Checker->getCheckName(), Name, Category, Str,
+  EmitBasicReport(DeclWithIssue, Checker->getCheckerName(), Name, Category, Str,
                   Loc, Ranges, Fixits);
                   Loc, Ranges, Fixits);
 }
 }
 
 
 void BugReporter::EmitBasicReport(const Decl *DeclWithIssue,
 void BugReporter::EmitBasicReport(const Decl *DeclWithIssue,
-                                  CheckName CheckName,
+                                  CheckerNameRef CheckName,
                                   StringRef name, StringRef category,
                                   StringRef name, StringRef category,
                                   StringRef str, PathDiagnosticLocation Loc,
                                   StringRef str, PathDiagnosticLocation Loc,
                                   ArrayRef<SourceRange> Ranges,
                                   ArrayRef<SourceRange> Ranges,
@@ -3256,8 +3256,8 @@ void BugReporter::EmitBasicReport(const Decl *DeclWithIssue,
   emitReport(std::move(R));
   emitReport(std::move(R));
 }
 }
 
 
-BugType *BugReporter::getBugTypeForName(CheckName CheckName, StringRef name,
-                                        StringRef category) {
+BugType *BugReporter::getBugTypeForName(CheckerNameRef CheckName,
+                                        StringRef name, StringRef category) {
   SmallString<136> fullDesc;
   SmallString<136> fullDesc;
   llvm::raw_svector_ostream(fullDesc) << CheckName.getName() << ":" << name
   llvm::raw_svector_ostream(fullDesc) << CheckName.getName() << ":" << name
                                       << ":" << category;
                                       << ":" << category;

+ 4 - 4
lib/StaticAnalyzer/Core/Checker.cpp

@@ -19,10 +19,10 @@ using namespace ento;
 int ImplicitNullDerefEvent::Tag;
 int ImplicitNullDerefEvent::Tag;
 
 
 StringRef CheckerBase::getTagDescription() const {
 StringRef CheckerBase::getTagDescription() const {
-  return getCheckName().getName();
+  return getCheckerName().getName();
 }
 }
 
 
-CheckName CheckerBase::getCheckName() const { return Name; }
+CheckerNameRef CheckerBase::getCheckerName() const { return Name; }
 
 
 CheckerProgramPointTag::CheckerProgramPointTag(StringRef CheckerName,
 CheckerProgramPointTag::CheckerProgramPointTag(StringRef CheckerName,
                                                StringRef Msg)
                                                StringRef Msg)
@@ -30,10 +30,10 @@ CheckerProgramPointTag::CheckerProgramPointTag(StringRef CheckerName,
 
 
 CheckerProgramPointTag::CheckerProgramPointTag(const CheckerBase *Checker,
 CheckerProgramPointTag::CheckerProgramPointTag(const CheckerBase *Checker,
                                                StringRef Msg)
                                                StringRef Msg)
-  : SimpleProgramPointTag(Checker->getCheckName().getName(), Msg) {}
+    : SimpleProgramPointTag(Checker->getCheckerName().getName(), Msg) {}
 
 
 raw_ostream& clang::ento::operator<<(raw_ostream &Out,
 raw_ostream& clang::ento::operator<<(raw_ostream &Out,
                                      const CheckerBase &Checker) {
                                      const CheckerBase &Checker) {
-  Out << Checker.getCheckName().getName();
+  Out << Checker.getCheckerName().getName();
   return Out;
   return Out;
 }
 }

+ 1 - 1
lib/StaticAnalyzer/Core/CheckerManager.cpp

@@ -748,7 +748,7 @@ void CheckerManager::runCheckersForPrintStateJson(raw_ostream &Out,
       continue;
       continue;
 
 
     Indent(Out, Space, IsDot)
     Indent(Out, Space, IsDot)
-        << "{ \"checker\": \"" << CT.second->getCheckName().getName()
+        << "{ \"checker\": \"" << CT.second->getCheckerName().getName()
         << "\", \"messages\": [" << NL;
         << "\", \"messages\": [" << NL;
     Indent(Out, InnerSpace, IsDot)
     Indent(Out, InnerSpace, IsDot)
         << '\"' << TempBuf.str().trim() << '\"' << NL;
         << '\"' << TempBuf.str().trim() << '\"' << NL;

+ 2 - 1
lib/StaticAnalyzer/Core/ExprEngineCXX.cpp

@@ -775,7 +775,8 @@ void ExprEngine::VisitCXXNewExpr(const CXXNewExpr *CNE, ExplodedNode *Pred,
   if (!AMgr.getAnalyzerOptions().MayInlineCXXAllocator) {
   if (!AMgr.getAnalyzerOptions().MayInlineCXXAllocator) {
     // Invalidate placement args.
     // Invalidate placement args.
     // FIXME: Once we figure out how we want allocators to work,
     // FIXME: Once we figure out how we want allocators to work,
-    // we should be using the usual pre-/(default-)eval-/post-call checks here.
+    // we should be using the usual pre-/(default-)eval-/post-call checkers
+    // here.
     State = Call->invalidateRegions(blockCount);
     State = Call->invalidateRegions(blockCount);
     if (!State)
     if (!State)
       return;
       return;

+ 3 - 2
lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp

@@ -555,8 +555,9 @@ void HTMLDiagnostics::FinalizeHTML(const PathDiagnostic& D, Rewriter &R,
     os  << "\n<!-- FUNCTIONNAME " <<  declName << " -->\n";
     os  << "\n<!-- FUNCTIONNAME " <<  declName << " -->\n";
 
 
     os << "\n<!-- ISSUEHASHCONTENTOFLINEINCONTEXT "
     os << "\n<!-- ISSUEHASHCONTENTOFLINEINCONTEXT "
-       << GetIssueHash(SMgr, L, D.getCheckName(), D.getBugType(), DeclWithIssue,
-                       PP.getLangOpts()) << " -->\n";
+       << GetIssueHash(SMgr, L, D.getCheckerName(), D.getBugType(),
+                       DeclWithIssue, PP.getLangOpts())
+       << " -->\n";
 
 
     os << "\n<!-- BUGLINE "
     os << "\n<!-- BUGLINE "
        << LineNumber
        << LineNumber

+ 2 - 2
lib/StaticAnalyzer/Core/PlistDiagnostics.cpp

@@ -679,7 +679,7 @@ void PlistDiagnostics::FlushDiagnosticsImpl(
     o << "   <key>type</key>";
     o << "   <key>type</key>";
     EmitString(o, D->getBugType()) << '\n';
     EmitString(o, D->getBugType()) << '\n';
     o << "   <key>check_name</key>";
     o << "   <key>check_name</key>";
-    EmitString(o, D->getCheckName()) << '\n';
+    EmitString(o, D->getCheckerName()) << '\n';
 
 
     o << "   <!-- This hash is experimental and going to change! -->\n";
     o << "   <!-- This hash is experimental and going to change! -->\n";
     o << "   <key>issue_hash_content_of_line_in_context</key>";
     o << "   <key>issue_hash_content_of_line_in_context</key>";
@@ -689,7 +689,7 @@ void PlistDiagnostics::FlushDiagnosticsImpl(
                                             : D->getLocation().asLocation()),
                                             : D->getLocation().asLocation()),
                     SM);
                     SM);
     const Decl *DeclWithIssue = D->getDeclWithIssue();
     const Decl *DeclWithIssue = D->getDeclWithIssue();
-    EmitString(o, GetIssueHash(SM, L, D->getCheckName(), D->getBugType(),
+    EmitString(o, GetIssueHash(SM, L, D->getCheckerName(), D->getBugType(),
                                DeclWithIssue, LangOpts))
                                DeclWithIssue, LangOpts))
         << '\n';
         << '\n';
 
 

+ 4 - 4
lib/StaticAnalyzer/Core/SarifDiagnostics.cpp

@@ -242,7 +242,7 @@ static json::Object createResult(const PathDiagnostic &Diag,
   const PathPieces &Path = Diag.path.flatten(false);
   const PathPieces &Path = Diag.path.flatten(false);
   const SourceManager &SMgr = Path.front()->getLocation().getManager();
   const SourceManager &SMgr = Path.front()->getLocation().getManager();
 
 
-  auto Iter = RuleMapping.find(Diag.getCheckName());
+  auto Iter = RuleMapping.find(Diag.getCheckerName());
   assert(Iter != RuleMapping.end() && "Rule ID is not in the array index map?");
   assert(Iter != RuleMapping.end() && "Rule ID is not in the array index map?");
 
 
   return json::Object{
   return json::Object{
@@ -254,7 +254,7 @@ static json::Object createResult(const PathDiagnostic &Diag,
            *Diag.getLocation().asLocation().getExpansionLoc().getFileEntry(),
            *Diag.getLocation().asLocation().getExpansionLoc().getFileEntry(),
            SMgr, Artifacts))}},
            SMgr, Artifacts))}},
       {"ruleIndex", Iter->getValue()},
       {"ruleIndex", Iter->getValue()},
-      {"ruleId", Diag.getCheckName()}};
+      {"ruleId", Diag.getCheckerName()}};
 }
 }
 
 
 static StringRef getRuleDescription(StringRef CheckName) {
 static StringRef getRuleDescription(StringRef CheckName) {
@@ -280,7 +280,7 @@ static StringRef getRuleHelpURIStr(StringRef CheckName) {
 }
 }
 
 
 static json::Object createRule(const PathDiagnostic &Diag) {
 static json::Object createRule(const PathDiagnostic &Diag) {
-  StringRef CheckName = Diag.getCheckName();
+  StringRef CheckName = Diag.getCheckerName();
   json::Object Ret{
   json::Object Ret{
       {"fullDescription", createMessage(getRuleDescription(CheckName))},
       {"fullDescription", createMessage(getRuleDescription(CheckName))},
       {"name", CheckName},
       {"name", CheckName},
@@ -299,7 +299,7 @@ static json::Array createRules(std::vector<const PathDiagnostic *> &Diags,
   llvm::StringSet<> Seen;
   llvm::StringSet<> Seen;
 
 
   llvm::for_each(Diags, [&](const PathDiagnostic *D) {
   llvm::for_each(Diags, [&](const PathDiagnostic *D) {
-    StringRef RuleID = D->getCheckName();
+    StringRef RuleID = D->getCheckerName();
     std::pair<llvm::StringSet<>::iterator, bool> P = Seen.insert(RuleID);
     std::pair<llvm::StringSet<>::iterator, bool> P = Seen.insert(RuleID);
     if (P.second) {
     if (P.second) {
       RuleMapping[RuleID] = Rules.size(); // Maps RuleID to an Array Index.
       RuleMapping[RuleID] = Rules.size(); // Maps RuleID to an Array Index.

+ 1 - 1
lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp

@@ -651,7 +651,7 @@ void AnalysisConsumer::HandleTranslationUnit(ASTContext &C) {
 
 
   if (isBisonFile(C)) {
   if (isBisonFile(C)) {
     reportAnalyzerProgress("Skipping bison-generated file\n");
     reportAnalyzerProgress("Skipping bison-generated file\n");
-  } else if (Opts->DisableAllChecks) {
+  } else if (Opts->DisableAllCheckers) {
 
 
     // Don't analyze if the user explicitly asked for no checks to be performed
     // Don't analyze if the user explicitly asked for no checks to be performed
     // on this file.
     // on this file.

+ 1 - 1
lib/StaticAnalyzer/Frontend/CheckerRegistry.cpp

@@ -437,7 +437,7 @@ void CheckerRegistry::initializeManager(CheckerManager &CheckerMgr) const {
 
 
   // Initialize the CheckerManager with all enabled checkers.
   // Initialize the CheckerManager with all enabled checkers.
   for (const auto *Checker : enabledCheckers) {
   for (const auto *Checker : enabledCheckers) {
-    CheckerMgr.setCurrentCheckName(CheckName(Checker->FullName));
+    CheckerMgr.setCurrentCheckerName(CheckerNameRef(Checker->FullName));
     Checker->Initialize(CheckerMgr);
     Checker->Initialize(CheckerMgr);
   }
   }
 }
 }

+ 1 - 1
unittests/StaticAnalyzer/RegisterCustomCheckersTest.cpp

@@ -30,7 +30,7 @@ class TestAction : public ASTFrontendAction {
     void FlushDiagnosticsImpl(std::vector<const PathDiagnostic *> &Diags,
     void FlushDiagnosticsImpl(std::vector<const PathDiagnostic *> &Diags,
                               FilesMade *filesMade) override {
                               FilesMade *filesMade) override {
       for (const auto *PD : Diags)
       for (const auto *PD : Diags)
-        Output << PD->getCheckName() << ":" << PD->getShortDescription();
+        Output << PD->getCheckerName() << ":" << PD->getShortDescription();
     }
     }
 
 
     StringRef getName() const override { return "Test"; }
     StringRef getName() const override { return "Test"; }