[PATCH] D93110: [analyzer] Implement a first version of suppressions via attributes

Valeriy Savchenko via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Dec 16 06:39:16 PST 2020


vsavchenko added inline comments.


================
Comment at: clang/lib/StaticAnalyzer/Core/BugReporter.cpp:2907
+    // start with it.
+    llvm::SmallVector<DynTypedNode, 8> Stack{DynTypedNode::create(*BugStmt)};
+
----------------
jkorous wrote:
> Since IIUC a node can have multiple parents - does that mean we could end up traversing a node multiple times?
> BTW do you have an example of a node that have multiple parents?
The vast majority of AST nodes have exactly one parent.  As for the nodes that do have multiple parents, I only know about `InitListExpr`.
And yes, I think we can end up traversing a node multiple times, but no one seems to be bothered by that


================
Comment at: clang/lib/StaticAnalyzer/Core/BugReporter.cpp:2936
+      // Let's continue with the current node's parent(s).
+      for (const auto &Parent : AC.getParents(Current)) {
+        Stack.push_back(Parent);
----------------
jkorous wrote:
> There's a note for `ASTContext::getParents`:
> 
> "New callers should use ParentMapContext::getParents() directly."
> 
> https://clang.llvm.org/doxygen/classclang_1_1ASTContext.html#a32d11844fdb82310b9059784fd4ceb6b
> 
> Shall we do that?
Sure!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D93110



More information about the cfe-commits mailing list