зеркало из https://github.com/microsoft/clang-1.git
Implement AST dumper for Decls.
http://llvm-reviews.chandlerc.com/D52 Patch by Philip Craig! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@170634 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Родитель
bf53dfac81
Коммит
d538ed9b2a
|
@ -40,8 +40,7 @@ struct PrintingPolicy {
|
|||
SuppressUnwrittenScope(false), SuppressInitializers(false),
|
||||
ConstantArraySizeAsWritten(false), AnonymousTagLocations(true),
|
||||
SuppressStrongLifetime(false), Bool(LO.Bool),
|
||||
TerseOutput(false), PolishForDeclaration(false),
|
||||
DumpSourceManager(0) { }
|
||||
TerseOutput(false), PolishForDeclaration(false) { }
|
||||
|
||||
/// \brief What language we're printing.
|
||||
LangOptions LangOpts;
|
||||
|
@ -147,12 +146,6 @@ struct PrintingPolicy {
|
|||
/// declaration tag; such as, do not print attributes attached to the declaration.
|
||||
///
|
||||
unsigned PolishForDeclaration : 1;
|
||||
|
||||
/// \brief If we are "dumping" rather than "pretty-printing", this points to
|
||||
/// a SourceManager which will be used to dump SourceLocations. Dumping
|
||||
/// involves printing the internal details of the AST and pretty-printing
|
||||
/// involves printing something similar to source code.
|
||||
SourceManager *DumpSourceManager;
|
||||
};
|
||||
|
||||
} // end namespace clang
|
||||
|
|
|
@ -308,6 +308,9 @@ public:
|
|||
void print(raw_ostream &OS, const PrintingPolicy &Policy,
|
||||
bool SuppressNNS = false) const;
|
||||
|
||||
/// \brief Debugging aid that dumps the template name.
|
||||
void dump(raw_ostream &OS) const;
|
||||
|
||||
/// \brief Debugging aid that dumps the template name to standard
|
||||
/// error.
|
||||
void dump() const;
|
||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -7,7 +7,7 @@
|
|||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This file implements the Decl::dump method, which pretty print the
|
||||
// This file implements the Decl::print method, which pretty prints the
|
||||
// AST back out to C/Objective-C/C++/Objective-C++ code.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
@ -176,16 +176,6 @@ void DeclContext::dumpDeclContext() const {
|
|||
Printer.VisitDeclContext(const_cast<DeclContext *>(this), /*Indent=*/false);
|
||||
}
|
||||
|
||||
void Decl::dump() const {
|
||||
dump(llvm::errs());
|
||||
}
|
||||
|
||||
void Decl::dump(raw_ostream &Out) const {
|
||||
PrintingPolicy Policy = getASTContext().getPrintingPolicy();
|
||||
Policy.DumpSourceManager = &getASTContext().getSourceManager();
|
||||
print(Out, Policy, /*Indentation*/ 0, /*PrintInstantiation*/ true);
|
||||
}
|
||||
|
||||
raw_ostream& DeclPrinter::Indent(unsigned Indentation) {
|
||||
for (unsigned i = 0; i != Indentation; ++i)
|
||||
Out << " ";
|
||||
|
@ -242,18 +232,18 @@ void DeclPrinter::VisitDeclContext(DeclContext *DC, bool Indent) {
|
|||
if (isa<ObjCIvarDecl>(*D))
|
||||
continue;
|
||||
|
||||
if (!Policy.DumpSourceManager) {
|
||||
// Skip over implicit declarations in pretty-printing mode.
|
||||
if (D->isImplicit()) continue;
|
||||
// FIXME: Ugly hack so we don't pretty-print the builtin declaration
|
||||
// of __builtin_va_list or __[u]int128_t. There should be some other way
|
||||
// to check that.
|
||||
if (NamedDecl *ND = dyn_cast<NamedDecl>(*D)) {
|
||||
if (IdentifierInfo *II = ND->getIdentifier()) {
|
||||
if (II->isStr("__builtin_va_list") ||
|
||||
II->isStr("__int128_t") || II->isStr("__uint128_t"))
|
||||
continue;
|
||||
}
|
||||
// Skip over implicit declarations in pretty-printing mode.
|
||||
if (D->isImplicit())
|
||||
continue;
|
||||
|
||||
// FIXME: Ugly hack so we don't pretty-print the builtin declaration
|
||||
// of __builtin_va_list or __[u]int128_t. There should be some other way
|
||||
// to check that.
|
||||
if (NamedDecl *ND = dyn_cast<NamedDecl>(*D)) {
|
||||
if (IdentifierInfo *II = ND->getIdentifier()) {
|
||||
if (II->isStr("__builtin_va_list") ||
|
||||
II->isStr("__int128_t") || II->isStr("__uint128_t"))
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1875,11 +1875,6 @@ void Stmt::printPretty(raw_ostream &OS,
|
|||
return;
|
||||
}
|
||||
|
||||
if (Policy.DumpSourceManager) {
|
||||
dump(OS, *Policy.DumpSourceManager);
|
||||
return;
|
||||
}
|
||||
|
||||
StmtPrinter P(OS, Helper, Policy, Indentation);
|
||||
P.Visit(const_cast<Stmt*>(this));
|
||||
}
|
||||
|
|
|
@ -168,9 +168,13 @@ const DiagnosticBuilder &clang::operator<<(const DiagnosticBuilder &DB,
|
|||
return DB << NameStr;
|
||||
}
|
||||
|
||||
void TemplateName::dump() const {
|
||||
void TemplateName::dump(raw_ostream &OS) const {
|
||||
LangOptions LO; // FIXME!
|
||||
LO.CPlusPlus = true;
|
||||
LO.Bool = true;
|
||||
print(llvm::errs(), PrintingPolicy(LO));
|
||||
print(OS, PrintingPolicy(LO));
|
||||
}
|
||||
|
||||
void TemplateName::dump() const {
|
||||
dump(llvm::errs());
|
||||
}
|
||||
|
|
|
@ -3,10 +3,10 @@
|
|||
// CHECK: example0
|
||||
void example0() {
|
||||
double d = 2.0;
|
||||
// CHECK: double &rd =
|
||||
// CHECK: VarDecl{{.*}}rd 'double &'
|
||||
// CHECK-NEXT: DeclRefExpr
|
||||
double &rd = d;
|
||||
// CHECK: const double &rcd =
|
||||
// CHECK: VarDecl{{.*}}rcd 'const double &'
|
||||
// CHECK-NEXT: ImplicitCastExpr{{.*}}'const double' lvalue <NoOp>
|
||||
const double &rcd = d;
|
||||
}
|
||||
|
@ -16,10 +16,10 @@ struct B : A { } b;
|
|||
|
||||
// CHECK: example1
|
||||
void example1() {
|
||||
// CHECK: A &ra =
|
||||
// CHECK: VarDecl{{.*}}ra 'struct A &'
|
||||
// CHECK: ImplicitCastExpr{{.*}}'struct A' lvalue <DerivedToBase (A)>
|
||||
A &ra = b;
|
||||
// CHECK: const A &rca =
|
||||
// CHECK: VarDecl{{.*}}rca 'const struct A &'
|
||||
// CHECK: ImplicitCastExpr{{.*}}'const struct A' lvalue <NoOp>
|
||||
// CHECK: ImplicitCastExpr{{.*}}'struct A' lvalue <DerivedToBase (A)>
|
||||
const A& rca = b;
|
||||
|
@ -33,12 +33,12 @@ struct X {
|
|||
|
||||
// CHECK: example2
|
||||
void example2() {
|
||||
// CHECK: const A &rca =
|
||||
// CHECK: VarDecl{{.*}}rca 'const struct A &'
|
||||
// CHECK: ImplicitCastExpr{{.*}}'const struct A' <NoOp>
|
||||
// CHECK: ImplicitCastExpr{{.*}}'struct A' <DerivedToBase (A)>
|
||||
// CHECK: CallExpr{{.*}}B
|
||||
const A &rca = f();
|
||||
// CHECK: const A &r =
|
||||
// CHECK: VarDecl{{.*}}r 'const struct A &'
|
||||
// CHECK: ImplicitCastExpr{{.*}}'const struct A' <NoOp>
|
||||
// CHECK: ImplicitCastExpr{{.*}}'struct A' <DerivedToBase (A)>
|
||||
// CHECK: CXXMemberCallExpr{{.*}}'struct B'
|
||||
|
@ -47,7 +47,7 @@ void example2() {
|
|||
|
||||
// CHECK: example3
|
||||
void example3() {
|
||||
// CHECK: const double &rcd2 =
|
||||
// CHECK: VarDecl{{.*}}rcd2 'const double &'
|
||||
// CHECK: ImplicitCastExpr{{.*}} <IntegralToFloating>
|
||||
const double& rcd2 = 2;
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
// PR6176
|
||||
|
||||
// CHECK-RECORD: *** Dumping IRgen Record Layout
|
||||
// CHECK-RECORD: Record: struct s0
|
||||
// CHECK-RECORD: Record: (RecordDecl{{.*}}s0
|
||||
// CHECK-RECORD: Layout: <CGRecordLayout
|
||||
// CHECK-RECORD: LLVMType:%struct.s0 = type <{ [3 x i8] }>
|
||||
// CHECK-RECORD: IsZeroInitializable:1
|
||||
|
@ -49,7 +49,7 @@ unsigned long long test_0() {
|
|||
// PR5591
|
||||
|
||||
// CHECK-RECORD: *** Dumping IRgen Record Layout
|
||||
// CHECK-RECORD: Record: struct s1
|
||||
// CHECK-RECORD: Record: (RecordDecl{{.*}}s1
|
||||
// CHECK-RECORD: Layout: <CGRecordLayout
|
||||
// CHECK-RECORD: LLVMType:%struct.s1 = type <{ [3 x i8] }>
|
||||
// CHECK-RECORD: IsZeroInitializable:1
|
||||
|
@ -97,7 +97,7 @@ unsigned long long test_1() {
|
|||
// PR5567
|
||||
|
||||
// CHECK-RECORD: *** Dumping IRgen Record Layout
|
||||
// CHECK-RECORD: Record: union u2
|
||||
// CHECK-RECORD: Record: (RecordDecl{{.*}}u2
|
||||
// CHECK-RECORD: Layout: <CGRecordLayout
|
||||
// CHECK-RECORD: LLVMType:%union.u2 = type <{ i8 }>
|
||||
// CHECK-RECORD: IsZeroInitializable:1
|
||||
|
@ -269,7 +269,7 @@ _Bool test_6() {
|
|||
// Check that we compute the best alignment possible for each access.
|
||||
//
|
||||
// CHECK-RECORD: *** Dumping IRgen Record Layout
|
||||
// CHECK-RECORD: Record: struct s7
|
||||
// CHECK-RECORD: Record: (RecordDecl{{.*}}s7
|
||||
// CHECK-RECORD: Layout: <CGRecordLayout
|
||||
// CHECK-RECORD: LLVMType:%struct.s7 = type { i32, i32, i32, i8, [3 x i8], [4 x i8], [12 x i8] }
|
||||
// CHECK-RECORD: IsZeroInitializable:1
|
||||
|
|
|
@ -0,0 +1,152 @@
|
|||
// RUN: %clang_cc1 -ast-dump -ast-dump-filter Test %s | FileCheck -check-prefix CHECK -strict-whitespace %s
|
||||
// RUN: %clang_cc1 -ast-dump %s | FileCheck -check-prefix CHECK-TU -strict-whitespace %s
|
||||
|
||||
int TestLocation;
|
||||
// CHECK: VarDecl 0x{{[^ ]*}} <{{.*}}:4:1, col:5> TestLocation
|
||||
|
||||
struct TestIndent {
|
||||
int x;
|
||||
};
|
||||
// CHECK: {{^\(RecordDecl.*TestIndent[^()]*$}}
|
||||
// CHECK-NEXT: {{^ \(FieldDecl.*x[^()]*\)\)$}}
|
||||
|
||||
struct TestChildren {
|
||||
int x;
|
||||
struct y {
|
||||
int z;
|
||||
};
|
||||
};
|
||||
// CHECK: RecordDecl{{.*}}TestChildren
|
||||
// CHECK-NEXT: FieldDecl{{.*}}x
|
||||
// CHECK-NEXT: RecordDecl{{.*}}y
|
||||
// CHECK-NEXT: FieldDecl{{.*}}z
|
||||
|
||||
// CHECK-TU: TranslationUnitDecl
|
||||
|
||||
void testLabelDecl() {
|
||||
__label__ TestLabelDecl;
|
||||
TestLabelDecl: goto TestLabelDecl;
|
||||
}
|
||||
// CHECK: LabelDecl{{.*}} TestLabelDecl
|
||||
|
||||
typedef int TestTypedefDecl;
|
||||
// CHECK: TypedefDecl{{.*}} TestTypedefDecl 'int'
|
||||
|
||||
__module_private__ typedef int TestTypedefDeclPrivate;
|
||||
// CHECK: TypedefDecl{{.*}} TestTypedefDeclPrivate 'int' __module_private__
|
||||
|
||||
enum TestEnumDecl {
|
||||
testEnumDecl
|
||||
};
|
||||
// CHECK: EnumDecl{{.*}} TestEnumDecl
|
||||
// CHECK-NEXT: EnumConstantDecl{{.*}} testEnumDecl
|
||||
|
||||
struct TestEnumDeclAnon {
|
||||
enum {
|
||||
testEnumDeclAnon
|
||||
} e;
|
||||
};
|
||||
// CHECK: RecordDecl{{.*}} TestEnumDeclAnon
|
||||
// CHECK-NEXT: EnumDecl{{.*>$}}
|
||||
|
||||
enum TestEnumDeclForward;
|
||||
// CHECK: EnumDecl{{.*}} TestEnumDeclForward
|
||||
|
||||
__module_private__ enum TestEnumDeclPrivate;
|
||||
// CHECK: EnumDecl{{.*}} TestEnumDeclPrivate __module_private__
|
||||
|
||||
struct TestRecordDecl {
|
||||
int i;
|
||||
};
|
||||
// CHECK: RecordDecl{{.*}} struct TestRecordDecl
|
||||
// CHECK-NEXT: FieldDecl
|
||||
|
||||
struct TestRecordDeclEmpty {
|
||||
};
|
||||
// CHECK: RecordDecl{{.*}} struct TestRecordDeclEmpty
|
||||
|
||||
struct TestRecordDeclAnon1 {
|
||||
struct {
|
||||
} testRecordDeclAnon1;
|
||||
};
|
||||
// CHECK: RecordDecl{{.*}} struct TestRecordDeclAnon1
|
||||
// CHECK-NEXT: RecordDecl{{.*}} struct
|
||||
|
||||
struct TestRecordDeclAnon2 {
|
||||
struct {
|
||||
};
|
||||
};
|
||||
// CHECK: RecordDecl{{.*}} struct TestRecordDeclAnon2
|
||||
// CHECK-NEXT: RecordDecl{{.*}} struct
|
||||
|
||||
struct TestRecordDeclForward;
|
||||
// CHECK: RecordDecl{{.*}} struct TestRecordDeclForward
|
||||
|
||||
__module_private__ struct TestRecordDeclPrivate;
|
||||
// CHECK: RecordDecl{{.*}} struct TestRecordDeclPrivate __module_private__
|
||||
|
||||
enum testEnumConstantDecl {
|
||||
TestEnumConstantDecl,
|
||||
TestEnumConstantDeclInit = 1
|
||||
};
|
||||
// CHECK: EnumConstantDecl{{.*}} TestEnumConstantDecl 'int'
|
||||
// CHECK: EnumConstantDecl{{.*}} TestEnumConstantDeclInit 'int'
|
||||
// CHECK-NEXT: IntegerLiteral
|
||||
|
||||
struct testIndirectFieldDecl {
|
||||
struct {
|
||||
int TestIndirectFieldDecl;
|
||||
};
|
||||
};
|
||||
// CHECK: IndirectFieldDecl{{.*}} TestIndirectFieldDecl 'int'
|
||||
// CHECK-NEXT: Field{{.*}} ''
|
||||
// CHECK-NEXT: Field{{.*}} 'TestIndirectFieldDecl'
|
||||
|
||||
int TestFunctionDecl(int x, enum { e } y) {
|
||||
return x;
|
||||
}
|
||||
// CHECK: FunctionDecl{{.*}} TestFunctionDecl 'int (int, enum {{.*}})'
|
||||
// CHECK-NEXT: EnumDecl
|
||||
// CHECK-NEXT: EnumConstantDecl{{.*}} e
|
||||
// CHECK-NEXT: ParmVarDecl{{.*}} x
|
||||
// CHECK-NEXT: ParmVarDecl{{.*}} y
|
||||
// CHECK-NEXT: CompoundStmt
|
||||
|
||||
int TestFunctionDeclProto(int x);
|
||||
// CHECK: FunctionDecl{{.*}} TestFunctionDeclProto 'int (int)'
|
||||
// CHECK-NEXT: ParmVarDecl{{.*}} x
|
||||
|
||||
extern int TestFunctionDeclSC();
|
||||
// CHECK: FunctionDecl{{.*}} TestFunctionDeclSC 'int ()' extern
|
||||
|
||||
inline int TestFunctionDeclInline();
|
||||
// CHECK: FunctionDecl{{.*}} TestFunctionDeclInline 'int ()' inline
|
||||
|
||||
struct testFieldDecl {
|
||||
int TestFieldDecl;
|
||||
int TestFieldDeclWidth : 1;
|
||||
__module_private__ int TestFieldDeclPrivate;
|
||||
};
|
||||
// CHECK: FieldDecl{{.*}} TestFieldDecl 'int'
|
||||
// CHECK: FieldDecl{{.*}} TestFieldDeclWidth 'int'
|
||||
// CHECK-NEXT: IntegerLiteral
|
||||
// CHECK: FieldDecl{{.*}} TestFieldDeclPrivate 'int' __module_private__
|
||||
|
||||
int TestVarDecl;
|
||||
// CHECK: VarDecl{{.*}} TestVarDecl 'int'
|
||||
|
||||
extern int TestVarDeclSC;
|
||||
// CHECK: VarDecl{{.*}} TestVarDeclSC 'int' extern
|
||||
|
||||
__thread int TestVarDeclThread;
|
||||
// CHECK: VarDecl{{.*}} TestVarDeclThread 'int' __thread
|
||||
|
||||
__module_private__ int TestVarDeclPrivate;
|
||||
// CHECK: VarDecl{{.*}} TestVarDeclPrivate 'int' __module_private__
|
||||
|
||||
int TestVarDeclInit = 0;
|
||||
// CHECK: VarDecl{{.*}} TestVarDeclInit 'int'
|
||||
// CHECK-NEXT: IntegerLiteral
|
||||
|
||||
void testParmVarDecl(int TestParmVarDecl);
|
||||
// CHECK: ParmVarDecl{{.*}} TestParmVarDecl 'int'
|
|
@ -0,0 +1,405 @@
|
|||
// RUN: %clang_cc1 -std=c++11 -fms-extensions -ast-dump -ast-dump-filter Test %s | FileCheck -check-prefix CHECK -strict-whitespace %s
|
||||
|
||||
class testEnumDecl {
|
||||
enum class TestEnumDeclScoped;
|
||||
enum TestEnumDeclFixed : int;
|
||||
};
|
||||
// CHECK: EnumDecl{{.*}} class TestEnumDeclScoped 'int'
|
||||
// CHECK: EnumDecl{{.*}} TestEnumDeclFixed 'int'
|
||||
|
||||
class testFieldDecl {
|
||||
int TestFieldDeclInit = 0;
|
||||
};
|
||||
// CHECK: FieldDecl{{.*}} TestFieldDeclInit 'int'
|
||||
// CHECK-NEXT: IntegerLiteral
|
||||
|
||||
namespace testVarDeclNRVO {
|
||||
class A { };
|
||||
A foo() {
|
||||
A TestVarDeclNRVO;
|
||||
return TestVarDeclNRVO;
|
||||
}
|
||||
}
|
||||
// CHECK: VarDecl{{.*}} TestVarDeclNRVO 'class testVarDeclNRVO::A' nrvo
|
||||
|
||||
void testParmVarDeclInit(int TestParmVarDeclInit = 0);
|
||||
// CHECK: ParmVarDecl{{.*}} TestParmVarDeclInit 'int'
|
||||
// CHECK-NEXT: IntegerLiteral{{.*}}
|
||||
|
||||
namespace TestNamespaceDecl {
|
||||
int i;
|
||||
}
|
||||
// CHECK: NamespaceDecl{{.*}} TestNamespaceDecl
|
||||
// CHECK-NEXT: VarDecl
|
||||
|
||||
namespace TestNamespaceDecl {
|
||||
int j;
|
||||
}
|
||||
// CHECK: NamespaceDecl{{.*}} TestNamespaceDecl
|
||||
// CHECK-NEXT: original Namespace
|
||||
// CHECK-NEXT: VarDecl
|
||||
|
||||
inline namespace TestNamespaceDeclInline {
|
||||
}
|
||||
// CHECK: NamespaceDecl{{.*}} TestNamespaceDeclInline inline
|
||||
|
||||
namespace testUsingDirectiveDecl {
|
||||
namespace A {
|
||||
}
|
||||
}
|
||||
namespace TestUsingDirectiveDecl {
|
||||
using namespace testUsingDirectiveDecl::A;
|
||||
}
|
||||
// CHECK: NamespaceDecl{{.*}} TestUsingDirectiveDecl
|
||||
// CHECK-NEXT: UsingDirectiveDecl{{.*}} Namespace{{.*}} 'A'
|
||||
|
||||
namespace testNamespaceAlias {
|
||||
namespace A {
|
||||
}
|
||||
}
|
||||
namespace TestNamespaceAlias = testNamespaceAlias::A;
|
||||
// CHECK: NamespaceAliasDecl{{.*}} TestNamespaceAlias
|
||||
// CHECK-NEXT: Namespace{{.*}} 'A'
|
||||
|
||||
using TestTypeAliasDecl = int;
|
||||
// CHECK: TypeAliasDecl{{.*}} TestTypeAliasDecl 'int'
|
||||
|
||||
namespace testTypeAliasTemplateDecl {
|
||||
template<typename T> class A;
|
||||
template<typename T> using TestTypeAliasTemplateDecl = A<T>;
|
||||
}
|
||||
// CHECK: TypeAliasTemplateDecl{{.*}} TestTypeAliasTemplateDecl
|
||||
// CHECK-NEXT: TemplateTypeParmDecl
|
||||
// CHECK-NEXT: TypeAliasDecl{{.*}} TestTypeAliasTemplateDecl 'A<T>'
|
||||
|
||||
namespace testCXXRecordDecl {
|
||||
class A { };
|
||||
class B { };
|
||||
class TestCXXRecordDecl : virtual A, public B {
|
||||
int i;
|
||||
};
|
||||
}
|
||||
// CHECK: CXXRecordDecl{{.*}} class TestCXXRecordDecl
|
||||
// CHECK-NEXT: virtual private 'class testCXXRecordDecl::A'
|
||||
// CHECK-NEXT: public 'class testCXXRecordDecl::B'
|
||||
// CHECK-NEXT: CXXRecordDecl{{.*}} class TestCXXRecordDecl
|
||||
// CHECK-NEXT: FieldDecl
|
||||
|
||||
template<class...T>
|
||||
class TestCXXRecordDeclPack : public T... {
|
||||
};
|
||||
// CHECK: CXXRecordDecl{{.*}} class TestCXXRecordDeclPack
|
||||
// CHECK-NEXT: public 'T'...
|
||||
// CHECK-NEXT: CXXRecordDecl{{.*}} class TestCXXRecordDeclPack
|
||||
|
||||
__module_private__ class TestCXXRecordDeclPrivate;
|
||||
// CHECK: CXXRecordDecl{{.*}} class TestCXXRecordDeclPrivate __module_private__
|
||||
|
||||
class testCXXMethodDecl {
|
||||
__module_private__ void TestCXXMethodDeclPrivate();
|
||||
virtual void TestCXXMethodDeclPure() = 0;
|
||||
void TestCXXMethodDeclDelete() = delete;
|
||||
void TestCXXMethodDeclThrow() throw();
|
||||
void TestCXXMethodDeclThrowType() throw(int);
|
||||
};
|
||||
// CHECK: CXXMethodDecl{{.*}} TestCXXMethodDeclPrivate 'void (void)' __module_private__
|
||||
// CHECK: CXXMethodDecl{{.*}} TestCXXMethodDeclPure 'void (void)' virtual pure
|
||||
// CHECK: CXXMethodDecl{{.*}} TestCXXMethodDeclDelete 'void (void)' delete
|
||||
// CHECK: CXXMethodDecl{{.*}} TestCXXMethodDeclThrow 'void (void) throw()'
|
||||
// CHECK: CXXMethodDecl{{.*}} TestCXXMethodDeclThrowType 'void (void) throw(int)'
|
||||
|
||||
namespace testCXXConstructorDecl {
|
||||
class A { };
|
||||
class TestCXXConstructorDecl : public A {
|
||||
int I;
|
||||
TestCXXConstructorDecl(A &a, int i) : A(a), I(i) { }
|
||||
};
|
||||
}
|
||||
// CHECK: CXXConstructorDecl{{.*}} TestCXXConstructorDecl 'void {{.*}}'
|
||||
// CHECK-NEXT: ParmVarDecl{{.*}} a
|
||||
// CHECK-NEXT: ParmVarDecl{{.*}} i
|
||||
// CHECK-NEXT: CXXCtorInitializer{{.*}}A
|
||||
// CHECK-NEXT: Expr
|
||||
// CHECK: CXXCtorInitializer{{.*}}I
|
||||
// CHECK-NEXT: Expr
|
||||
// CHECK: CompoundStmt
|
||||
|
||||
class TestCXXDestructorDecl {
|
||||
~TestCXXDestructorDecl() { }
|
||||
};
|
||||
// CHECK: CXXDestructorDecl{{.*}} ~TestCXXDestructorDecl 'void (void) noexcept'
|
||||
// CHECK-NEXT: CompoundStmt
|
||||
|
||||
class TestCXXConversionDecl {
|
||||
operator int() { return 0; }
|
||||
};
|
||||
// CHECK: CXXConversionDecl{{.*}} operator int 'int (void)'
|
||||
// CHECK-NEXT: CompoundStmt
|
||||
|
||||
namespace TestStaticAssertDecl {
|
||||
static_assert(true, "msg");
|
||||
}
|
||||
// CHECK: NamespaceDecl{{.*}} TestStaticAssertDecl
|
||||
// CHECK-NEXT: StaticAssertDecl{{.*>$}}
|
||||
// CHECK-NEXT: CXXBoolLiteralExpr
|
||||
// CHECK-NEXT: StringLiteral
|
||||
|
||||
namespace testFunctionTemplateDecl {
|
||||
class A { };
|
||||
class B { };
|
||||
class C { };
|
||||
class D { };
|
||||
template<typename T> void TestFunctionTemplate(T) { }
|
||||
|
||||
// implicit instantiation
|
||||
void bar(A a) { TestFunctionTemplate(a); }
|
||||
|
||||
// explicit specialization
|
||||
template<> void TestFunctionTemplate(B);
|
||||
|
||||
// explicit instantiation declaration
|
||||
extern template void TestFunctionTemplate(C);
|
||||
|
||||
// explicit instantiation definition
|
||||
template void TestFunctionTemplate(D);
|
||||
}
|
||||
// CHECK: FunctionTemplateDecl{{.*}} TestFunctionTemplate
|
||||
// CHECK-NEXT: TemplateTypeParmDecl
|
||||
// CHECK-NEXT: FunctionDecl{{.*}} TestFunctionTemplate 'void (T)'
|
||||
// CHECK-NEXT: ParmVarDecl{{.*}} 'T'
|
||||
// CHECK-NEXT: CompoundStmt
|
||||
// CHECK-NEXT: FunctionDecl{{.*}} TestFunctionTemplate {{.*}}A
|
||||
// CHECK-NEXT: TemplateArgument
|
||||
// CHECK-NEXT: ParmVarDecl
|
||||
// CHECK-NEXT: CompoundStmt
|
||||
// CHECK-NEXT: Function{{.*}} 'TestFunctionTemplate' {{.*}}B
|
||||
// CHECK-NEXT: FunctionDecl{{.*}} TestFunctionTemplate {{.*}}C
|
||||
// CHECK-NEXT: TemplateArgument
|
||||
// CHECK-NEXT: ParmVarDecl
|
||||
// CHECK-NEXT: FunctionDecl{{.*}} TestFunctionTemplate {{.*}}D
|
||||
// CHECK-NEXT: TemplateArgument
|
||||
// CHECK-NEXT: ParmVarDecl
|
||||
// CHECK-NEXT: CompoundStmt
|
||||
// CHECK: FunctionDecl{{.*}} TestFunctionTemplate {{.*}}B
|
||||
// CHECK-NEXT: TemplateArgument
|
||||
// CHECK-NEXT: ParmVarDecl
|
||||
|
||||
namespace testClassTemplateDecl {
|
||||
class A { };
|
||||
class B { };
|
||||
class C { };
|
||||
class D { };
|
||||
|
||||
template<typename T> class TestClassTemplate {
|
||||
int i;
|
||||
};
|
||||
|
||||
// implicit instantiation
|
||||
TestClassTemplate<A> a;
|
||||
|
||||
// explicit specialization
|
||||
template<> class TestClassTemplate<B> {
|
||||
int j;
|
||||
};
|
||||
|
||||
// explicit instantiation declaration
|
||||
extern template class TestClassTemplate<C>;
|
||||
|
||||
// explicit instantiation definition
|
||||
template class TestClassTemplate<D>;
|
||||
|
||||
// partial explicit specialization
|
||||
template<typename T1, typename T2> class TestClassTemplatePartial {
|
||||
int i;
|
||||
};
|
||||
template<typename T1> class TestClassTemplatePartial<T1, A> {
|
||||
int j;
|
||||
};
|
||||
}
|
||||
// CHECK: ClassTemplateDecl{{.*}} TestClassTemplate
|
||||
// CHECK-NEXT: TemplateTypeParmDecl
|
||||
// CHECK-NEXT: CXXRecordDecl{{.*}} class TestClassTemplate
|
||||
// CHECK-NEXT: CXXRecordDecl{{.*}} class TestClassTemplate
|
||||
// CHECK-NEXT: FieldDecl{{.*}} i
|
||||
// CHECK-NEXT: ClassTemplateSpecializationDecl{{.*}} class TestClassTemplate
|
||||
// CHECK-NEXT: TemplateArgument{{.*}}A
|
||||
// CHECK-NEXT: CXXRecordDecl{{.*}} class TestClassTemplate
|
||||
// CHECK-NEXT: FieldDecl{{.*}} i
|
||||
// CHECK: ClassTemplateSpecialization{{.*}} 'TestClassTemplate'
|
||||
// CHECK-NEXT: ClassTemplateSpecialization{{.*}} 'TestClassTemplate'
|
||||
// CHECK-NEXT: ClassTemplateSpecialization{{.*}} 'TestClassTemplate'
|
||||
|
||||
// CHECK: ClassTemplateSpecializationDecl{{.*}} class TestClassTemplate
|
||||
// CHECK-NEXT: TemplateArgument{{.*}}B
|
||||
// CHECK-NEXT: CXXRecordDecl{{.*}} class TestClassTemplate
|
||||
// CHECK-NEXT: FieldDecl{{.*}} j
|
||||
|
||||
// CHECK: ClassTemplateSpecializationDecl{{.*}} class TestClassTemplate
|
||||
// CHECK-NEXT: TemplateArgument{{.*}}C
|
||||
// CHECK-NEXT: CXXRecordDecl{{.*}} class TestClassTemplate
|
||||
// CHECK-NEXT: FieldDecl{{.*}} i
|
||||
|
||||
// CHECK: ClassTemplateSpecializationDecl{{.*}} class TestClassTemplate
|
||||
// CHECK-NEXT: TemplateArgument{{.*}}D
|
||||
// CHECK-NEXT: CXXRecordDecl{{.*}} class TestClassTemplate
|
||||
// CHECK-NEXT: FieldDecl{{.*}} i
|
||||
|
||||
// CHECK: ClassTemplatePartialSpecializationDecl{{.*}} class TestClassTemplatePartial
|
||||
// CHECK-NEXT: TemplateArgument
|
||||
// CHECK-NEXT: TemplateArgument{{.*}}A
|
||||
// CHECK-NEXT: TemplateTypeParmDecl
|
||||
// CHECK-NEXT: CXXRecordDecl{{.*}} class TestClassTemplatePartial
|
||||
// CHECK-NEXT: FieldDecl{{.*}} j
|
||||
|
||||
template <class T>
|
||||
class TestClassScopeFunctionSpecialization {
|
||||
template<class U> void foo(U a) { }
|
||||
template<> void foo<int>(int a) { }
|
||||
};
|
||||
// CHECK: ClassScopeFunctionSpecializationDecl
|
||||
// CHECK-NEXT: CXXMethod{{.*}} 'foo' 'void (int)'
|
||||
// CHECK-NEXT: TemplateArgument{{.*}} 'int'
|
||||
|
||||
namespace TestTemplateTypeParmDecl {
|
||||
template<typename ... T, class U = int> void foo();
|
||||
}
|
||||
// CHECK: NamespaceDecl{{.*}} TestTemplateTypeParmDecl
|
||||
// CHECK-NEXT: FunctionTemplateDecl
|
||||
// CHECK-NEXT: TemplateTypeParmDecl{{.*}} typename ... T
|
||||
// CHECK-NEXT: TemplateTypeParmDecl{{.*}} class U 'int'
|
||||
|
||||
namespace TestNonTypeTemplateParmDecl {
|
||||
template<int I = 1, int ... J> void foo();
|
||||
}
|
||||
// CHECK: NamespaceDecl{{.*}} TestNonTypeTemplateParmDecl
|
||||
// CHECK-NEXT: FunctionTemplateDecl
|
||||
// CHECK-NEXT: NonTypeTemplateParmDecl{{.*}} 'int' I
|
||||
// CHECK-NEXT: IntegerLiteral{{.*}} 'int' 1
|
||||
// CHECK-NEXT: NonTypeTemplateParmDecl{{.*}} 'int' ... J
|
||||
|
||||
namespace TestTemplateTemplateParmDecl {
|
||||
template<typename T> class A;
|
||||
template <template <typename> class T = A, template <typename> class ... U> void foo();
|
||||
}
|
||||
// CHECK: NamespaceDecl{{.*}} TestTemplateTemplateParmDecl
|
||||
// CHECK: FunctionTemplateDecl
|
||||
// CHECK-NEXT: TemplateTemplateParmDecl{{.*}} T
|
||||
// CHECK-NEXT: TemplateTypeParmDecl{{.*}} typename
|
||||
// CHECK-NEXT: TemplateArgument{{.*}} template A
|
||||
// CHECK-NEXT: TemplateTemplateParmDecl{{.*}} ... U
|
||||
// CHECK-NEXT: TemplateTypeParmDecl{{.*}} typename
|
||||
|
||||
namespace TestTemplateArgument {
|
||||
template<typename> class A { };
|
||||
template<template<typename> class ...> class B { };
|
||||
int foo();
|
||||
|
||||
template<typename> class testType { };
|
||||
template class testType<int>;
|
||||
// CHECK: ClassTemplateSpecializationDecl{{.*}} class testType
|
||||
// CHECK-NEXT: TemplateArgument{{.*}} type 'int'
|
||||
|
||||
template<int fp(void)> class testDecl { };
|
||||
template class testDecl<foo>;
|
||||
// CHECK: ClassTemplateSpecializationDecl{{.*}} class testDecl
|
||||
// CHECK-NEXT: TemplateArgument{{.*}} decl
|
||||
// CHECK-NEXT: Function{{.*}}foo
|
||||
|
||||
template class testDecl<nullptr>;
|
||||
// CHECK: ClassTemplateSpecializationDecl{{.*}} class testDecl
|
||||
// CHECK-NEXT: TemplateArgument{{.*}} nullptr
|
||||
|
||||
template<int> class testIntegral { };
|
||||
template class testIntegral<1>;
|
||||
// CHECK: ClassTemplateSpecializationDecl{{.*}} class testIntegral
|
||||
// CHECK-NEXT: TemplateArgument{{.*}} integral 1
|
||||
|
||||
template<template<typename> class> class testTemplate { };
|
||||
template class testTemplate<A>;
|
||||
// CHECK: ClassTemplateSpecializationDecl{{.*}} class testTemplate
|
||||
// CHECK-NEXT: TemplateArgument{{.*}} A
|
||||
|
||||
template<template<typename> class ...T> class C {
|
||||
B<T...> testTemplateExpansion;
|
||||
};
|
||||
// FIXME: Need TemplateSpecializationType dumping to test TemplateExpansion.
|
||||
|
||||
template<int, int = 0> class testExpr;
|
||||
template<int I> class testExpr<I> { };
|
||||
// CHECK: ClassTemplatePartialSpecializationDecl{{.*}} class testExpr
|
||||
// CHECK-NEXT: TemplateArgument{{.*}} expr
|
||||
// CHECK-NEXT: DeclRefExpr{{.*}}I
|
||||
|
||||
template<int, int ...> class testPack { };
|
||||
template class testPack<0, 1, 2>;
|
||||
// CHECK: ClassTemplateSpecializationDecl{{.*}} class testPack
|
||||
// CHECK-NEXT: TemplateArgument{{.*}} integral 0
|
||||
// CHECK-NEXT: TemplateArgument{{.*}} pack
|
||||
// CHECK-NEXT: TemplateArgument{{.*}} integral 1
|
||||
// CHECK-NEXT: TemplateArgument{{.*}} integral 2
|
||||
}
|
||||
|
||||
namespace testUsingDecl {
|
||||
int i;
|
||||
}
|
||||
namespace TestUsingDecl {
|
||||
using testUsingDecl::i;
|
||||
}
|
||||
// CHECK: NamespaceDecl{{.*}} TestUsingDecl
|
||||
// CHECK-NEXT: UsingDecl{{.*}} testUsingDecl::i
|
||||
// CHECK-NEXT: UsingShadowDecl{{.*}} Var{{.*}} 'i' 'int'
|
||||
|
||||
namespace testUnresolvedUsing {
|
||||
class A { };
|
||||
template<class T> class B {
|
||||
public:
|
||||
A a;
|
||||
};
|
||||
template<class T> class TestUnresolvedUsing : public B<T> {
|
||||
using typename B<T>::a;
|
||||
using B<T>::a;
|
||||
};
|
||||
}
|
||||
// CHECK: CXXRecordDecl{{.*}} TestUnresolvedUsing
|
||||
// CHECK: UnresolvedUsingTypenameDecl{{.*}} B<T>::a
|
||||
// CHECK: UnresolvedUsingValueDecl{{.*}} B<T>::a
|
||||
|
||||
namespace TestLinkageSpecDecl {
|
||||
extern "C" void test1();
|
||||
extern "C++" void test2();
|
||||
}
|
||||
// CHECK: NamespaceDecl{{.*}} TestLinkageSpecDecl
|
||||
// CHECK-NEXT: LinkageSpecDecl{{.*}} C
|
||||
// CHECK-NEXT: FunctionDecl
|
||||
// CHECK-NEXT: LinkageSpecDecl{{.*}} C++
|
||||
// CHECK-NEXT: FunctionDecl
|
||||
|
||||
class TestAccessSpecDecl {
|
||||
public:
|
||||
private:
|
||||
protected:
|
||||
};
|
||||
// CHECK: CXXRecordDecl{{.*}} class TestAccessSpecDecl
|
||||
// CHECK-NEXT: CXXRecordDecl{{.*}} class TestAccessSpecDecl
|
||||
// CHECK-NEXT: AccessSpecDecl{{.*}} public
|
||||
// CHECK-NEXT: AccessSpecDecl{{.*}} private
|
||||
// CHECK-NEXT: AccessSpecDecl{{.*}} protected
|
||||
|
||||
template<typename T> class TestFriendDecl {
|
||||
friend int foo();
|
||||
friend class A;
|
||||
friend T;
|
||||
};
|
||||
// CHECK: CXXRecord{{.*}} TestFriendDecl
|
||||
// CHECK-NEXT: CXXRecord{{.*}} TestFriendDecl
|
||||
// CHECK-NEXT: FriendDecl
|
||||
// CHECK-NEXT: FunctionDecl{{.*}} foo
|
||||
// CHECK-NEXT: FriendDecl{{.*}} 'class A':'class A'
|
||||
// CHECK-NEXT: FriendDecl{{.*}} 'T'
|
||||
|
||||
namespace TestFileScopeAsmDecl {
|
||||
asm("ret");
|
||||
}
|
||||
// CHECK: NamespaceDecl{{.*}} TestFileScopeAsmDecl{{$}}
|
||||
// CHECK: FileScopeAsmDecl{{.*>$}}
|
||||
// CHECK-NEXT: StringLiteral
|
|
@ -0,0 +1,136 @@
|
|||
// RUN: %clang_cc1 -Wno-unused -fblocks -ast-dump -ast-dump-filter Test %s | FileCheck -strict-whitespace %s
|
||||
|
||||
@protocol P
|
||||
@end
|
||||
|
||||
@interface A
|
||||
@end
|
||||
|
||||
@interface TestObjCIvarDecl : A
|
||||
@end
|
||||
|
||||
@implementation TestObjCIvarDecl {
|
||||
int varDefault;
|
||||
@private int varPrivate;
|
||||
@protected int varProtected;
|
||||
@public int varPublic;
|
||||
@package int varPackage;
|
||||
}
|
||||
@end
|
||||
// CHECK: ObjCImplementationDecl{{.*}} TestObjCIvarDecl
|
||||
// CHECK-NEXT: ObjCInterface{{.*}} 'TestObjCIvarDecl'
|
||||
// CHECK-NEXT: ObjCIvarDecl{{.*}} varDefault 'int' private
|
||||
// CHECK-NEXT: ObjCIvarDecl{{.*}} varPrivate 'int' private
|
||||
// CHECK-NEXT: ObjCIvarDecl{{.*}} varProtected 'int' protected
|
||||
// CHECK-NEXT: ObjCIvarDecl{{.*}} varPublic 'int' public
|
||||
// CHECK-NEXT: ObjCIvarDecl{{.*}} varPackage 'int' package
|
||||
|
||||
@interface testObjCMethodDecl : A {
|
||||
}
|
||||
- (int) TestObjCMethodDecl: (int)i, ...;
|
||||
// CHECK: ObjCMethodDecl{{.*}} - TestObjCMethodDecl: 'int'
|
||||
// CHECK-NEXT: ParmVarDecl{{.*}} i 'int'
|
||||
// CHECK-NEXT: ...
|
||||
@end
|
||||
|
||||
@implementation testObjCMethodDecl
|
||||
- (int) TestObjCMethodDecl: (int)i, ... {
|
||||
return 0;
|
||||
}
|
||||
// CHECK: ObjCMethodDecl{{.*}} - TestObjCMethodDecl: 'int'
|
||||
// CHECK-NEXT: ImplicitParamDecl{{.*}} self
|
||||
// CHECK-NEXT: ImplicitParamDecl{{.*}} _cmd
|
||||
// CHECK-NEXT: ParmVarDecl{{.*}} i 'int'
|
||||
// CHECK-NEXT: ...
|
||||
// CHECK-NEXT: CompoundStmt
|
||||
@end
|
||||
|
||||
@protocol TestObjCProtocolDecl
|
||||
- (void) foo;
|
||||
@end
|
||||
// CHECK: ObjCProtocolDecl{{.*}} TestObjCProtocolDecl
|
||||
// CHECK-NEXT: ObjCMethodDecl{{.*}} foo
|
||||
|
||||
@interface TestObjCClass : A <P>
|
||||
- (void) foo;
|
||||
@end
|
||||
// CHECK: ObjCInterfaceDecl{{.*}} TestObjCClass
|
||||
// CHECK-NEXT: super ObjCInterface{{.*}} 'A'
|
||||
// CHECK-NEXT: ObjCImplementation{{.*}} 'TestObjCClass'
|
||||
// CHECK-NEXT: ObjCProtocol{{.*}} 'P'
|
||||
// CHECK-NEXT: ObjCMethodDecl{{.*}} foo
|
||||
|
||||
@implementation TestObjCClass : A {
|
||||
int i;
|
||||
}
|
||||
- (void) foo {
|
||||
}
|
||||
@end
|
||||
// CHECK: ObjCImplementationDecl{{.*}} TestObjCClass
|
||||
// CHECK-NEXT: super ObjCInterface{{.*}} 'A'
|
||||
// CHECK-NEXT: ObjCInterface{{.*}} 'TestObjCClass'
|
||||
// CHECK-NEXT: ObjCIvarDecl{{.*}} i
|
||||
// CHECK-NEXT: ObjCMethodDecl{{.*}} foo
|
||||
|
||||
@interface TestObjCClass (TestObjCCategoryDecl) <P>
|
||||
- (void) bar;
|
||||
@end
|
||||
// CHECK: ObjCCategoryDecl{{.*}} TestObjCCategoryDecl
|
||||
// CHECK-NEXT: ObjCInterface{{.*}} 'TestObjCClass'
|
||||
// CHECK-NEXT: ObjCCategoryImpl{{.*}} 'TestObjCClass'
|
||||
// CHECK-NEXT: ObjCProtocol{{.*}} 'P'
|
||||
// CHECK-NEXT: ObjCMethodDecl{{.*}} bar
|
||||
|
||||
@implementation TestObjCClass (TestObjCCategoryDecl)
|
||||
- (void) bar {
|
||||
}
|
||||
@end
|
||||
// CHECK: ObjCCategoryImplDecl{{.*}} TestObjCClass
|
||||
// CHECK-NEXT: ObjCInterface{{.*}} 'TestObjCClass'
|
||||
// CHECK-NEXT: ObjCCategory{{.*}} 'TestObjCCategoryDecl'
|
||||
// CHECK-NEXT: ObjCMethodDecl{{.*}} bar
|
||||
|
||||
@compatibility_alias TestObjCCompatibleAliasDecl A;
|
||||
// CHECK: ObjCCompatibleAliasDecl{{.*}} TestObjCCompatibleAliasDecl
|
||||
// CHECK-NEXT: ObjCInterface{{.*}} 'A'
|
||||
|
||||
@interface TestObjCProperty: A
|
||||
@property(getter=getterFoo, setter=setterFoo:) int foo;
|
||||
@property int bar;
|
||||
@end
|
||||
// CHECK: ObjCInterfaceDecl{{.*}} TestObjCProperty
|
||||
// CHECK: ObjCPropertyDecl{{.*}} foo 'int' assign readwrite atomic unsafe_unretained
|
||||
// CHECK-NEXT: getter ObjCMethod{{.*}} 'getterFoo'
|
||||
// CHECK-NEXT: setter ObjCMethod{{.*}} 'setterFoo:'
|
||||
// CHECK-NEXT: ObjCPropertyDecl{{.*}} bar 'int' assign readwrite atomic unsafe_unretained
|
||||
// CHECK-NEXT: ObjCMethodDecl{{.*}} getterFoo
|
||||
// CHECK-NEXT: ObjCMethodDecl{{.*}} setterFoo:
|
||||
// CHECK-NEXT: ParmVarDecl{{.*}} foo
|
||||
// CHECK-NEXT: ObjCMethodDecl{{.*}} bar
|
||||
// CHECK-NEXT: ObjCMethodDecl{{.*}} setBar:
|
||||
// CHECK-NEXT: ParmVarDecl{{.*}} bar
|
||||
|
||||
@implementation TestObjCProperty {
|
||||
int i;
|
||||
}
|
||||
@synthesize foo=i;
|
||||
@synthesize bar;
|
||||
@end
|
||||
// CHECK: ObjCImplementationDecl{{.*}} TestObjCProperty
|
||||
// CHECK: ObjCPropertyImplDecl{{.*}} foo synthesize
|
||||
// CHECK-NEXT: ObjCProperty{{.*}} 'foo'
|
||||
// CHECK-NEXT: ObjCIvar{{.*}} 'i' 'int'
|
||||
// CHECK-NEXT: ObjCIvarDecl{{.*}} bar 'int' synthesize private
|
||||
// CHECK-NEXT: ObjCPropertyImplDecl{{.*}} bar synthesize
|
||||
// CHECK-NEXT: ObjCProperty{{.*}} 'bar'
|
||||
// CHECK-NEXT: ObjCIvar{{.*}} 'bar' 'int'
|
||||
|
||||
void TestBlockDecl(int x) {
|
||||
^(int y, ...){ x; };
|
||||
}
|
||||
// CHECK: FunctionDecl{{.*}}TestBlockDecl
|
||||
// CHECK: BlockDecl
|
||||
// CHECK-NEXT: ParmVarDecl{{.*}} y 'int'
|
||||
// CHECK-NEXT: ...
|
||||
// CHECK-NEXT: capture ParmVar{{.*}} 'x' 'int'
|
||||
// CHECK-NEXT: CompoundStmt
|
|
@ -0,0 +1,23 @@
|
|||
// RUN: %clang_cc1 -Wno-unused -fblocks -ast-dump -ast-dump-filter Test %s | FileCheck -strict-whitespace %s
|
||||
|
||||
@interface A
|
||||
@end
|
||||
|
||||
@interface TestObjCImplementation : A
|
||||
@end
|
||||
|
||||
@implementation TestObjCImplementation : A {
|
||||
struct X {
|
||||
int i;
|
||||
} X;
|
||||
}
|
||||
- (void) foo {
|
||||
}
|
||||
@end
|
||||
// CHECK: ObjCImplementationDecl{{.*}} TestObjCImplementation
|
||||
// CHECK-NEXT: super ObjCInterface{{.*}} 'A'
|
||||
// CHECK-NEXT: ObjCInterface{{.*}} 'TestObjCImplementation'
|
||||
// CHECK-NEXT: CXXCtorInitializer{{.*}} 'X'
|
||||
// CHECK-NEXT: CXXConstructExpr
|
||||
// CHECK-NEXT: ObjCIvarDecl{{.*}} X
|
||||
// CHECK-NEXT: ObjCMethodDecl{{.*}} foo
|
|
@ -1,31 +1,31 @@
|
|||
// RUN: %clang_cc1 -ast-dump -ast-dump-filter Test %s | FileCheck -strict-whitespace %s
|
||||
|
||||
int TestLocation = 0;
|
||||
// CHECK: Dumping TestLocation
|
||||
// CHECK-NEXT: IntegerLiteral 0x{{[^ ]*}} <{{.*}}:3:20> 'int' 0
|
||||
// CHECK: VarDecl{{.*}}TestLocation
|
||||
// CHECK-NEXT: IntegerLiteral 0x{{[^ ]*}} <col:20> 'int' 0
|
||||
|
||||
int TestIndent = 1 + (1);
|
||||
// CHECK: Dumping TestIndent
|
||||
// CHECK-NEXT: {{\(BinaryOperator[^()]*$}}
|
||||
// CHECK-NEXT: {{^ \(IntegerLiteral.*0[^()]*\)$}}
|
||||
// CHECK-NEXT: {{^ \(ParenExpr.*0[^()]*$}}
|
||||
// CHECK-NEXT: {{^ \(IntegerLiteral.*0[^()]*\)\)\)$}}
|
||||
// CHECK: VarDecl{{.*}}TestIndent
|
||||
// CHECK-NEXT: {{^ \(BinaryOperator[^()]*$}}
|
||||
// CHECK-NEXT: {{^ \(IntegerLiteral.*0[^()]*\)$}}
|
||||
// CHECK-NEXT: {{^ \(ParenExpr.*0[^()]*$}}
|
||||
// CHECK-NEXT: {{^ \(IntegerLiteral.*0[^()]*\)\)\)\)$}}
|
||||
|
||||
void TestDeclStmt() {
|
||||
int x = 0;
|
||||
int y, z;
|
||||
}
|
||||
// CHECK: Dumping TestDeclStmt
|
||||
// CHECK: FunctionDecl{{.*}}TestDeclStmt
|
||||
// CHECK-NEXT: CompoundStmt
|
||||
// CHECK-NEXT: DeclStmt
|
||||
// CHECK-NEXT: int x =
|
||||
// CHECK-NEXT: VarDecl{{.*}}x
|
||||
// CHECK-NEXT: IntegerLiteral
|
||||
// CHECK-NEXT: DeclStmt
|
||||
// CHECK-NEXT: int y
|
||||
// CHECK-NEXT: int z
|
||||
// CHECK-NEXT: VarDecl{{.*}}y
|
||||
// CHECK-NEXT: VarDecl{{.*}}z
|
||||
|
||||
int TestOpaqueValueExpr = 0 ?: 1;
|
||||
// CHECK: Dumping TestOpaqueValueExpr
|
||||
// CHECK: VarDecl{{.*}}TestOpaqueValueExpr
|
||||
// CHECK-NEXT: BinaryConditionalOperator
|
||||
// CHECK-NEXT: IntegerLiteral
|
||||
// CHECK-NEXT: OpaqueValueExpr
|
||||
|
|
|
@ -3,15 +3,14 @@
|
|||
void TestBlockExpr(int x) {
|
||||
^{ x; };
|
||||
}
|
||||
// CHECK: Dumping TestBlockExpr
|
||||
// CHECK: BlockExpr{{.*}} decl=
|
||||
// CHECK-NEXT: capture ParmVar
|
||||
// CHECK-NEXT: CompoundStmt
|
||||
// CHECK: FunctionDecl{{.*}}TestBlockExpr
|
||||
// CHECK: BlockExpr{{.*}} 'void (^)(void)'
|
||||
// CHECK-NEXT: BlockDecl
|
||||
|
||||
void TestExprWithCleanup(int x) {
|
||||
^{ x; };
|
||||
}
|
||||
// CHECK: Dumping TestExprWithCleanup
|
||||
// CHECK: FunctionDecl{{.*}}TestExprWithCleanup
|
||||
// CHECK: ExprWithCleanups
|
||||
// CHECK-NEXT: cleanup Block
|
||||
// CHECK-NEXT: BlockExpr
|
||||
|
@ -26,10 +25,11 @@ void TestObjCAtCatchStmt() {
|
|||
} @finally {
|
||||
}
|
||||
}
|
||||
// CHECK: Dumping TestObjCAtCatchStmt
|
||||
// CHECK: FunctionDecl{{.*}}TestObjCAtCatchStmt
|
||||
// CHECK: ObjCAtTryStmt
|
||||
// CHECK-NEXT: CompoundStmt
|
||||
// CHECK-NEXT: ObjCAtCatchStmt{{.*}} catch parm = "A *a"
|
||||
// CHECK-NEXT: ObjCAtCatchStmt{{.*}}
|
||||
// CHECK-NEXT: VarDecl{{.*}}a
|
||||
// CHECK-NEXT: CompoundStmt
|
||||
// CHECK-NEXT: ObjCAtCatchStmt{{.*}} catch all
|
||||
// CHECK-NEXT: CompoundStmt
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// RUN: %clang_cc1 -ast-dump %s > %t
|
||||
// RUN: %clang_cc1 -ast-print %s > %t
|
||||
// RUN: FileCheck < %t %s -check-prefix=CHECK1
|
||||
// RUN: FileCheck < %t %s -check-prefix=CHECK2
|
||||
|
||||
|
@ -27,8 +27,8 @@ void baz() {
|
|||
// CHECK2: template <int X = 2, typename Y = double, int Z = 3> struct foo {
|
||||
|
||||
// Template definition - foo
|
||||
// CHECK1: template <int X, typename Y, int Z = (IntegerLiteral {{.*}} 'int' 5)
|
||||
// CHECK2: template <int X, typename Y, int Z = (IntegerLiteral {{.*}} 'int' 5)
|
||||
// CHECK1: template <int X, typename Y, int Z = 5> struct foo {
|
||||
// CHECK2: template <int X, typename Y, int Z = 5> struct foo {
|
||||
|
||||
// Template instantiation - bar
|
||||
// CHECK1: template <int A = 5, typename B = int> int bar()
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
// RUN: %clang_cc1 -std=c++11 -ast-dump %s -triple x86_64-linux-gnu | FileCheck %s
|
||||
|
||||
char c8[] = u8"test\0\\\"\t\a\b\234";
|
||||
// CHECK: char c8[12] = (StringLiteral {{.*}} lvalue u8"test\000\\\"\t\a\b\234")
|
||||
// CHECK: (StringLiteral {{.*}} lvalue u8"test\000\\\"\t\a\b\234")
|
||||
|
||||
char16_t c16[] = u"test\0\\\"\t\a\b\234\u1234";
|
||||
// CHECK: char16_t c16[13] = (StringLiteral {{.*}} lvalue u"test\000\\\"\t\a\b\234\u1234")
|
||||
// CHECK: (StringLiteral {{.*}} lvalue u"test\000\\\"\t\a\b\234\u1234")
|
||||
|
||||
char32_t c32[] = U"test\0\\\"\t\a\b\234\u1234\U0010ffff"; // \
|
||||
// CHECK: char32_t c32[14] = (StringLiteral {{.*}} lvalue U"test\000\\\"\t\a\b\234\u1234\U0010FFFF")
|
||||
// CHECK: (StringLiteral {{.*}} lvalue U"test\000\\\"\t\a\b\234\u1234\U0010FFFF")
|
||||
|
||||
wchar_t wc[] = L"test\0\\\"\t\a\b\234\u1234\xffffffff"; // \
|
||||
// CHECK: wchar_t wc[14] = (StringLiteral {{.*}} lvalue L"test\000\\\"\t\a\b\234\x1234\xFFFFFFFF")
|
||||
// CHECK: (StringLiteral {{.*}} lvalue L"test\000\\\"\t\a\b\234\x1234\xFFFFFFFF")
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
// Test this without pch.
|
||||
// RUN: %clang_cc1 -include %S/objc_stmts.h -emit-llvm -fobjc-exceptions -o - %s
|
||||
// RUN: %clang_cc1 -include %S/objc_stmts.h -ast-dump -fobjc-exceptions -o - %s | FileCheck %s
|
||||
// RUN: %clang_cc1 -include %S/objc_stmts.h -ast-print -fobjc-exceptions -o - %s | FileCheck %s
|
||||
|
||||
// Test with pch.
|
||||
// RUN: %clang_cc1 -x objective-c -emit-pch -fobjc-exceptions -o %t %S/objc_stmts.h
|
||||
// RUN: %clang_cc1 -include-pch %t -emit-llvm -fobjc-exceptions -o - %s
|
||||
// RUN: %clang_cc1 -include-pch %t -ast-dump -fobjc-exceptions -o - %s | FileCheck %s
|
||||
// RUN: %clang_cc1 -include-pch %t -ast-print -fobjc-exceptions -o - %s | FileCheck %s
|
||||
|
||||
// CHECK: catch parm = "A *a"
|
||||
// CHECK: catch parm = "B *b"
|
||||
// CHECK: catch all
|
||||
// CHECK: @catch(A *a)
|
||||
// CHECK: @catch(B *b)
|
||||
// CHECK: @catch()
|
||||
|
|
|
@ -10,9 +10,9 @@ namespace PR6733 {
|
|||
bar(int x = kSomeConst) {}
|
||||
};
|
||||
|
||||
// CHECK: void f()
|
||||
// CHECK: FunctionDecl{{.*}}f 'void (void)'
|
||||
void f() {
|
||||
// CHECK: bar<int> tmp =
|
||||
// CHECK: VarDecl{{.*}}tmp 'bar<int>'
|
||||
// CHECK: CXXDefaultArgExpr{{.*}}'int'
|
||||
bar<int> tmp;
|
||||
}
|
||||
|
|
|
@ -1,15 +1,19 @@
|
|||
// RUN: clang-check -ast-dump "%s" -- 2>&1 | FileCheck %s
|
||||
// CHECK: namespace test_namespace
|
||||
// CHECK-NEXT: class TheClass
|
||||
// CHECK: int theMethod(int x) (CompoundStmt
|
||||
// CHECK: (NamespaceDecl{{.*}}test_namespace
|
||||
// CHECK-NEXT: (CXXRecordDecl{{.*}}TheClass
|
||||
// CHECK: (CXXMethodDecl{{.*}}theMethod
|
||||
// CHECK-NEXT: (ParmVarDecl{{.*}}x
|
||||
// CHECK-NEXT: (CompoundStmt
|
||||
// CHECK-NEXT: (ReturnStmt
|
||||
// CHECK-NEXT: (BinaryOperator
|
||||
//
|
||||
// RUN: clang-check -ast-dump -ast-dump-filter test_namespace::TheClass::theMethod "%s" -- 2>&1 | FileCheck -check-prefix CHECK-FILTER %s
|
||||
// CHECK-FILTER-NOT: namespace test_namespace
|
||||
// CHECK-FILTER-NOT: class TheClass
|
||||
// CHECK-FILTER-NOT: NamespaceDecl
|
||||
// CHECK-FILTER-NOT: CXXRecordDecl
|
||||
// CHECK-FILTER: {{^}}Dumping test_namespace::TheClass::theMethod
|
||||
// CHECK-FILTER-NEXT: {{^}}int theMethod(int x) (CompoundStmt
|
||||
// CHECK-FILTER-NEXT: {{^}}(CXXMethodDecl{{.*}}theMethod
|
||||
// CHECK-FILTER-NEXT: (ParmVarDecl{{.*}}x
|
||||
// CHECK-FILTER-NEXT: (CompoundStmt
|
||||
// CHECK-FILTER-NEXT: (ReturnStmt
|
||||
// CHECK-FILTER-NEXT: (BinaryOperator
|
||||
//
|
||||
|
@ -26,7 +30,8 @@
|
|||
//
|
||||
// RUN: clang-check -ast-dump -ast-dump-filter test_namespace::TheClass::n "%s" -- 2>&1 | FileCheck -check-prefix CHECK-ATTR %s
|
||||
// CHECK-ATTR: test_namespace
|
||||
// CHECK-ATTR-NEXT: int n __attribute__((aligned((BinaryOperator
|
||||
// CHECK-ATTR-NEXT: (FieldDecl{{.*}}n
|
||||
// FIXME: attribute dumping not implemented yet
|
||||
//
|
||||
// RUN: clang-check -ast-dump -ast-dump-filter test_namespace::AfterNullNode "%s" -- 2>&1 | FileCheck -check-prefix CHECK-AFTER-NULL %s
|
||||
// CHECK-AFTER-NULL: class AfterNullNode
|
||||
|
|
Загрузка…
Ссылка в новой задаче