xazax.hun added a comment.

Regarding the visitor:
Maybe rather than looking at the AST, we should check the states, when we 
started to track the returned symbol?

Using your current design you need to check for the AST twice. Once in the 
visitor and once in the check.

Also, I wonder if this always give you the right note. Consider the following 
example:

  void deref_after_scope_char() {
    const char *c;
    {
      std::string s;
      c = s.c_str();
    }
    std::string s;
    const char *c2 = s.c_str();
    consume(c); 
  }



================
Comment at: lib/StaticAnalyzer/Checkers/DanglingInternalBufferChecker.cpp:149
+
+  if (!(FunI->getName() == "c_str"))
+    return nullptr;
----------------
Why not `!=`?


Repository:
  rC Clang

https://reviews.llvm.org/D48522



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to