[PATCH] D76605: [analyzer] Display the checker name in the text output
Artem Dergachev via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Mar 23 16:54:07 PDT 2020
NoQ added a comment.
Sounds great!
Does the checker name get printed on the final note as well in text output? We should probably test it.
================
Comment at: clang/include/clang/StaticAnalyzer/Core/AnalyzerOptions.def:313-316
+ANALYZER_OPTION(bool, ShouldDisplayCheckerNameForText, "display-checker-name",
+ "Display the checker name for textual outputs",
+ true)
+
----------------
Why do we need an option? Is it just for tests? Is it for clang-tidy to avoid printing the checker name twice?
================
Comment at: clang/lib/StaticAnalyzer/Core/TextDiagnostics.cpp:112
reportPiece(NoteID, Piece->getLocation().asLocation(),
- Piece->getString(), Piece->getRanges(), Piece->getFixits());
+ Piece->getString().str(), Piece->getRanges(),
+ Piece->getFixits());
----------------
Szelethus wrote:
> martong wrote:
> > Why the `.str()` ?
> `StringRef` no longer converts to `std::string` implicitly.
But it seems to have been fine before(?)
================
Comment at: clang/test/Analysis/incorrect-checker-names.cpp:6
+ int x = 0;
+ // FIXME: This shouldn't be tied to a modeling checker.
+ return &x; // expected-warning{{Address of stack memory associated with local variable 'x' returned to caller [core.StackAddrEscapeBase]}}
----------------
Do you have a plan to address this FIXME? Does clang-tidy have the same problem?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D76605/new/
https://reviews.llvm.org/D76605
More information about the cfe-commits
mailing list