Author: DonĂ¡t Nagy
Date: 2025-05-26T21:29:09+02:00
New Revision: 73c49293220bb36e430d9c840568d45c886bd2ab

URL: 
https://github.com/llvm/llvm-project/commit/73c49293220bb36e430d9c840568d45c886bd2ab
DIFF: 
https://github.com/llvm/llvm-project/commit/73c49293220bb36e430d9c840568d45c886bd2ab.diff

LOG: [NFC][analyzer] Rename getTagDescription to getDebugName (#141511)

Co-authored-by: Balazs Benics <benicsbal...@gmail.com>

Added: 
    

Modified: 
    clang/include/clang/Analysis/ProgramPoint.h
    clang/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h
    clang/include/clang/StaticAnalyzer/Core/Checker.h
    clang/lib/Analysis/ProgramPoint.cpp
    clang/lib/StaticAnalyzer/Checkers/DivZeroChecker.cpp
    clang/lib/StaticAnalyzer/Checkers/VirtualCallChecker.cpp
    clang/lib/StaticAnalyzer/Core/Checker.cpp
    clang/lib/StaticAnalyzer/Core/CheckerManager.cpp
    clang/lib/StaticAnalyzer/Core/ExprEngine.cpp

Removed: 
    


################################################################################
diff  --git a/clang/include/clang/Analysis/ProgramPoint.h 
b/clang/include/clang/Analysis/ProgramPoint.h
index b06d38baf4643..8b7d46177b11b 100644
--- a/clang/include/clang/Analysis/ProgramPoint.h
+++ b/clang/include/clang/Analysis/ProgramPoint.h
@@ -42,7 +42,7 @@ class ProgramPointTag {
 
   /// The description of this program point which will be dumped for debugging
   /// purposes. Do not use in user-facing output!
-  virtual StringRef getTagDescription() const = 0;
+  virtual StringRef getDebugTag() const = 0;
 
   /// Used to implement 'isKind' in subclasses.
   const void *getTagKind() const { return TagKind; }
@@ -55,7 +55,7 @@ class SimpleProgramPointTag : public ProgramPointTag {
   std::string Desc;
 public:
   SimpleProgramPointTag(StringRef MsgProvider, StringRef Msg);
-  StringRef getTagDescription() const override;
+  StringRef getDebugTag() const override;
 };
 
 class ProgramPoint {

diff  --git a/clang/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h 
b/clang/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h
index 33d37febc7327..8696fce39add1 100644
--- a/clang/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h
+++ b/clang/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h
@@ -758,7 +758,7 @@ class BugReporterContext {
 /// DataTag::Factory should be friend for every derived class.
 class DataTag : public ProgramPointTag {
 public:
-  StringRef getTagDescription() const override { return "Data Tag"; }
+  StringRef getDebugTag() const override { return "Data Tag"; }
 
   // Manage memory for DataTag objects.
   class Factory {
@@ -809,7 +809,7 @@ class NoteTag : public DataTag {
     return std::move(Msg);
   }
 
-  StringRef getTagDescription() const override {
+  StringRef getDebugTag() const override {
     // TODO: Remember a few examples of generated messages
     // and display them in the ExplodedGraph dump by
     // returning them from this function.

diff  --git a/clang/include/clang/StaticAnalyzer/Core/Checker.h 
b/clang/include/clang/StaticAnalyzer/Core/Checker.h
index db3806b425dda..acd83602aeec4 100644
--- a/clang/include/clang/StaticAnalyzer/Core/Checker.h
+++ b/clang/include/clang/StaticAnalyzer/Core/Checker.h
@@ -526,7 +526,7 @@ class CheckerBase : public CheckerFrontend, public 
CheckerBackend {
 public:
   /// Attached to nodes created by this checker class when the ExplodedGraph is
   /// dumped for debugging.
-  StringRef getTagDescription() const override;
+  StringRef getDebugTag() const override;
 };
 
 /// Simple checker classes that implement one frontend (i.e. checker name)
@@ -547,16 +547,16 @@ class Checker : public CheckerBase, public CHECKs... {
 /// callbacks (i.e. classes like `check::PreStmt` or `eval::Call`) as template
 /// arguments of `FamilyChecker.`
 ///
-/// NOTE: Classes deriving from `CheckerFamily` must implement the pure
-/// virtual method `StringRef getTagDescription()` which is inherited from
-/// `ProgramPointTag` and should return the name of the class as a string.
+/// NOTE: Classes deriving from `CheckerFamily` must implement the pure virtual
+/// method `StringRef getDebugTag()` which is inherited from `ProgramPointTag`
+/// and should return the name of the class as a string.
 ///
 /// Obviously, this boilerplate is not a good thing, but unfortunately there is
 /// no portable way to stringify the name of a type (e.g. class), so any
-/// portable implementation of `getTagDescription` would need to take the
-/// name of the class from *somewhere* where it's present as a string -- and
-/// then directly placing it in a method override is much simpler than
-/// loading it from `Checkers.td`.
+/// portable implementation of `getDebugTag` would need to take the name of
+/// the class from *somewhere* where it's present as a string -- and then
+/// directly placing it in a method override is much simpler than loading it
+/// from `Checkers.td`.
 ///
 /// Note that the existing `CLASS` field in `Checkers.td` is not suitable for
 /// our goals, because instead of storing the same class name for each

diff  --git a/clang/lib/Analysis/ProgramPoint.cpp 
b/clang/lib/Analysis/ProgramPoint.cpp
index d7cd38a7325f5..9e1205c28cb2f 100644
--- a/clang/lib/Analysis/ProgramPoint.cpp
+++ b/clang/lib/Analysis/ProgramPoint.cpp
@@ -357,4 +357,4 @@ SimpleProgramPointTag::SimpleProgramPointTag(StringRef 
MsgProvider,
                                              StringRef Msg)
   : Desc((MsgProvider + " : " + Msg).str()) {}
 
-StringRef SimpleProgramPointTag::getTagDescription() const { return Desc; }
+StringRef SimpleProgramPointTag::getDebugTag() const { return Desc; }

diff  --git a/clang/lib/StaticAnalyzer/Checkers/DivZeroChecker.cpp 
b/clang/lib/StaticAnalyzer/Checkers/DivZeroChecker.cpp
index 95a9582ecdcb1..15d73fb9ca39a 100644
--- a/clang/lib/StaticAnalyzer/Checkers/DivZeroChecker.cpp
+++ b/clang/lib/StaticAnalyzer/Checkers/DivZeroChecker.cpp
@@ -41,7 +41,7 @@ class DivZeroChecker : public 
CheckerFamily<check::PreStmt<BinaryOperator>> {
   void checkPreStmt(const BinaryOperator *B, CheckerContext &C) const;
 
   /// Identifies this checker family for debugging purposes.
-  StringRef getTagDescription() const override { return "DivZeroChecker"; }
+  StringRef getDebugTag() const override { return "DivZeroChecker"; }
 };
 } // end anonymous namespace
 

diff  --git a/clang/lib/StaticAnalyzer/Checkers/VirtualCallChecker.cpp 
b/clang/lib/StaticAnalyzer/Checkers/VirtualCallChecker.cpp
index 67429ee2c25f9..6c27f58d308aa 100644
--- a/clang/lib/StaticAnalyzer/Checkers/VirtualCallChecker.cpp
+++ b/clang/lib/StaticAnalyzer/Checkers/VirtualCallChecker.cpp
@@ -55,7 +55,7 @@ class VirtualCallChecker
   void checkPreCall(const CallEvent &Call, CheckerContext &C) const;
 
   /// Identifies this checker family for debugging purposes.
-  StringRef getTagDescription() const override { return "VirtualCallChecker"; }
+  StringRef getDebugTag() const override { return "VirtualCallChecker"; }
 
 private:
   void registerCtorDtorCallInState(bool IsBeginFunction,

diff  --git a/clang/lib/StaticAnalyzer/Core/Checker.cpp 
b/clang/lib/StaticAnalyzer/Core/Checker.cpp
index f5a07f5d305c5..00c829fa335ed 100644
--- a/clang/lib/StaticAnalyzer/Core/Checker.cpp
+++ b/clang/lib/StaticAnalyzer/Core/Checker.cpp
@@ -18,7 +18,7 @@ using namespace ento;
 
 int ImplicitNullDerefEvent::Tag;
 
-StringRef CheckerBase::getTagDescription() const { return getName(); }
+StringRef CheckerBase::getDebugTag() const { return getName(); }
 
 void CheckerBackend::printState(raw_ostream &Out, ProgramStateRef State,
                                 const char *NL, const char *Sep) const {}
@@ -29,4 +29,4 @@ CheckerProgramPointTag::CheckerProgramPointTag(StringRef 
CheckerName,
 
 CheckerProgramPointTag::CheckerProgramPointTag(const CheckerBase *Checker,
                                                StringRef Msg)
-    : SimpleProgramPointTag(Checker->getTagDescription(), Msg) {}
+    : SimpleProgramPointTag(Checker->getDebugTag(), Msg) {}

diff  --git a/clang/lib/StaticAnalyzer/Core/CheckerManager.cpp 
b/clang/lib/StaticAnalyzer/Core/CheckerManager.cpp
index 4c37b65ae5c68..c82f7b549fce6 100644
--- a/clang/lib/StaticAnalyzer/Core/CheckerManager.cpp
+++ b/clang/lib/StaticAnalyzer/Core/CheckerManager.cpp
@@ -138,7 +138,7 @@ namespace {
 std::string checkerScopeName(StringRef Name, const CheckerBackend *Checker) {
   if (!llvm::timeTraceProfilerEnabled())
     return "";
-  StringRef CheckerTag = Checker ? Checker->getTagDescription() : "<unknown>";
+  StringRef CheckerTag = Checker ? Checker->getDebugTag() : "<unknown>";
   return (Name + ":" + CheckerTag).str();
 }
 
@@ -721,12 +721,12 @@ void 
CheckerManager::runCheckersForEvalCall(ExplodedNodeSet &Dst,
             "while the {2} checker also tried to evaluate the same call. At "
             "most one checker supposed to evaluate a call.",
             toString(Call), evaluatorChecker,
-            EvalCallChecker.Checker->getTagDescription());
+            EvalCallChecker.Checker->getDebugTag());
         llvm_unreachable(AssertionMessage.c_str());
       }
 #endif
       if (evaluated) {
-        evaluatorChecker = EvalCallChecker.Checker->getTagDescription();
+        evaluatorChecker = EvalCallChecker.Checker->getDebugTag();
         Dst.insert(checkDst);
 #ifdef NDEBUG
         break; // on release don't check that no other checker also evals.
@@ -797,9 +797,8 @@ void 
CheckerManager::runCheckersForPrintStateJson(raw_ostream &Out,
     if (TempBuf.empty())
       continue;
 
-    Indent(Out, Space, IsDot)
-        << "{ \"checker\": \"" << CT.second->getTagDescription()
-        << "\", \"messages\": [" << NL;
+    Indent(Out, Space, IsDot) << "{ \"checker\": \"" << 
CT.second->getDebugTag()
+                              << "\", \"messages\": [" << NL;
     Indent(Out, InnerSpace, IsDot)
         << '\"' << TempBuf.str().trim() << '\"' << NL;
     Indent(Out, Space, IsDot) << "]}";

diff  --git a/clang/lib/StaticAnalyzer/Core/ExprEngine.cpp 
b/clang/lib/StaticAnalyzer/Core/ExprEngine.cpp
index 1afd4b52eb354..518e4bb31edeb 100644
--- a/clang/lib/StaticAnalyzer/Core/ExprEngine.cpp
+++ b/clang/lib/StaticAnalyzer/Core/ExprEngine.cpp
@@ -4029,7 +4029,7 @@ struct DOTGraphTraits<ExplodedGraph*> : public 
DefaultDOTGraphTraits {
           OtherNode->getLocation().printJson(Out, /*NL=*/"\\l");
           Out << ", \"tag\": ";
           if (const ProgramPointTag *Tag = OtherNode->getLocation().getTag())
-            Out << '\"' << Tag->getTagDescription() << '\"';
+            Out << '\"' << Tag->getDebugTag() << '\"';
           else
             Out << "null";
           Out << ", \"node_id\": " << OtherNode->getID() <<


        
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to