================
@@ -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:
I am still uncertain whether you should include this in general or this should
be a follow up, because this became quite complicated for just 1 PR. @usx95
what do you think?
https://github.com/llvm/llvm-project/pull/204045
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits