diff options
author | Balazs Benics <benicsbalazs@gmail.com> | 2024-03-25 15:24:03 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-25 15:24:03 +0100 |
commit | 32b828306e346bc8e86c0b763f3514329de60ed1 (patch) | |
tree | 6cb1d48c1e674972fdec2f5dc270e97bb8a9f6bd /clang/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp | |
parent | ded6252dfd96ee8904b6d2250bc9e4841ca5c802 (diff) | |
download | llvm-32b828306e346bc8e86c0b763f3514329de60ed1.zip llvm-32b828306e346bc8e86c0b763f3514329de60ed1.tar.gz llvm-32b828306e346bc8e86c0b763f3514329de60ed1.tar.bz2 |
[analyzer] Set and display CSA analysis entry points as notes on debugging (#84823)
When debugging CSA issues, sometimes it would be useful to have a
dedicated note for the analysis entry point, aka. the function name you
would need to pass as "-analyze-function=XYZ" to reproduce a specific
issue.
One way we use (or will use) this downstream is to provide tooling on
top of creduce to enhance to supercharge productivity by automatically
reduce cases on crashes for example.
This will be added only if the "-analyzer-note-analysis-entry-points" is
set or the "analyzer-display-progress" is on.
This additional entry point marker will be the first "note" if enabled,
with the following message: "[debug] analyzing from XYZ". They are
prefixed by "[debug]" to remind the CSA developer that this is only
meant to be visible for them, for debugging purposes.
CPP-5012
Diffstat (limited to 'clang/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp')
-rw-r--r-- | clang/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/clang/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp b/clang/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp index b6ef405..03bc4080 100644 --- a/clang/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp +++ b/clang/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp @@ -527,7 +527,8 @@ static void reportAnalyzerFunctionMisuse(const AnalyzerOptions &Opts, void AnalysisConsumer::runAnalysisOnTranslationUnit(ASTContext &C) { BugReporter BR(*Mgr); - TranslationUnitDecl *TU = C.getTranslationUnitDecl(); + const TranslationUnitDecl *TU = C.getTranslationUnitDecl(); + BR.setAnalysisEntryPoint(TU); if (SyntaxCheckTimer) SyntaxCheckTimer->startTimer(); checkerMgr->runCheckersOnASTDecl(TU, *Mgr, BR); @@ -675,6 +676,7 @@ void AnalysisConsumer::HandleCode(Decl *D, AnalysisMode Mode, DisplayFunction(D, Mode, IMode); BugReporter BR(*Mgr); + BR.setAnalysisEntryPoint(D); if (Mode & AM_Syntax) { llvm::TimeRecord CheckerStartTime; |