NoQ added inline comments.

================
Comment at: lib/StaticAnalyzer/Checkers/DanglingInternalBufferChecker.cpp:32
                                                      check::PostCall> {
-  CallDescription CStrFn;
+  const llvm::SmallVector<CallDescription, 4> CStrFnFamily = {
+    {"std::basic_string<char>::c_str"}, {"std::basic_string<char32_t>::c_str"},
----------------
xazax.hun wrote:
> I am not sure if this is the right solution in case of this check. We should 
> track `c_str` calls regardless of what the template parameter is, so 
> supporting any instantiation of `basic_string` is desired. This might not be 
> the case, however, for other checks. 
> 
> If we think it is more likely we do not care about the template arguments, 
> maybe a separate API could be used, where we pass the qualified name of the 
> class separately without the template arguments.
> Alternatively, we could use matches name so the users could use regexps.
> 
> At this point I also wonder what isCalled API gives us compared to matchers? 
> Maybe it is more convenient to use than calling a `match`. Also, isCalled API 
> has an IdentifierInfo cached which could be used for relatively efficient 
> checks.
> 
> @NoQ what do you think?
> 
> 
I agree that it's better to match the chain of classes and namespaces (in as 
much detail as the user cares to provide) and discard template parameters.

For example, i wish that a `CallDescription` that's defined as `{"std", 
"basic_string", "c_str"}` would be able to match both `std::string::c_str()` 
and `std::__1::string::c_str()`.


Repository:
  rC Clang

https://reviews.llvm.org/D48027



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

Reply via email to