================
@@ -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:

That's part of the -fbounds-safety type information, it's the type system 
representation "this is a pointer to a sentinel terminated buffer" of the 
`__terminated_by` (probably wrong spelling) attribute. So a string literal has 
a semantically something like `ValueTerminatedType { sentinel: 0 }`, my 
*understanding* is that it will prevent something like `ptr++` walking past the 
terminator.

In this case however we'd just be interested in it from the view of confirming 
the buffer is terminated.

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