int TestLocation
__attribute__((unused));
int TestIndent
__attribute__((unused));
void TestAttributedStmt() {
switch (1) {
case 1:
[[clang::fallthrough]];
case 2:
;
}
}
[[clang::warn_unused_result]] int TestCXX11DeclAttr();
int TestAlignedNull __attribute__((aligned));
int TestAlignedExpr __attribute__((aligned(4)));
int TestEnum __attribute__((visibility("default")));
class __attribute__((lockable)) Mutex {
} mu1, mu2;
int TestExpr __attribute__((guarded_by(mu1)));
class Mutex TestVariadicExpr __attribute__((acquired_after(mu1, mu2)));
void function1(void *) {
int TestFunction __attribute__((cleanup(function1)));
}
void TestIdentifier(void *, int)
__attribute__((pointer_with_type_tag(ident1,1,2)));
void TestBool(void *, int)
__attribute__((pointer_with_type_tag(bool1,1,2)));
void TestUnsigned(void *, int)
__attribute__((pointer_with_type_tag(unsigned1,1,2)));
void TestInt(void) __attribute__((constructor(123)));
static int TestString __attribute__((alias("alias1")));
extern struct s1 TestType
__attribute__((type_tag_for_datatype(ident1,int)));
void TestLabel() {
L: __attribute__((unused)) int i;
M: __attribute(()) int j;
N: __attribute(()) ;
}
namespace Test {
extern "C" int printf(const char *format, ...);
alignas(8) extern int x;
extern int x;
}
int __attribute__((cdecl)) TestOne(void), TestTwo(void);
void func() {
auto Test = []() __attribute__((no_thread_safety_analysis)) {};
auto Test2 = []() __attribute__((noreturn)) { while(1); };
}
namespace PR20930 {
struct S {
struct { int Test __attribute__((deprecated)); };
};
void f() {
S s;
s.Test = 1;
}
}
struct __attribute__((objc_bridge_related(NSParagraphStyle,,))) TestBridgedRef;
void TestExternalSourceSymbolAttr1()
__attribute__((external_source_symbol(language="Swift", defined_in="module", generated_declaration)));
void TestExternalSourceSymbolAttr2()
__attribute__((external_source_symbol(defined_in="module", language="Swift")));
void TestExternalSourceSymbolAttr3()
__attribute__((external_source_symbol(generated_declaration, language="Objective-C++", defined_in="module")));
void TestExternalSourceSymbolAttr4()
__attribute__((external_source_symbol(defined_in="Some external file.cs", generated_declaration, language="C Sharp")));
void TestExternalSourceSymbolAttr5()
__attribute__((external_source_symbol(generated_declaration, defined_in="module", language="Swift")));
namespace TestNoEscape {
void noescapeFunc(int *p0, __attribute__((noescape)) int *p1) {}
}
namespace TestSuppress {
[[gsl::suppress("at-namespace")]];
[[gsl::suppress("on-decl")]]
void TestSuppressFunction();
void f() {
int *i;
[[gsl::suppress("on-stmt")]] {
i = reinterpret_cast<int*>(7);
}
}
}
namespace TestLifetimeCategories {
class [[gsl::Owner(int)]] AOwner{};
class [[gsl::Pointer(int)]] APointer{};
class [[gsl::Pointer]] PointerWithoutArgument{};
class [[gsl::Owner]] OwnerWithoutArgument{};
}
int mergeAttrTest() __attribute__((deprecated)) __attribute__((warn_unused_result));
int mergeAttrTest() __attribute__((annotate("test")));
int mergeAttrTest() __attribute__((unused,no_thread_safety_analysis));