================
@@ -422,27 +423,49 @@ class LifetimeSafetySemaHelperImpl : public 
LifetimeSafetySemaHelper {
   }
 
 private:
-  std::pair<SourceLocation, StringRef>
+  std::string getLifetimeBoundFixItText(SourceLocation Loc, bool LeadingSpace,
+                                        bool AllowGNUAttrMacro = true) {
+    StringRef Spelling = S.getLangOpts().LifetimeSafetyLifetimeBoundMacro;
+    if (Spelling.empty() && Loc.isValid()) {
+      const Preprocessor &PP = S.getPreprocessor();
+      Spelling = PP.getLastMacroWithSpelling(
+          Loc, {tok::l_square, tok::l_square, PP.getIdentifierInfo("clang"),
+                tok::coloncolon, PP.getIdentifierInfo("lifetimebound"),
+                tok::r_square, tok::r_square});
+
+      if (Spelling.empty() && AllowGNUAttrMacro)
+        Spelling = PP.getLastMacroWithSpelling(
+            Loc, {tok::kw___attribute, tok::l_paren, tok::l_paren,
+                  PP.getIdentifierInfo("lifetimebound"), tok::r_paren,
+                  tok::r_paren});
+    }
+    const std::string Text =
+        Spelling.empty() ? "[[clang::lifetimebound]]" : Spelling.str();
----------------
NeKon69 wrote:

Is there no way to check whether we are running >=C23?

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

Reply via email to