[clang] [Clang] Implement the core language parts of P2786 - Trivial relocation (PR #127636)
Erich Keane via cfe-commits
cfe-commits at lists.llvm.org
Fri Feb 21 07:01:51 PST 2025
================
@@ -2692,16 +2693,75 @@ bool Parser::isCXX11FinalKeyword() const {
Specifier == VirtSpecifiers::VS_Sealed;
}
+bool Parser::isCXX2CTriviallyRelocatableKeyword(Token Tok) const {
+ if (!getLangOpts().CPlusPlus || Tok.isNot(tok::identifier))
+ return false;
+ if (!Ident_trivially_relocatable_if_eligible)
+ Ident_trivially_relocatable_if_eligible =
+ &PP.getIdentifierTable().get("trivially_relocatable_if_eligible");
+ IdentifierInfo *II = Tok.getIdentifierInfo();
+ return II == Ident_trivially_relocatable_if_eligible;
+}
+
+bool Parser::isCXX2CTriviallyRelocatableKeyword() const {
+ return isCXX2CTriviallyRelocatableKeyword(Tok);
+}
+
+void Parser::ParseOptionalCXX2CTriviallyRelocatableSpecifier(
+ TriviallyRelocatableSpecifier &TRS) {
+ assert(isCXX2CTriviallyRelocatableKeyword() &&
----------------
erichkeane wrote:
The name 'ParseOptional' here implies to me that we'll return true/false based on whether the next one IS this keyword, and fill it in only if that is the case. But this is parsing one we already know is there?
https://github.com/llvm/llvm-project/pull/127636
More information about the cfe-commits
mailing list