[PATCH] D65182: [analyzer] Add fix-it hint support.

Artem Dergachev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Aug 14 13:21:57 PDT 2019


NoQ marked 3 inline comments as done.
NoQ added inline comments.


================
Comment at: clang/include/clang/StaticAnalyzer/Core/BugReporter/PathDiagnostic.h:879
 
+  ArrayRef<FixItHint> getFixits() const { return Fixits; }
+
----------------
Szelethus wrote:
> Hmm, will this return an immutable container? If not, can we make it so?
`ArrayRef` is like a view/slice (like `StringRef`), it's lightweight and you can't mutate the original container through it and it abstracts out various implementation details of the underlying vector.


================
Comment at: clang/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp:84
 namespace {
 class ClangDiagPathDiagConsumer : public PathDiagnosticConsumer {
   DiagnosticsEngine &Diag;
----------------
Szelethus wrote:
> Oh my god. This must be a runner up for "Worst class name in the Clang Static Analyzer", and might even all the trophies home. I wanted to make a joke about honorable mentions, but nothing compares :^)
I'm pretty sure [[ https://clang.llvm.org/doxygen/classclang_1_1CXX17ElidedCopyConstructorInitializerConstructionContext.html | `CXX17ElidedCopyConstructorInitializerConstructionContext` ]] deserves at least some recognition.


================
Comment at: clang/test/Analysis/objc-arc.m:1
-// RUN: %clang_analyze_cc1 -triple x86_64-apple-darwin10 -analyzer-checker=core,osx.cocoa.RetainCount,deadcode -verify -fblocks -analyzer-opt-analyze-nested-blocks -fobjc-arc -analyzer-output=plist-multi-file -o %t.plist %s
+// RUN: %clang_analyze_cc1 -triple x86_64-apple-darwin10 -analyzer-checker=core,osx.cocoa.RetainCount,deadcode -verify -fblocks -analyzer-opt-analyze-nested-blocks -fobjc-arc -analyzer-output=plist-multi-file -analyzer-config deadcode.DeadStores:ShowFixIts=true -o %t.plist %s
 // RUN: %normalize_plist <%t.plist | diff -ub %S/Inputs/expected-plists/objc-arc.m.plist -
----------------
Szelethus wrote:
> Just thinking aloud, but maybe it'd be time to create a `RUN:` line formatter for test files, WDYT?
Will this formatter be smart enough to update line numbers in `expected-plists/objc-arc.m.plist`? (:


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D65182/new/

https://reviews.llvm.org/D65182





More information about the cfe-commits mailing list