mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-29 06:16:07 +00:00

This also ignores and deprecates the `-fdouble-square-bracket-attributes` command line flag, which seems to not be used anywhere. At least a code search exclusively found mentions of it in documentation: https://sourcegraph.com/search?q=context:global+-fdouble-square-bracket-attributes+-file:clang/*+-file:test/Sema/*+-file:test/Parser/*+-file:test/AST/*+-file:test/Preprocessor/*+-file:test/Misc/*+archived:yes&patternType=standard&sm=0&groupBy=repo RFC: https://discourse.llvm.org/t/rfc-enable-c-11-c2x-attributes-in-all-standard-modes-as-an-extension-and-remove-fdouble-square-bracket-attributes This enables `[[]]` attributes in all C and C++ language modes without warning by default. `-Wc++-extensions` does warn. GCC has enabled this extension in all C modes since GCC 10. Reviewed By: aaron.ballman, MaskRay Spies: #clang-vendors, beanz, JDevlieghere, Michael137, MaskRay, sstefan1, jplehr, cfe-commits, lldb-commits, dmgreen, jdoerfert, wenlei, wlei Differential Revision: https://reviews.llvm.org/D151683
55 lines
2.1 KiB
C
55 lines
2.1 KiB
C
// Test without serialization:
|
|
// RUN: %clang_cc1 -triple x86_64-pc-linux \
|
|
// RUN: -Wno-deprecated-declarations -ast-dump -ast-dump-filter Test %s \
|
|
// RUN: | FileCheck --strict-whitespace %s
|
|
//
|
|
// Test with serialization:
|
|
// RUN: %clang_cc1 -triple x86_64-pc-linux \
|
|
// RUN: -Wno-deprecated-declarations -emit-pch -o %t %s
|
|
// RUN: %clang_cc1 -x c -triple x86_64-pc-linux \
|
|
// RUN: -Wno-deprecated-declarations -include-pch %t -ast-dump-all -ast-dump-filter Test /dev/null \
|
|
// RUN: | sed -e "s/ <undeserialized declarations>//" -e "s/ imported//" \
|
|
// RUN: | FileCheck --strict-whitespace %s
|
|
|
|
int Test1 [[deprecated]];
|
|
// CHECK: VarDecl{{.*}}Test1
|
|
// CHECK-NEXT: DeprecatedAttr 0x{{[^ ]*}} <col:13> "" ""
|
|
|
|
enum [[deprecated("Frobble")]] Test2 {
|
|
Test3 [[deprecated]]
|
|
};
|
|
// CHECK: EnumDecl{{.*}}Test2
|
|
// CHECK-NEXT: DeprecatedAttr 0x{{[^ ]*}} <col:8, col:28> "Frobble" ""
|
|
// CHECK-NEXT: EnumConstantDecl{{.*}}Test3
|
|
// CHECK-NEXT: DeprecatedAttr 0x{{[^ ]*}} <col:11> "" ""
|
|
|
|
struct [[deprecated]] Test4 {
|
|
[[deprecated("Frobble")]] int Test5, Test6;
|
|
int Test7 [[deprecated]] : 12;
|
|
};
|
|
// CHECK: RecordDecl{{.*}}Test4
|
|
// CHECK-NEXT: DeprecatedAttr 0x{{[^ ]*}} <col:10> "" ""
|
|
// CHECK-NEXT: FieldDecl{{.*}}Test5
|
|
// CHECK-NEXT: DeprecatedAttr 0x{{[^ ]*}} <col:5, col:25> "Frobble" ""
|
|
// CHECK-NEXT: FieldDecl{{.*}}Test6
|
|
// CHECK-NEXT: DeprecatedAttr 0x{{[^ ]*}} <col:5, col:25> "Frobble" ""
|
|
// CHECK-NEXT: FieldDecl{{.*}}Test7
|
|
// CHECK-NEXT: ConstantExpr{{.*}}'int'
|
|
// CHECK-NEXT: value: Int 12
|
|
// CHECK-NEXT: IntegerLiteral{{.*}}'int' 12
|
|
// CHECK-NEXT: DeprecatedAttr 0x{{[^ ]*}} <col:15> "" ""
|
|
|
|
struct [[deprecated]] Test8;
|
|
// CHECK: RecordDecl{{.*}}Test8
|
|
// CHECK-NEXT: DeprecatedAttr 0x{{[^ ]*}} <col:10> "" ""
|
|
|
|
[[deprecated]] void Test9(int Test10 [[deprecated]]);
|
|
// CHECK: FunctionDecl{{.*}}Test9
|
|
// CHECK-NEXT: ParmVarDecl{{.*}}Test10
|
|
// CHECK-NEXT: DeprecatedAttr 0x{{[^ ]*}} <col:40> "" ""
|
|
// CHECK-NEXT: DeprecatedAttr 0x{{[^ ]*}} <col:3> "" ""
|
|
|
|
void Test11 [[deprecated]](void);
|
|
// CHECK: FunctionDecl{{.*}}Test11
|
|
// CHECK-NEXT: DeprecatedAttr 0x{{[^ ]*}} <col:15> "" ""
|