[PATCH] D23314: [analyzer] CloneDetector allows comparing clones for suspicious variable pattern errors.

Vassil Vassilev via cfe-commits cfe-commits at lists.llvm.org
Tue Aug 9 13:18:59 PDT 2016

v.g.vassilev requested changes to this revision.
This revision now requires changes to proceed.

Comment at: lib/StaticAnalyzer/Checkers/CloneChecker.cpp:83
@@ +82,3 @@
+    auto WarnID = DiagEngine.getCustomDiagID(
+        DiagnosticsEngine::Warning, "Maybe you wanted to use %0 here?");
More common in clang is to use "Did you mean to use...". If it is a warning it should be saying something like: "Suspicious code clone detected; did you mean to use %0"

Comment at: lib/StaticAnalyzer/Checkers/CloneChecker.cpp:86
@@ +85,3 @@
+    auto NoteID = DiagEngine.getCustomDiagID(
+        DiagnosticsEngine::Note, "Suggestion is based on the useage of this "
+                                 "variable in a similar piece of code.");
Typo: usage.

Comment at: lib/StaticAnalyzer/Checkers/CloneChecker.cpp:89
@@ +88,3 @@
+    auto NoteWithSuggestionID = DiagEngine.getCustomDiagID(
+        DiagnosticsEngine::Note, "Or maybe you wanted to use %0 here in this "
I think this should be worded a bit better, too.

Comment at: test/Analysis/copypaste/suspicious-clones.cpp:11
@@ +10,3 @@
+    return a;
+  return b; // expected-note{{Suggestion is based on the useage of this variable in a similar piece of code.}}
This note here is very obscure. It doesn't contain a lot of meaningful information. It should give a hint where is this similar piece of code.


More information about the cfe-commits mailing list