[PATCH] D76605: [analyzer] Display the checker name in the text output

Gabor Marton via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Mar 23 07:03:37 PDT 2020


martong added inline comments.


================
Comment at: clang/lib/StaticAnalyzer/Core/TextDiagnostics.cpp:98
       const PathDiagnostic *PD = *I;
+      std::string WarningMsg =
+          (ShouldDisplayCheckerName ? " [" + PD->getCheckerName() + "]" : "")
----------------
`StringRef`? `getCheckerName()` returns with `StringRef`...


================
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());
----------------
Why the `.str()` ?


================
Comment at: clang/test/Analysis/incorrect-checker-names.mm:1
+// RUN: %clang_analyze_cc1 -fblocks -verify %s -Wno-objc-root-class \
+// RUN:   -analyzer-checker=core \
----------------
This seems like a copy of an existing test file, though I don't know which. Wouldn't it be better to adjust the original test file?


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