[PATCH] D67156: [Analyzer] Debug Checkers for Container and Iterator Inspection

Kristóf Umann via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Sep 6 18:19:41 PDT 2019


Szelethus added a comment.

I'm sadly not knowledgeable enough with `CallDescriptionMap`, so let's have another round of review on this, otherwise, its perfect.

We talked about dividing this checker into multiple files, which would also make reviewing a bit easier. With that done, combined with this patch, I am very confident that we could enable parts of this checker by default by, well, you know, soon enough :^)



================
Comment at: include/clang/StaticAnalyzer/Checkers/Checkers.td:1328-1337
+def ContainerInspectionChecker : Checker<"ContainerInspection">,
+  HelpText<"Check the analyzer's understanding of C++ containers">,
+  Dependencies<[IteratorModeling]>,
+  Documentation<NotDocumented>;
+
+def IteratorInspectionChecker : Checker<"IteratorInspection">,
+  HelpText<"Check the analyzer's understanding of C++ iterators">,
----------------
NoQ wrote:
> Dunno, i would keep it all in one checker, just to save a few `// RUN:` lines :)
I agree. Let's combine these into `DebugIteratorModeling`, because, as I understand it, that is what we're doing!


================
Comment at: test/Analysis/iterator-inspection.cpp:1-2
+// RUN: %clang_analyze_cc1 -std=c++11 -analyzer-checker=core,cplusplus,debug.ContainerInspection,debug.IteratorInspection,debug.ExprInspection -analyzer-config aggressive-binary-operation-simplification=true -analyzer-config c++-container-inlining=false %s -verify
+// RUN: %clang_analyze_cc1 -std=c++11 -analyzer-checker=core,cplusplus,debug.ContainerInspection,debug.IteratorInspection,debug.ExprInspection -analyzer-config aggressive-binary-operation-simplification=true -analyzer-config c++-container-inlining=true -DINLINE=1 %s -verify
+
----------------
Could you please format these? c:


================
Comment at: test/Analysis/iterator-inspection.cpp:38-43
+void iterator_container(const std::vector<int> v0) {
+  auto b0 = v0.begin();
+
+  clang_analyzer_dump(&v0); //expected-warning{{&v0}}
+  clang_analyzer_dump(clang_analyzer_iterator_container(b0)); //expected-warning{{&v0}}
+}
----------------
Yea, I agree, let's add a testcase with a little more substance.


Repository:
  rC Clang

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

https://reviews.llvm.org/D67156





More information about the cfe-commits mailing list