[clang] [LifetimeSafety] Add report on misuse of clang::noescape (PR #177260)

Gábor Horváth via cfe-commits cfe-commits at lists.llvm.org
Sun Jan 25 06:33:25 PST 2026


================
@@ -2927,6 +2927,17 @@ class LifetimeSafetyReporterImpl : public LifetimeSafetyReporter {
         << EscapeExpr->getSourceRange();
   }
 
+  void reportNoescapeViolation(const ParmVarDecl *ParmWithNoescape,
+                               const Expr *EscapeExpr) override {
+    S.Diag(ParmWithNoescape->getBeginLoc(),
----------------
Xazax-hun wrote:

Ugh, that is unfortunate. Does this work when the attribute is behind a macro? If not, and it is hard to make it work, I am also fine with just not offering a fixit in that case. 

Also, what about other spellings of the attribute like `__attribute__((....))`?

https://github.com/llvm/llvm-project/pull/177260


More information about the cfe-commits mailing list