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

Kristóf Umann via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Aug 14 14:05:07 PDT 2019

Szelethus added inline comments.

Comment at: clang/include/clang/StaticAnalyzer/Core/BugReporter/PathDiagnostic.h:879
+  ArrayRef<FixItHint> getFixits() const { return Fixits; }
NoQ wrote:
> 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.
Consider my inline void then :)

Comment at: clang/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp:84
 namespace {
 class ClangDiagPathDiagConsumer : public PathDiagnosticConsumer {
   DiagnosticsEngine &Diag;
NoQ wrote:
> 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.
That's at least descriptive, but I agree.

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 -
NoQ wrote:
> 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`? (:
Why not put that on the wish list, eh? ;)



More information about the cfe-commits mailing list