Skip to content

Commit 517ba9e

Browse files
committed
[CLANG] Enable cxx11 attributes after gnu attributes in ParseCXXClassMemberDeclaration
1 parent c46eda6 commit 517ba9e

File tree

5 files changed

+17
-8
lines changed

5 files changed

+17
-8
lines changed

clang/lib/Parse/ParseDeclCXX.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3035,10 +3035,13 @@ Parser::DeclGroupPtrTy Parser::ParseCXXClassMemberDeclaration(
30353035
}
30363036

30373037
ParsedAttributes DeclSpecAttrs(AttrFactory);
3038-
MaybeParseMicrosoftAttributes(DeclSpecAttrs);
3039-
30403038
// Hold late-parsed attributes so we can attach a Decl to them later.
30413039
LateParsedAttrList CommonLateParsedAttrs;
3040+
while (MaybeParseCXX11Attributes(DeclAttrs) ||
3041+
MaybeParseGNUAttributes(DeclSpecAttrs, &CommonLateParsedAttrs)) {
3042+
}
3043+
3044+
MaybeParseMicrosoftAttributes(DeclSpecAttrs);
30423045

30433046
// decl-specifier-seq:
30443047
// Parse the common declaration-specifiers piece.

clang/test/AST/ast-dump-color.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ struct Invalid {
9191
//CHECK: {{^}}[[Blue]]| `-[[RESET]][[MAGENTA]]DeclRefExpr[[RESET]][[Yellow]] 0x{{[0-9a-fA-F]*}}[[RESET]] <[[Yellow]]col:40[[RESET]]> [[Green]]'class Mutex':'Mutex'[[RESET]][[Cyan]] lvalue[[RESET]][[Cyan]][[RESET]] [[GREEN]]Var[[RESET]][[Yellow]] 0x{{[0-9a-fA-F]*}}[[RESET]][[CYAN]] 'mu1'[[RESET]] [[Green]]'class Mutex':'Mutex'[[RESET]] non_odr_use_unevaluated{{$}}
9292
//CHECK: {{^}}[[Blue]]|-[[RESET]][[GREEN]]CXXRecordDecl[[RESET]][[Yellow]] 0x{{[0-9a-fA-F]*}}[[RESET]] <[[Yellow]]line:28:1[[RESET]], [[Yellow]]line:30:1[[RESET]]> [[Yellow]]line:28:8[[RESET]] struct[[CYAN]] Invalid[[RESET]] definition
9393
//CHECK: {{^}}[[Blue]]| |-[[RESET]][[GREEN]]CXXRecordDecl[[RESET]][[Yellow]] 0x{{[0-9a-fA-F]*}}[[RESET]] <[[Yellow]]col:1[[RESET]], [[Yellow]]col:8[[RESET]]> [[Yellow]]col:8[[RESET]] implicit referenced struct[[CYAN]] Invalid[[RESET]]
94-
//CHECK: {{^}}[[Blue]]| |-[[RESET]][[GREEN]]CXXConstructorDecl[[RESET]][[Yellow]] 0x{{[0-9a-fA-F]*}}[[RESET]] <[[Yellow]]line:29:3[[RESET]], [[Yellow]]col:42[[RESET]]> [[Yellow]]col:29[[RESET]] invalid[[CYAN]] Invalid[[RESET]] [[Green]]'void (int)'[[RESET]]
94+
//CHECK: {{^}}[[Blue]]| |-[[RESET]][[GREEN]]CXXConstructorDecl[[RESET]][[Yellow]] 0x{{[0-9a-fA-F]*}}[[RESET]] <[[Yellow]]line:29:29[[RESET]], [[Yellow]]col:42[[RESET]]> [[Yellow]]col:29[[RESET]] invalid[[CYAN]] Invalid[[RESET]] [[Green]]'void (int)'[[RESET]]
9595
//CHECK: {{^}}[[Blue]]| | |-[[RESET]][[GREEN]]ParmVarDecl[[RESET]][[Yellow]] 0x{{[0-9a-fA-F]*}}[[RESET]] <[[Yellow]]col:37[[RESET]], [[Yellow]]<invalid sloc>[[RESET]]> [[Yellow]]col:42[[RESET]] invalid [[Green]]'int'[[RESET]]
9696
//CHECK: {{^}}[[Blue]]| | `-[[RESET]][[BLUE]]NoInlineAttr[[RESET]][[Yellow]] 0x{{[0-9a-fA-F]*}}[[RESET]] <[[Yellow]]col:18[[RESET]]>
9797
//CHECK: {{^}}[[Blue]]| |-[[RESET]][[GREEN]]CXXConstructorDecl[[RESET]][[Yellow]] 0x{{[0-9a-fA-F]*}}[[RESET]] <[[Yellow]]line:28:8[[RESET]]> [[Yellow]]col:8[[RESET]] implicit used constexpr[[CYAN]] Invalid[[RESET]] [[Green]]'void () noexcept'[[RESET]] inline

clang/test/Index/annotate-attribute.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ int templateFunction(T value) __attribute__((annotate("works")));
2424

2525
// CHECK: ClassDecl=Test:3:7 (Definition) Extent=[3:1 - 17:2]
2626
// CHECK-NEXT: CXXAccessSpecifier=:4:1 (Definition) Extent=[4:1 - 4:8]
27-
// CHECK-NEXT: CXXMethod=aMethod:5:51 Extent=[5:3 - 5:60]
27+
// CHECK-NEXT: CXXMethod=aMethod:5:51 Extent=[5:46 - 5:60]
2828
// CHECK-NEXT: attribute(annotate)=spiffy_method Extent=[5:18 - 5:43]
2929
// CHECK-NEXT: CXXAccessSpecifier=:7:1 (Definition) Extent=[7:1 - 7:43]
3030
// CHECK-NEXT: attribute(annotate)=works Extent=[7:23 - 7:40]

clang/test/Parser/cxx0x-attributes.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,12 @@ namespace test_misplacement {
7171
[[]] union union_attr2; //expected-error{{misplaced attributes}}
7272
[[]] enum E2 { }; //expected-error{{misplaced attributes}}
7373
}
74+
struct S1 { __attribute__((deprecated)) alignas(16) int x; }; // expected-none
75+
class C1 { __attribute__((deprecated)) alignas(16) int x; }; // expected-none
76+
77+
void fn_with_decl() {
78+
__attribute__((deprecated)) alignas(16) int x; // expected-none
79+
}
7480

7581
// Checks attributes placed at wrong syntactic locations of class specifiers.
7682
class [[]] [[]]

clang/test/SemaCXX/warn-thread-safety-analysis.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2434,10 +2434,10 @@ class Foo {
24342434
namespace WarnNoDecl {
24352435

24362436
class Foo {
2437-
void foo(int a); __attribute__(( // \
2438-
// expected-warning {{declaration does not declare anything}}
2439-
exclusive_locks_required(a))); // \
2440-
// expected-warning {{attribute exclusive_locks_required ignored}}
2437+
void foo(int a); __attribute__((
2438+
exclusive_locks_required(a))); // expected-warning {{declaration does not declare anything}} \
2439+
// expected-warning {{attribute exclusive_locks_required ignored}}
2440+
24412441
};
24422442

24432443
} // end namespace WarnNoDecl

0 commit comments

Comments
 (0)