[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
================
@@ -3808,13 +3866,39 @@ void Parser::ParseCXXMemberSpecification(SourceLocation RecordLoc,
SourceLocation AbstractLoc;
bool IsFinalSpelledSealed = false;
bool IsAbstract = false;
+ TriviallyRelocatableSpecifier TriviallyRelocatable;
+ ReplaceableSpecifier Replacable;
// Parse the optional 'final' keyword.
if (getLangOpts().CPlusPlus && Tok.is(tok::identifier)) {
while (true) {
VirtSpecifiers::Specifier Specifier = isCXX11VirtSpecifier(Tok);
- if (Specifier == VirtSpecifiers::VS_None)
- break;
+ if (Specifier == VirtSpecifiers::VS_None) {
+ if (isCXX2CTriviallyRelocatableKeyword(Tok)) {
+ if (TriviallyRelocatable.isSet()) {
+ auto Skipped = Tok;
+ ConsumeToken();
+ Diag(Skipped, diag::err_duplicate_class_relocation_specifier)
+ << 0 << TriviallyRelocatable.getLocation();
+ } else {
+ ParseOptionalCXX2CTriviallyRelocatableSpecifier(
+ TriviallyRelocatable);
+ }
+ continue;
+ } else if (isCXX2CReplaceableKeyword(Tok)) {
+ if (Replacable.isSet()) {
+ auto Skipped = Tok;
+ ConsumeToken();
+ Diag(Skipped, diag::err_duplicate_class_relocation_specifier)
+ << 1 << Replacable.getLocation();
----------------
erichkeane wrote:
here too.
https://github.com/llvm/llvm-project/pull/127636
More information about the cfe-commits
mailing list