https://github.com/NagyDonat created https://github.com/llvm/llvm-project/pull/141511
None From e19773f3a1c52213ec1afe5329c2715b6119ed33 Mon Sep 17 00:00:00 2001 From: Balazs Benics <benicsbal...@gmail.com> Date: Thu, 15 May 2025 19:44:55 +0200 Subject: [PATCH] [NFC][analyzer] Rename getTagDescription to getDebugName --- clang/include/clang/Analysis/ProgramPoint.h | 4 ++-- .../Core/BugReporter/BugReporter.h | 4 ++-- .../include/clang/StaticAnalyzer/Core/Checker.h | 16 ++++++++-------- clang/lib/Analysis/ProgramPoint.cpp | 2 +- .../StaticAnalyzer/Checkers/DivZeroChecker.cpp | 2 +- .../Checkers/VirtualCallChecker.cpp | 2 +- clang/lib/StaticAnalyzer/Core/Checker.cpp | 4 ++-- clang/lib/StaticAnalyzer/Core/CheckerManager.cpp | 8 ++++---- clang/lib/StaticAnalyzer/Core/ExprEngine.cpp | 2 +- 9 files changed, 22 insertions(+), 22 deletions(-) diff --git a/clang/include/clang/Analysis/ProgramPoint.h b/clang/include/clang/Analysis/ProgramPoint.h index b06d38baf4643..2d7c7367feac4 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 getDebugName() 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 getDebugName() 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..42b242ada3489 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 getDebugName() 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 getDebugName() 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..96e4ebbfb8e62 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 getDebugName() 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 getDebugName()` 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 `getDebugName` 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..337ee18b3e4c2 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::getDebugName() const { return Desc; } diff --git a/clang/lib/StaticAnalyzer/Checkers/DivZeroChecker.cpp b/clang/lib/StaticAnalyzer/Checkers/DivZeroChecker.cpp index 95a9582ecdcb1..164e79a142545 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 getDebugName() 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..29df35c6f8f8c 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 getDebugName() 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..54f07e40ae139 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::getDebugName() 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->getDebugName(), Msg) {} diff --git a/clang/lib/StaticAnalyzer/Core/CheckerManager.cpp b/clang/lib/StaticAnalyzer/Core/CheckerManager.cpp index 4c37b65ae5c68..bcc7a7e6da22f 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->getDebugName() : "<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->getDebugName()); llvm_unreachable(AssertionMessage.c_str()); } #endif if (evaluated) { - evaluatorChecker = EvalCallChecker.Checker->getTagDescription(); + evaluatorChecker = EvalCallChecker.Checker->getDebugName(); Dst.insert(checkDst); #ifdef NDEBUG break; // on release don't check that no other checker also evals. @@ -798,7 +798,7 @@ void CheckerManager::runCheckersForPrintStateJson(raw_ostream &Out, continue; Indent(Out, Space, IsDot) - << "{ \"checker\": \"" << CT.second->getTagDescription() + << "{ \"checker\": \"" << CT.second->getDebugName() << "\", \"messages\": [" << NL; Indent(Out, InnerSpace, IsDot) << '\"' << TempBuf.str().trim() << '\"' << NL; diff --git a/clang/lib/StaticAnalyzer/Core/ExprEngine.cpp b/clang/lib/StaticAnalyzer/Core/ExprEngine.cpp index 1afd4b52eb354..5b547db6dc482 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->getDebugName() << '\"'; 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