================
@@ -771,6 +771,11 @@ static bool isNullTermPointer(const Expr *Ptr, ASTContext 
&Ctx) {
       if (MD->getName() == "c_str" && RD->getName() == "basic_string")
         return true;
   }
+  if (auto *CE = dyn_cast<CallExpr>(Ptr->IgnoreParenImpCasts())) {
+    const FunctionDecl *F = CE->getDirectCallee();
+    if (F && F->getIdentifier() && F->getName() == "strerror")
----------------
ojhunt wrote:

@zmodem Ah, there's a more generic `terminated_by(x)` (unsure of exact 
spelling, but __null_terminated is a macro that expands to `terminated_by(0)` - 
while it would be nice to share spelling I'm unsure a parallel copy of this 
attribute is what we would want.

This would also allow chromium (or who[m?]ever) to annotate any of their own 
functions that return null terminated strings

https://github.com/llvm/llvm-project/pull/175208
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to