[clang] [LifetimeSafety] Allow configuring lifetimebound fix-it spelling (PR #204045)

Zeyi Xu via cfe-commits cfe-commits at lists.llvm.org
Thu Jun 18 03:20:48 PDT 2026


================
@@ -422,27 +423,49 @@ class LifetimeSafetySemaHelperImpl : public LifetimeSafetySemaHelper {
   }
 
 private:
-  std::pair<SourceLocation, StringRef>
+  std::string getLifetimeBoundFixItText(SourceLocation Loc, bool LeadingSpace,
+                                        bool AllowGNUAttrMacro = true) {
----------------
zeyi2 wrote:

I added `AllowGNUAttrMacro` to avoid this fix-it: https://godbolt.org/z/oYd9Wxcj5

It seems that we can't blindly emit `__attribute((lifetimebound))` for all cases. Could be related to https://github.com/llvm/llvm-project/issues/121905 and https://github.com/llvm/llvm-project/pull/192070

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


More information about the cfe-commits mailing list