Skip to content

Commit 65a0abb

Browse files
committed
Manually reimplement MutualExclusion
1 parent c3a23e2 commit 65a0abb

File tree

2 files changed

+29
-3
lines changed

2 files changed

+29
-3
lines changed

clang/include/clang/Basic/Attr.td

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4388,16 +4388,13 @@ def MSStruct : InheritableAttr {
43884388
let Spellings = [GCC<"ms_struct">];
43894389
let Subjects = SubjectList<[Record]>;
43904390
let Documentation = [MSStructDocs];
4391-
let SimpleHandler = 1;
43924391
}
43934392

43944393
def GCCStruct : InheritableAttr {
43954394
let Spellings = [GCC<"gcc_struct">];
43964395
let Subjects = SubjectList<[Record]>;
43974396
let Documentation = [MSStructDocs]; // Covers this attribute too.
4398-
let SimpleHandler = 1;
43994397
}
4400-
def : MutualExclusions<[MSStruct, GCCStruct]>;
44014398

44024399
def DLLExport : InheritableAttr, TargetSpecificAttr<TargetHasDLLImportExport> {
44034400
let Spellings = [Declspec<"dllexport">, GCC<"dllexport">];

clang/lib/Sema/SemaDeclAttr.cpp

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6172,6 +6172,27 @@ static void handleMSConstexprAttr(Sema &S, Decl *D, const ParsedAttr &AL) {
61726172
D->addAttr(::new (S.Context) MSConstexprAttr(S.Context, AL));
61736173
}
61746174

6175+
static void handleMSStructAttr(Sema &S, Decl *D, const ParsedAttr &AL) {
6176+
if (const auto *First = D->getAttr<GCCStructAttr>()) {
6177+
S.Diag(AL.getLoc(), diag::err_attributes_are_not_compatible)
6178+
<< AL << First << 0;
6179+
S.Diag(First->getLocation(), diag::note_conflicting_attribute);
6180+
return;
6181+
}
6182+
6183+
D->addAttr(::new (S.Context) MSStructAttr(S.Context, AL));
6184+
}
6185+
6186+
static void handleGCCStructAttr(Sema &S, Decl *D, const ParsedAttr &AL) {
6187+
if (const auto *First = D->getAttr<MSStructAttr>()) {
6188+
S.Diag(AL.getLoc(), diag::err_attributes_are_not_compatible)
6189+
<< AL << First << 0;
6190+
S.Diag(First->getLocation(), diag::note_conflicting_attribute);
6191+
return;
6192+
}
6193+
D->addAttr(::new (S.Context) GCCStructAttr(S.Context, AL));
6194+
}
6195+
61756196
static void handleAbiTagAttr(Sema &S, Decl *D, const ParsedAttr &AL) {
61766197
SmallVector<StringRef, 4> Tags;
61776198
for (unsigned I = 0, E = AL.getNumArgs(); I != E; ++I) {
@@ -7910,6 +7931,14 @@ ProcessDeclAttribute(Sema &S, Scope *scope, Decl *D, const ParsedAttr &AL,
79107931
case ParsedAttr::AT_VTablePointerAuthentication:
79117932
handleVTablePointerAuthentication(S, D, AL);
79127933
break;
7934+
7935+
case ParsedAttr::AT_MSStruct:
7936+
handleMSStructAttr(S, D, AL);
7937+
break;
7938+
7939+
case ParsedAttr::AT_GCCStruct:
7940+
handleGCCStructAttr(S, D, AL);
7941+
break;
79137942
}
79147943
}
79157944

0 commit comments

Comments
 (0)