[clang] 32d4586 - [clang] NFC: remove carriage return from AST tests
Matheus Izvekov via cfe-commits
cfe-commits at lists.llvm.org
Wed Oct 27 15:25:11 PDT 2021
Author: Matheus Izvekov
Date: 2021-10-28T00:25:02+02:00
New Revision: 32d45862fc03f4ccfe910ff3e59eff3d9dc3a42c
URL: https://github.com/llvm/llvm-project/commit/32d45862fc03f4ccfe910ff3e59eff3d9dc3a42c
DIFF: https://github.com/llvm/llvm-project/commit/32d45862fc03f4ccfe910ff3e59eff3d9dc3a42c.diff
LOG: [clang] NFC: remove carriage return from AST tests
Signed-off-by: Matheus Izvekov <mizvekov at gmail.com>
Reviewed By: rsmith
Differential Revision: https://reviews.llvm.org/D112372
Added:
Modified:
clang/test/AST/ast-dump-attr.cpp
clang/test/AST/ast-dump-attr.m
clang/test/AST/ast-dump-c-attr.c
clang/test/AST/ast-dump-decl.cpp
clang/test/AST/ast-dump-invalid.cpp
clang/test/AST/ast-dump-stmt.c
clang/test/AST/float16.cpp
clang/test/AST/sourceranges.cpp
Removed:
################################################################################
diff --git a/clang/test/AST/ast-dump-attr.cpp b/clang/test/AST/ast-dump-attr.cpp
index c2bd768dc2adf..25cfa6820b372 100644
--- a/clang/test/AST/ast-dump-attr.cpp
+++ b/clang/test/AST/ast-dump-attr.cpp
@@ -1,261 +1,261 @@
-// Test without serialization:
-// RUN: %clang_cc1 -triple x86_64-pc-linux -std=c++11 -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 -std=c++11 -Wno-deprecated-declarations -emit-pch -o %t %s
-// RUN: %clang_cc1 -x c++ -triple x86_64-pc-linux -std=c++11 -Wno-deprecated-declarations \
-// RUN: -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 TestLocation
-__attribute__((unused));
-// CHECK: VarDecl{{.*}}TestLocation
-// CHECK-NEXT: UnusedAttr 0x{{[^ ]*}} <line:[[@LINE-2]]:16>
-
-int TestIndent
-__attribute__((unused));
-// CHECK: {{^}}VarDecl{{.*TestIndent[^()]*$}}
-// CHECK-NEXT: {{^}}`-UnusedAttr{{[^()]*$}}
-
-void TestAttributedStmt() {
- switch (1) {
- case 1:
- [[clang::fallthrough]];
- case 2:
- ;
- }
-}
-// CHECK: FunctionDecl{{.*}}TestAttributedStmt
-// CHECK: AttributedStmt
-// CHECK-NEXT: FallThroughAttr
-// CHECK-NEXT: NullStmt
-
-[[clang::warn_unused_result]] int TestCXX11DeclAttr();
-// CHECK: FunctionDecl{{.*}}TestCXX11DeclAttr
-// CHECK-NEXT: WarnUnusedResultAttr
-
-int TestAlignedNull __attribute__((aligned));
-// CHECK: VarDecl{{.*}}TestAlignedNull
-// CHECK-NEXT: AlignedAttr {{.*}} aligned
-// CHECK-NEXT: <<<NULL>>>
-
-int TestAlignedExpr __attribute__((aligned(4)));
-// CHECK: VarDecl{{.*}}TestAlignedExpr
-// CHECK-NEXT: AlignedAttr {{.*}} aligned
-// CHECK-NEXT: ConstantExpr
-// CHECK-NEXT: value: Int 4
-// CHECK-NEXT: IntegerLiteral
-
-int TestEnum __attribute__((visibility("default")));
-// CHECK: VarDecl{{.*}}TestEnum
-// CHECK-NEXT: VisibilityAttr{{.*}} Default
-
-class __attribute__((lockable)) Mutex {
-} mu1, mu2;
-int TestExpr __attribute__((guarded_by(mu1)));
-// CHECK: VarDecl{{.*}}TestExpr
-// CHECK-NEXT: GuardedByAttr
-// CHECK-NEXT: DeclRefExpr{{.*}}mu1
-
-class Mutex TestVariadicExpr __attribute__((acquired_after(mu1, mu2)));
-// CHECK: VarDecl{{.*}}TestVariadicExpr
-// CHECK: AcquiredAfterAttr
-// CHECK-NEXT: DeclRefExpr{{.*}}mu1
-// CHECK-NEXT: DeclRefExpr{{.*}}mu2
-
-void function1(void *) {
- int TestFunction __attribute__((cleanup(function1)));
-}
-// CHECK: VarDecl{{.*}}TestFunction
-// CHECK-NEXT: CleanupAttr{{.*}} Function{{.*}}function1
-
-void TestIdentifier(void *, int)
-__attribute__((pointer_with_type_tag(ident1,1,2)));
-// CHECK: FunctionDecl{{.*}}TestIdentifier
-// CHECK: ArgumentWithTypeTagAttr{{.*}} pointer_with_type_tag ident1
-
-void TestBool(void *, int)
-__attribute__((pointer_with_type_tag(bool1,1,2)));
-// CHECK: FunctionDecl{{.*}}TestBool
-// CHECK: ArgumentWithTypeTagAttr{{.*}}pointer_with_type_tag bool1 1 2 IsPointer
-
-void TestUnsigned(void *, int)
-__attribute__((pointer_with_type_tag(unsigned1,1,2)));
-// CHECK: FunctionDecl{{.*}}TestUnsigned
-// CHECK: ArgumentWithTypeTagAttr{{.*}} pointer_with_type_tag unsigned1 1 2
-
-void TestInt(void) __attribute__((constructor(123)));
-// CHECK: FunctionDecl{{.*}}TestInt
-// CHECK-NEXT: ConstructorAttr{{.*}} 123
-
-static int TestString __attribute__((alias("alias1")));
-// CHECK: VarDecl{{.*}}TestString
-// CHECK-NEXT: AliasAttr{{.*}} "alias1"
-
-extern struct s1 TestType
-__attribute__((type_tag_for_datatype(ident1,int)));
-// CHECK: VarDecl{{.*}}TestType
-// CHECK-NEXT: TypeTagForDatatypeAttr{{.*}} int
-
-void TestLabel() {
-L: __attribute__((unused)) int i;
-// CHECK: LabelStmt{{.*}}'L'
-// CHECK: VarDecl{{.*}}i 'int'
-// CHECK-NEXT: UnusedAttr{{.*}}
-
-M: __attribute(()) int j;
-// CHECK: LabelStmt {{.*}} 'M'
-// CHECK-NEXT: DeclStmt
-// CHECK-NEXT: VarDecl {{.*}} j 'int'
-
-N: __attribute(()) ;
-// CHECK: LabelStmt {{.*}} 'N'
-// CHECK-NEXT: NullStmt
-}
-
-namespace Test {
-extern "C" int printf(const char *format, ...);
-// CHECK: FunctionDecl{{.*}}printf
-// CHECK-NEXT: ParmVarDecl{{.*}}format{{.*}}'const char *'
-// CHECK-NEXT: BuiltinAttr{{.*}}Implicit
-// CHECK-NEXT: FormatAttr{{.*}}Implicit printf 1 2
-
-alignas(8) extern int x;
-extern int x;
-// CHECK: VarDecl{{.*}} x 'int'
-// CHECK: VarDecl{{.*}} x 'int'
-// CHECK-NEXT: AlignedAttr{{.*}} Inherited
-}
-
-int __attribute__((cdecl)) TestOne(void), TestTwo(void);
-// CHECK: FunctionDecl{{.*}}TestOne{{.*}}__attribute__((cdecl))
-// CHECK: FunctionDecl{{.*}}TestTwo{{.*}}__attribute__((cdecl))
-
-void func() {
- auto Test = []() __attribute__((no_thread_safety_analysis)) {};
- // CHECK: CXXMethodDecl{{.*}}operator() 'void () const'
- // CHECK: NoThreadSafetyAnalysisAttr
-
- // Because GNU's noreturn applies to the function type, and this lambda does
- // not have a capture list, the call operator and the function pointer
- // conversion should both be noreturn, but the method should not contain a
- // NoReturnAttr because the attribute applied to the type.
- auto Test2 = []() __attribute__((noreturn)) { while(1); };
- // CHECK: CXXMethodDecl{{.*}}operator() 'void () __attribute__((noreturn)) const'
- // CHECK-NOT: NoReturnAttr
- // CHECK: CXXConversionDecl{{.*}}operator void (*)() __attribute__((noreturn))
-}
-
-namespace PR20930 {
-struct S {
- struct { int Test __attribute__((deprecated)); };
- // CHECK: FieldDecl{{.*}}Test 'int'
- // CHECK-NEXT: DeprecatedAttr
-};
-
-void f() {
- S s;
- s.Test = 1;
- // CHECK: IndirectFieldDecl{{.*}}Test 'int'
- // CHECK: DeprecatedAttr
-}
-}
-
-struct __attribute__((objc_bridge_related(NSParagraphStyle,,))) TestBridgedRef;
-// CHECK: CXXRecordDecl{{.*}} struct TestBridgedRef
-// CHECK-NEXT: ObjCBridgeRelatedAttr{{.*}} NSParagraphStyle
-
-void TestExternalSourceSymbolAttr1()
-__attribute__((external_source_symbol(language="Swift", defined_in="module", generated_declaration)));
-// CHECK: FunctionDecl{{.*}} TestExternalSourceSymbolAttr1
-// CHECK-NEXT: ExternalSourceSymbolAttr{{.*}} "Swift" "module" GeneratedDeclaration
-
-void TestExternalSourceSymbolAttr2()
-__attribute__((external_source_symbol(defined_in="module", language="Swift")));
-// CHECK: FunctionDecl{{.*}} TestExternalSourceSymbolAttr2
-// CHECK-NEXT: ExternalSourceSymbolAttr{{.*}} "Swift" "module"{{$}}
-
-void TestExternalSourceSymbolAttr3()
-__attribute__((external_source_symbol(generated_declaration, language="Objective-C++", defined_in="module")));
-// CHECK: FunctionDecl{{.*}} TestExternalSourceSymbolAttr3
-// CHECK-NEXT: ExternalSourceSymbolAttr{{.*}} "Objective-C++" "module" GeneratedDeclaration
-
-void TestExternalSourceSymbolAttr4()
-__attribute__((external_source_symbol(defined_in="Some external file.cs", generated_declaration, language="C Sharp")));
-// CHECK: FunctionDecl{{.*}} TestExternalSourceSymbolAttr4
-// CHECK-NEXT: ExternalSourceSymbolAttr{{.*}} "C Sharp" "Some external file.cs" GeneratedDeclaration
-
-void TestExternalSourceSymbolAttr5()
-__attribute__((external_source_symbol(generated_declaration, defined_in="module", language="Swift")));
-// CHECK: FunctionDecl{{.*}} TestExternalSourceSymbolAttr5
-// CHECK-NEXT: ExternalSourceSymbolAttr{{.*}} "Swift" "module" GeneratedDeclaration
-
-namespace TestNoEscape {
- void noescapeFunc(int *p0, __attribute__((noescape)) int *p1) {}
- // CHECK: `-FunctionDecl{{.*}} noescapeFunc 'void (int *, __attribute__((noescape)) int *)'
- // CHECK-NEXT: ParmVarDecl
- // CHECK-NEXT: ParmVarDecl
- // CHECK-NEXT: NoEscapeAttr
-}
-
-namespace TestSuppress {
- [[gsl::suppress("at-namespace")]];
- // CHECK: NamespaceDecl{{.*}} TestSuppress
- // CHECK-NEXT: EmptyDecl{{.*}}
- // CHECK-NEXT: SuppressAttr{{.*}} at-namespace
- [[gsl::suppress("on-decl")]]
- void TestSuppressFunction();
- // CHECK: FunctionDecl{{.*}} TestSuppressFunction
- // CHECK-NEXT: SuppressAttr{{.*}} on-decl
-
- void f() {
- int *i;
-
- [[gsl::suppress("on-stmt")]] {
- // CHECK: AttributedStmt
- // CHECK-NEXT: SuppressAttr{{.*}} on-stmt
- // CHECK-NEXT: CompoundStmt
- i = reinterpret_cast<int*>(7);
- }
- }
-}
-
-namespace TestLifetimeCategories {
-class [[gsl::Owner(int)]] AOwner{};
-// CHECK: CXXRecordDecl{{.*}} class AOwner
-// CHECK: OwnerAttr {{.*}} int
-class [[gsl::Pointer(int)]] APointer{};
-// CHECK: CXXRecordDecl{{.*}} class APointer
-// CHECK: PointerAttr {{.*}} int
-
-class [[gsl::Pointer]] PointerWithoutArgument{};
-// CHECK: CXXRecordDecl{{.*}} class PointerWithoutArgument
-// CHECK: PointerAttr
-
-class [[gsl::Owner]] OwnerWithoutArgument{};
-// CHECK: CXXRecordDecl{{.*}} class OwnerWithoutArgument
-// CHECK: OwnerAttr
-} // namespace TestLifetimeCategories
-
-// Verify the order of attributes in the Ast. It must reflect the order
-// in the parsed source.
-int mergeAttrTest() __attribute__((deprecated)) __attribute__((warn_unused_result));
-int mergeAttrTest() __attribute__((annotate("test")));
-int mergeAttrTest() __attribute__((unused,no_thread_safety_analysis));
-// CHECK: FunctionDecl{{.*}} mergeAttrTest
-// CHECK-NEXT: DeprecatedAttr
-// CHECK-NEXT: WarnUnusedResultAttr
-
-// CHECK: FunctionDecl{{.*}} mergeAttrTest
-// CHECK-NEXT: DeprecatedAttr{{.*}} Inherited
-// CHECK-NEXT: WarnUnusedResultAttr{{.*}} Inherited
-// CHECK-NEXT: AnnotateAttr{{.*}}
-
-// CHECK: FunctionDecl{{.*}} mergeAttrTest
-// CHECK-NEXT: DeprecatedAttr{{.*}} Inherited
-// CHECK-NEXT: WarnUnusedResultAttr{{.*}} Inherited
-// CHECK-NEXT: AnnotateAttr{{.*}} Inherited
-// CHECK-NEXT: UnusedAttr
-// CHECK-NEXT: NoThreadSafetyAnalysisAttr
+// Test without serialization:
+// RUN: %clang_cc1 -triple x86_64-pc-linux -std=c++11 -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 -std=c++11 -Wno-deprecated-declarations -emit-pch -o %t %s
+// RUN: %clang_cc1 -x c++ -triple x86_64-pc-linux -std=c++11 -Wno-deprecated-declarations \
+// RUN: -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 TestLocation
+__attribute__((unused));
+// CHECK: VarDecl{{.*}}TestLocation
+// CHECK-NEXT: UnusedAttr 0x{{[^ ]*}} <line:[[@LINE-2]]:16>
+
+int TestIndent
+__attribute__((unused));
+// CHECK: {{^}}VarDecl{{.*TestIndent[^()]*$}}
+// CHECK-NEXT: {{^}}`-UnusedAttr{{[^()]*$}}
+
+void TestAttributedStmt() {
+ switch (1) {
+ case 1:
+ [[clang::fallthrough]];
+ case 2:
+ ;
+ }
+}
+// CHECK: FunctionDecl{{.*}}TestAttributedStmt
+// CHECK: AttributedStmt
+// CHECK-NEXT: FallThroughAttr
+// CHECK-NEXT: NullStmt
+
+[[clang::warn_unused_result]] int TestCXX11DeclAttr();
+// CHECK: FunctionDecl{{.*}}TestCXX11DeclAttr
+// CHECK-NEXT: WarnUnusedResultAttr
+
+int TestAlignedNull __attribute__((aligned));
+// CHECK: VarDecl{{.*}}TestAlignedNull
+// CHECK-NEXT: AlignedAttr {{.*}} aligned
+// CHECK-NEXT: <<<NULL>>>
+
+int TestAlignedExpr __attribute__((aligned(4)));
+// CHECK: VarDecl{{.*}}TestAlignedExpr
+// CHECK-NEXT: AlignedAttr {{.*}} aligned
+// CHECK-NEXT: ConstantExpr
+// CHECK-NEXT: value: Int 4
+// CHECK-NEXT: IntegerLiteral
+
+int TestEnum __attribute__((visibility("default")));
+// CHECK: VarDecl{{.*}}TestEnum
+// CHECK-NEXT: VisibilityAttr{{.*}} Default
+
+class __attribute__((lockable)) Mutex {
+} mu1, mu2;
+int TestExpr __attribute__((guarded_by(mu1)));
+// CHECK: VarDecl{{.*}}TestExpr
+// CHECK-NEXT: GuardedByAttr
+// CHECK-NEXT: DeclRefExpr{{.*}}mu1
+
+class Mutex TestVariadicExpr __attribute__((acquired_after(mu1, mu2)));
+// CHECK: VarDecl{{.*}}TestVariadicExpr
+// CHECK: AcquiredAfterAttr
+// CHECK-NEXT: DeclRefExpr{{.*}}mu1
+// CHECK-NEXT: DeclRefExpr{{.*}}mu2
+
+void function1(void *) {
+ int TestFunction __attribute__((cleanup(function1)));
+}
+// CHECK: VarDecl{{.*}}TestFunction
+// CHECK-NEXT: CleanupAttr{{.*}} Function{{.*}}function1
+
+void TestIdentifier(void *, int)
+__attribute__((pointer_with_type_tag(ident1,1,2)));
+// CHECK: FunctionDecl{{.*}}TestIdentifier
+// CHECK: ArgumentWithTypeTagAttr{{.*}} pointer_with_type_tag ident1
+
+void TestBool(void *, int)
+__attribute__((pointer_with_type_tag(bool1,1,2)));
+// CHECK: FunctionDecl{{.*}}TestBool
+// CHECK: ArgumentWithTypeTagAttr{{.*}}pointer_with_type_tag bool1 1 2 IsPointer
+
+void TestUnsigned(void *, int)
+__attribute__((pointer_with_type_tag(unsigned1,1,2)));
+// CHECK: FunctionDecl{{.*}}TestUnsigned
+// CHECK: ArgumentWithTypeTagAttr{{.*}} pointer_with_type_tag unsigned1 1 2
+
+void TestInt(void) __attribute__((constructor(123)));
+// CHECK: FunctionDecl{{.*}}TestInt
+// CHECK-NEXT: ConstructorAttr{{.*}} 123
+
+static int TestString __attribute__((alias("alias1")));
+// CHECK: VarDecl{{.*}}TestString
+// CHECK-NEXT: AliasAttr{{.*}} "alias1"
+
+extern struct s1 TestType
+__attribute__((type_tag_for_datatype(ident1,int)));
+// CHECK: VarDecl{{.*}}TestType
+// CHECK-NEXT: TypeTagForDatatypeAttr{{.*}} int
+
+void TestLabel() {
+L: __attribute__((unused)) int i;
+// CHECK: LabelStmt{{.*}}'L'
+// CHECK: VarDecl{{.*}}i 'int'
+// CHECK-NEXT: UnusedAttr{{.*}}
+
+M: __attribute(()) int j;
+// CHECK: LabelStmt {{.*}} 'M'
+// CHECK-NEXT: DeclStmt
+// CHECK-NEXT: VarDecl {{.*}} j 'int'
+
+N: __attribute(()) ;
+// CHECK: LabelStmt {{.*}} 'N'
+// CHECK-NEXT: NullStmt
+}
+
+namespace Test {
+extern "C" int printf(const char *format, ...);
+// CHECK: FunctionDecl{{.*}}printf
+// CHECK-NEXT: ParmVarDecl{{.*}}format{{.*}}'const char *'
+// CHECK-NEXT: BuiltinAttr{{.*}}Implicit
+// CHECK-NEXT: FormatAttr{{.*}}Implicit printf 1 2
+
+alignas(8) extern int x;
+extern int x;
+// CHECK: VarDecl{{.*}} x 'int'
+// CHECK: VarDecl{{.*}} x 'int'
+// CHECK-NEXT: AlignedAttr{{.*}} Inherited
+}
+
+int __attribute__((cdecl)) TestOne(void), TestTwo(void);
+// CHECK: FunctionDecl{{.*}}TestOne{{.*}}__attribute__((cdecl))
+// CHECK: FunctionDecl{{.*}}TestTwo{{.*}}__attribute__((cdecl))
+
+void func() {
+ auto Test = []() __attribute__((no_thread_safety_analysis)) {};
+ // CHECK: CXXMethodDecl{{.*}}operator() 'void () const'
+ // CHECK: NoThreadSafetyAnalysisAttr
+
+ // Because GNU's noreturn applies to the function type, and this lambda does
+ // not have a capture list, the call operator and the function pointer
+ // conversion should both be noreturn, but the method should not contain a
+ // NoReturnAttr because the attribute applied to the type.
+ auto Test2 = []() __attribute__((noreturn)) { while(1); };
+ // CHECK: CXXMethodDecl{{.*}}operator() 'void () __attribute__((noreturn)) const'
+ // CHECK-NOT: NoReturnAttr
+ // CHECK: CXXConversionDecl{{.*}}operator void (*)() __attribute__((noreturn))
+}
+
+namespace PR20930 {
+struct S {
+ struct { int Test __attribute__((deprecated)); };
+ // CHECK: FieldDecl{{.*}}Test 'int'
+ // CHECK-NEXT: DeprecatedAttr
+};
+
+void f() {
+ S s;
+ s.Test = 1;
+ // CHECK: IndirectFieldDecl{{.*}}Test 'int'
+ // CHECK: DeprecatedAttr
+}
+}
+
+struct __attribute__((objc_bridge_related(NSParagraphStyle,,))) TestBridgedRef;
+// CHECK: CXXRecordDecl{{.*}} struct TestBridgedRef
+// CHECK-NEXT: ObjCBridgeRelatedAttr{{.*}} NSParagraphStyle
+
+void TestExternalSourceSymbolAttr1()
+__attribute__((external_source_symbol(language="Swift", defined_in="module", generated_declaration)));
+// CHECK: FunctionDecl{{.*}} TestExternalSourceSymbolAttr1
+// CHECK-NEXT: ExternalSourceSymbolAttr{{.*}} "Swift" "module" GeneratedDeclaration
+
+void TestExternalSourceSymbolAttr2()
+__attribute__((external_source_symbol(defined_in="module", language="Swift")));
+// CHECK: FunctionDecl{{.*}} TestExternalSourceSymbolAttr2
+// CHECK-NEXT: ExternalSourceSymbolAttr{{.*}} "Swift" "module"{{$}}
+
+void TestExternalSourceSymbolAttr3()
+__attribute__((external_source_symbol(generated_declaration, language="Objective-C++", defined_in="module")));
+// CHECK: FunctionDecl{{.*}} TestExternalSourceSymbolAttr3
+// CHECK-NEXT: ExternalSourceSymbolAttr{{.*}} "Objective-C++" "module" GeneratedDeclaration
+
+void TestExternalSourceSymbolAttr4()
+__attribute__((external_source_symbol(defined_in="Some external file.cs", generated_declaration, language="C Sharp")));
+// CHECK: FunctionDecl{{.*}} TestExternalSourceSymbolAttr4
+// CHECK-NEXT: ExternalSourceSymbolAttr{{.*}} "C Sharp" "Some external file.cs" GeneratedDeclaration
+
+void TestExternalSourceSymbolAttr5()
+__attribute__((external_source_symbol(generated_declaration, defined_in="module", language="Swift")));
+// CHECK: FunctionDecl{{.*}} TestExternalSourceSymbolAttr5
+// CHECK-NEXT: ExternalSourceSymbolAttr{{.*}} "Swift" "module" GeneratedDeclaration
+
+namespace TestNoEscape {
+ void noescapeFunc(int *p0, __attribute__((noescape)) int *p1) {}
+ // CHECK: `-FunctionDecl{{.*}} noescapeFunc 'void (int *, __attribute__((noescape)) int *)'
+ // CHECK-NEXT: ParmVarDecl
+ // CHECK-NEXT: ParmVarDecl
+ // CHECK-NEXT: NoEscapeAttr
+}
+
+namespace TestSuppress {
+ [[gsl::suppress("at-namespace")]];
+ // CHECK: NamespaceDecl{{.*}} TestSuppress
+ // CHECK-NEXT: EmptyDecl{{.*}}
+ // CHECK-NEXT: SuppressAttr{{.*}} at-namespace
+ [[gsl::suppress("on-decl")]]
+ void TestSuppressFunction();
+ // CHECK: FunctionDecl{{.*}} TestSuppressFunction
+ // CHECK-NEXT: SuppressAttr{{.*}} on-decl
+
+ void f() {
+ int *i;
+
+ [[gsl::suppress("on-stmt")]] {
+ // CHECK: AttributedStmt
+ // CHECK-NEXT: SuppressAttr{{.*}} on-stmt
+ // CHECK-NEXT: CompoundStmt
+ i = reinterpret_cast<int*>(7);
+ }
+ }
+}
+
+namespace TestLifetimeCategories {
+class [[gsl::Owner(int)]] AOwner{};
+// CHECK: CXXRecordDecl{{.*}} class AOwner
+// CHECK: OwnerAttr {{.*}} int
+class [[gsl::Pointer(int)]] APointer{};
+// CHECK: CXXRecordDecl{{.*}} class APointer
+// CHECK: PointerAttr {{.*}} int
+
+class [[gsl::Pointer]] PointerWithoutArgument{};
+// CHECK: CXXRecordDecl{{.*}} class PointerWithoutArgument
+// CHECK: PointerAttr
+
+class [[gsl::Owner]] OwnerWithoutArgument{};
+// CHECK: CXXRecordDecl{{.*}} class OwnerWithoutArgument
+// CHECK: OwnerAttr
+} // namespace TestLifetimeCategories
+
+// Verify the order of attributes in the Ast. It must reflect the order
+// in the parsed source.
+int mergeAttrTest() __attribute__((deprecated)) __attribute__((warn_unused_result));
+int mergeAttrTest() __attribute__((annotate("test")));
+int mergeAttrTest() __attribute__((unused,no_thread_safety_analysis));
+// CHECK: FunctionDecl{{.*}} mergeAttrTest
+// CHECK-NEXT: DeprecatedAttr
+// CHECK-NEXT: WarnUnusedResultAttr
+
+// CHECK: FunctionDecl{{.*}} mergeAttrTest
+// CHECK-NEXT: DeprecatedAttr{{.*}} Inherited
+// CHECK-NEXT: WarnUnusedResultAttr{{.*}} Inherited
+// CHECK-NEXT: AnnotateAttr{{.*}}
+
+// CHECK: FunctionDecl{{.*}} mergeAttrTest
+// CHECK-NEXT: DeprecatedAttr{{.*}} Inherited
+// CHECK-NEXT: WarnUnusedResultAttr{{.*}} Inherited
+// CHECK-NEXT: AnnotateAttr{{.*}} Inherited
+// CHECK-NEXT: UnusedAttr
+// CHECK-NEXT: NoThreadSafetyAnalysisAttr
diff --git a/clang/test/AST/ast-dump-attr.m b/clang/test/AST/ast-dump-attr.m
index c7b133df332a0..c4a769d85e55c 100644
--- a/clang/test/AST/ast-dump-attr.m
+++ b/clang/test/AST/ast-dump-attr.m
@@ -1,68 +1,68 @@
-// Test without serialization:
-// RUN: %clang_cc1 -fdouble-square-bracket-attributes -triple x86_64-apple-macosx10.10.0 \
-// RUN: -ast-dump -ast-dump-filter Test %s \
-// RUN: | FileCheck --strict-whitespace %s
-//
-// Test with serialization:
-// RUN: %clang_cc1 -fdouble-square-bracket-attributes -triple x86_64-apple-macosx10.10.0 \
-// RUN: -emit-pch -o %t %s
-// RUN: %clang_cc1 -x objective-c -fdouble-square-bracket-attributes -triple x86_64-apple-macosx10.10.0 \
-// RUN: -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
-
- at interface NSObject
- at end
-
-[[clang::objc_exception]]
- at interface Test1 {
-// CHECK: ObjCInterfaceDecl{{.*}} Test1
-// CHECK-NEXT: ObjCExceptionAttr{{.*}}
- [[clang::iboutlet]] NSObject *Test2;
-// CHECK: ObjCIvarDecl{{.*}} Test2
-// CHECK-NEXT: IBOutletAttr
-}
- at property (readonly) [[clang::objc_returns_inner_pointer]] void *Test3, *Test4;
-// CHECK: ObjCPropertyDecl{{.*}} Test3 'void *' readonly
-// CHECK-NEXT: ObjCReturnsInnerPointerAttr
-// CHECK-NEXT: ObjCPropertyDecl{{.*}} Test4 'void *' readonly
-// CHECK-NEXT: ObjCReturnsInnerPointerAttr
-
- at property (readonly) [[clang::iboutlet]] NSObject *Test5;
-// CHECK: ObjCPropertyDecl{{.*}} Test5 'NSObject *' readonly
-// CHECK-NEXT: IBOutletAttr
-
-// CHECK: ObjCMethodDecl{{.*}} implicit{{.*}} Test3
-// CHECK-NEXT: ObjCReturnsInnerPointerAttr
-// CHECK: ObjCMethodDecl{{.*}} implicit{{.*}} Test4
-// CHECK-NEXT: ObjCReturnsInnerPointerAttr
-// CHECK: ObjCMethodDecl{{.*}} implicit{{.*}} Test5
-// CHECK-NOT: IBOutletAttr
- at end
-
-[[clang::objc_runtime_name("name")]] @protocol Test6;
-// CHECK: ObjCProtocolDecl{{.*}} Test6
-// CHECK-NEXT: ObjCRuntimeNameAttr{{.*}} "name"
-
-[[clang::objc_protocol_requires_explicit_implementation]]
- at protocol Test7
-// CHECK: ObjCProtocolDecl{{.*}} Test7
-// CHECK-NEXT: ObjCExplicitProtocolImplAttr
- at end
-
- at interface Test8
-// CHECK: ObjCInterfaceDecl{{.*}} Test8
--(void)Test9 [[clang::ns_consumes_self]];
-// CHECK: ObjCMethodDecl{{.*}} Test9 'void'
-// CHECK-NEXT: NSConsumesSelfAttr
--(void) [[clang::ns_consumes_self]] Test10: (int)Test11;
-// CHECK: ObjCMethodDecl{{.*}} Test10: 'void'
-// CHECK-NEXT: |-ParmVarDecl{{.*}} Test11 'int'
-// CHECK-NEXT: `-NSConsumesSelfAttr
--(void)Test12: (int *) [[clang::noescape]] Test13 to:(int)Test14 [[clang::ns_consumes_self]];
-// CHECK: ObjCMethodDecl{{.*}} Test12:to: 'void'
-// CHECK-NEXT: |-ParmVarDecl{{.*}} Test13 'int *'
-// CHECK-NEXT: | `-NoEscapeAttr
-// CHECK-NEXT: |-ParmVarDecl{{.*}} Test14 'int'
-// CHECK-NEXT: `-NSConsumesSelfAttr
- at end
+// Test without serialization:
+// RUN: %clang_cc1 -fdouble-square-bracket-attributes -triple x86_64-apple-macosx10.10.0 \
+// RUN: -ast-dump -ast-dump-filter Test %s \
+// RUN: | FileCheck --strict-whitespace %s
+//
+// Test with serialization:
+// RUN: %clang_cc1 -fdouble-square-bracket-attributes -triple x86_64-apple-macosx10.10.0 \
+// RUN: -emit-pch -o %t %s
+// RUN: %clang_cc1 -x objective-c -fdouble-square-bracket-attributes -triple x86_64-apple-macosx10.10.0 \
+// RUN: -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
+
+ at interface NSObject
+ at end
+
+[[clang::objc_exception]]
+ at interface Test1 {
+// CHECK: ObjCInterfaceDecl{{.*}} Test1
+// CHECK-NEXT: ObjCExceptionAttr{{.*}}
+ [[clang::iboutlet]] NSObject *Test2;
+// CHECK: ObjCIvarDecl{{.*}} Test2
+// CHECK-NEXT: IBOutletAttr
+}
+ at property (readonly) [[clang::objc_returns_inner_pointer]] void *Test3, *Test4;
+// CHECK: ObjCPropertyDecl{{.*}} Test3 'void *' readonly
+// CHECK-NEXT: ObjCReturnsInnerPointerAttr
+// CHECK-NEXT: ObjCPropertyDecl{{.*}} Test4 'void *' readonly
+// CHECK-NEXT: ObjCReturnsInnerPointerAttr
+
+ at property (readonly) [[clang::iboutlet]] NSObject *Test5;
+// CHECK: ObjCPropertyDecl{{.*}} Test5 'NSObject *' readonly
+// CHECK-NEXT: IBOutletAttr
+
+// CHECK: ObjCMethodDecl{{.*}} implicit{{.*}} Test3
+// CHECK-NEXT: ObjCReturnsInnerPointerAttr
+// CHECK: ObjCMethodDecl{{.*}} implicit{{.*}} Test4
+// CHECK-NEXT: ObjCReturnsInnerPointerAttr
+// CHECK: ObjCMethodDecl{{.*}} implicit{{.*}} Test5
+// CHECK-NOT: IBOutletAttr
+ at end
+
+[[clang::objc_runtime_name("name")]] @protocol Test6;
+// CHECK: ObjCProtocolDecl{{.*}} Test6
+// CHECK-NEXT: ObjCRuntimeNameAttr{{.*}} "name"
+
+[[clang::objc_protocol_requires_explicit_implementation]]
+ at protocol Test7
+// CHECK: ObjCProtocolDecl{{.*}} Test7
+// CHECK-NEXT: ObjCExplicitProtocolImplAttr
+ at end
+
+ at interface Test8
+// CHECK: ObjCInterfaceDecl{{.*}} Test8
+-(void)Test9 [[clang::ns_consumes_self]];
+// CHECK: ObjCMethodDecl{{.*}} Test9 'void'
+// CHECK-NEXT: NSConsumesSelfAttr
+-(void) [[clang::ns_consumes_self]] Test10: (int)Test11;
+// CHECK: ObjCMethodDecl{{.*}} Test10: 'void'
+// CHECK-NEXT: |-ParmVarDecl{{.*}} Test11 'int'
+// CHECK-NEXT: `-NSConsumesSelfAttr
+-(void)Test12: (int *) [[clang::noescape]] Test13 to:(int)Test14 [[clang::ns_consumes_self]];
+// CHECK: ObjCMethodDecl{{.*}} Test12:to: 'void'
+// CHECK-NEXT: |-ParmVarDecl{{.*}} Test13 'int *'
+// CHECK-NEXT: | `-NoEscapeAttr
+// CHECK-NEXT: |-ParmVarDecl{{.*}} Test14 'int'
+// CHECK-NEXT: `-NSConsumesSelfAttr
+ at end
diff --git a/clang/test/AST/ast-dump-c-attr.c b/clang/test/AST/ast-dump-c-attr.c
index 1f28501f1bb02..f1d76deeb472d 100644
--- a/clang/test/AST/ast-dump-c-attr.c
+++ b/clang/test/AST/ast-dump-c-attr.c
@@ -1,54 +1,54 @@
-// Test without serialization:
-// RUN: %clang_cc1 -triple x86_64-pc-linux -fdouble-square-bracket-attributes \
-// 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 -fdouble-square-bracket-attributes \
-// RUN: -Wno-deprecated-declarations -emit-pch -o %t %s
-// RUN: %clang_cc1 -x c -triple x86_64-pc-linux -fdouble-square-bracket-attributes \
-// 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> "" ""
+// Test without serialization:
+// RUN: %clang_cc1 -triple x86_64-pc-linux -fdouble-square-bracket-attributes \
+// 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 -fdouble-square-bracket-attributes \
+// RUN: -Wno-deprecated-declarations -emit-pch -o %t %s
+// RUN: %clang_cc1 -x c -triple x86_64-pc-linux -fdouble-square-bracket-attributes \
+// 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> "" ""
diff --git a/clang/test/AST/ast-dump-decl.cpp b/clang/test/AST/ast-dump-decl.cpp
index 97bb7964c47b8..0ff947ae3b483 100644
--- a/clang/test/AST/ast-dump-decl.cpp
+++ b/clang/test/AST/ast-dump-decl.cpp
@@ -1,806 +1,806 @@
-// Test without serialization:
-// RUN: %clang_cc1 -std=c++11 -triple x86_64-linux-gnu -fms-extensions \
-// RUN: -ast-dump -ast-dump-filter Test %s \
-// RUN: | FileCheck --strict-whitespace %s
-//
-// Test with serialization: FIXME: Find why the outputs
diff ers and fix it!
-// : %clang_cc1 -std=c++11 -triple x86_64-linux-gnu -fms-extensions -emit-pch -o %t %s
-// : %clang_cc1 -x c++ -std=c++11 -triple x86_64-linux-gnu -fms-extensions -include-pch %t \
-// : -ast-dump-all -ast-dump-filter Test /dev/null \
-// : | sed -e "s/ <undeserialized declarations>//" -e "s/ imported//" \
-// : | FileCheck --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 '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 TestEmpty {};
-// CHECK: CXXRecordDecl{{.*}} class TestEmpty
-// CHECK-NEXT: DefinitionData pass_in_registers empty aggregate standard_layout trivially_copyable pod trivial literal has_constexpr_non_copy_move_ctor can_const_default_init
-// CHECK-NEXT: DefaultConstructor exists trivial constexpr
-// CHECK-NEXT: CopyConstructor simple trivial has_const_param
-// CHECK-NEXT: MoveConstructor exists simple trivial
-// CHECK-NEXT: CopyAssignment simple trivial has_const_param
-// CHECK-NEXT: MoveAssignment exists simple trivial
-// CHECK-NEXT: Destructor simple irrelevant trivial
-
- class A { };
- class B { };
- class TestCXXRecordDecl : virtual A, public B {
- int i;
- };
-}
-// CHECK: CXXRecordDecl{{.*}} class TestCXXRecordDecl
-// CHECK-NEXT: DefinitionData{{$}}
-// CHECK-NEXT: DefaultConstructor exists non_trivial
-// CHECK-NEXT: CopyConstructor simple non_trivial has_const_param
-// CHECK-NEXT: MoveConstructor exists simple non_trivial
-// CHECK-NEXT: CopyAssignment simple non_trivial has_const_param
-// CHECK-NEXT: MoveAssignment exists simple non_trivial
-// CHECK-NEXT: Destructor simple irrelevant trivial
-// CHECK-NEXT: virtual private 'testCXXRecordDecl::A'
-// CHECK-NEXT: public 'testCXXRecordDecl::B'
-// CHECK-NEXT: CXXRecordDecl{{.*}} class TestCXXRecordDecl
-// CHECK-NEXT: FieldDecl
-
-template<class...T>
-class TestCXXRecordDeclPack : public T... {
-};
-// CHECK: CXXRecordDecl{{.*}} class TestCXXRecordDeclPack
-// CHECK: public 'T'...
-// CHECK-NEXT: CXXRecordDecl{{.*}} class TestCXXRecordDeclPack
-
-thread_local int TestThreadLocalInt;
-// CHECK: TestThreadLocalInt {{.*}} tls_dynamic
-
-class testCXXMethodDecl {
- virtual void TestCXXMethodDeclPure() = 0;
- void TestCXXMethodDeclDelete() = delete;
- void TestCXXMethodDeclThrow() throw();
- void TestCXXMethodDeclThrowType() throw(int);
-};
-// CHECK: CXXMethodDecl{{.*}} TestCXXMethodDeclPure 'void ()' virtual pure
-// CHECK: CXXMethodDecl{{.*}} TestCXXMethodDeclDelete 'void ()' delete
-// CHECK: CXXMethodDecl{{.*}} TestCXXMethodDeclThrow 'void () throw()'
-// CHECK: CXXMethodDecl{{.*}} TestCXXMethodDeclThrowType 'void () throw(int)'
-
-namespace testCXXConstructorDecl {
- class A { };
- class TestCXXConstructorDecl : public A {
- int I;
- TestCXXConstructorDecl(A &a, int i) : A(a), I(i) { }
- TestCXXConstructorDecl(A &a) : TestCXXConstructorDecl(a, 0) { }
- };
-}
-// 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
-// CHECK: CXXConstructorDecl{{.*}} TestCXXConstructorDecl 'void {{.*}}'
-// CHECK-NEXT: ParmVarDecl{{.*}} a
-// CHECK-NEXT: CXXCtorInitializer{{.*}}TestCXXConstructorDecl
-// CHECK-NEXT: CXXConstructExpr{{.*}}TestCXXConstructorDecl
-
-class TestCXXDestructorDecl {
- ~TestCXXDestructorDecl() { }
-};
-// CHECK: CXXDestructorDecl{{.*}} ~TestCXXDestructorDecl 'void () noexcept'
-// CHECK-NEXT: CompoundStmt
-
-// Test that the range of a defaulted members is computed correctly.
-class TestMemberRanges {
-public:
- TestMemberRanges() = default;
- TestMemberRanges(const TestMemberRanges &Other) = default;
- TestMemberRanges(TestMemberRanges &&Other) = default;
- ~TestMemberRanges() = default;
- TestMemberRanges &operator=(const TestMemberRanges &Other) = default;
- TestMemberRanges &operator=(TestMemberRanges &&Other) = default;
-};
-void SomeFunction() {
- TestMemberRanges A;
- TestMemberRanges B(A);
- B = A;
- A = static_cast<TestMemberRanges &&>(B);
- TestMemberRanges C(static_cast<TestMemberRanges &&>(A));
-}
-// CHECK: CXXConstructorDecl{{.*}} <line:{{.*}}:3, col:30>
-// CHECK: CXXConstructorDecl{{.*}} <line:{{.*}}:3, col:59>
-// CHECK: CXXConstructorDecl{{.*}} <line:{{.*}}:3, col:54>
-// CHECK: CXXDestructorDecl{{.*}} <line:{{.*}}:3, col:31>
-// CHECK: CXXMethodDecl{{.*}} <line:{{.*}}:3, col:70>
-// CHECK: CXXMethodDecl{{.*}} <line:{{.*}}:3, col:65>
-
-class TestCXXConversionDecl {
- operator int() { return 0; }
-};
-// CHECK: CXXConversionDecl{{.*}} operator int 'int ()'
-// 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 0x{{.+}} <{{.+}}:[[@LINE-14]]:3, col:55> col:29 TestFunctionTemplate
- // CHECK-NEXT: |-TemplateTypeParmDecl 0x{{.+}} <col:12, col:21> col:21 referenced typename depth 0 index 0 T
- // CHECK-NEXT: |-FunctionDecl 0x{{.+}} <col:24, col:55> col:29 TestFunctionTemplate 'void (T)'
- // CHECK-NEXT: | |-ParmVarDecl 0x{{.+}} <col:50> col:51 'T'
- // CHECK-NEXT: | `-CompoundStmt 0x{{.+}} <col:53, col:55>
- // CHECK-NEXT: |-FunctionDecl 0x{{.+}} <col:24, col:55> col:29 used TestFunctionTemplate 'void (testFunctionTemplateDecl::A)'
- // CHECK-NEXT: | |-TemplateArgument type 'testFunctionTemplateDecl::A'
- // CHECK-NEXT: | | `-RecordType 0{{.+}} 'testFunctionTemplateDecl::A'
- // CHECK-NEXT: | | `-CXXRecord 0x{{.+}} 'A'
- // CHECK-NEXT: | |-ParmVarDecl 0x{{.+}} <col:50> col:51 'testFunctionTemplateDecl::A':'testFunctionTemplateDecl::A'
- // CHECK-NEXT: | `-CompoundStmt 0x{{.+}} <col:53, col:55>
- // CHECK-NEXT: |-Function 0x{{.+}} 'TestFunctionTemplate' 'void (testFunctionTemplateDecl::B)'
- // CHECK-NEXT: |-FunctionDecl 0x{{.+}} <col:24, col:55> col:29 TestFunctionTemplate 'void (testFunctionTemplateDecl::C)'
- // CHECK-NEXT: | |-TemplateArgument type 'testFunctionTemplateDecl::C'
- // CHECK-NEXT: | | `-RecordType 0{{.+}} 'testFunctionTemplateDecl::C'
- // CHECK-NEXT: | | `-CXXRecord 0x{{.+}} 'C'
- // CHECK-NEXT: | `-ParmVarDecl 0x{{.+}} <col:50> col:51 'testFunctionTemplateDecl::C':'testFunctionTemplateDecl::C'
- // CHECK-NEXT: `-FunctionDecl 0x{{.+}} <col:24, col:55> col:29 TestFunctionTemplate 'void (testFunctionTemplateDecl::D)'
- // CHECK-NEXT: |-TemplateArgument type 'testFunctionTemplateDecl::D'
- // CHECK-NEXT: | `-RecordType 0{{.+}} 'testFunctionTemplateDecl::D'
- // CHECK-NEXT: | `-CXXRecord 0x{{.+}} 'D'
- // CHECK-NEXT: |-ParmVarDecl 0x{{.+}} <col:50> col:51 'testFunctionTemplateDecl::D':'testFunctionTemplateDecl::D'
- // CHECK-NEXT: `-CompoundStmt 0x{{.+}} <col:53, col:55>
-
- // CHECK: FunctionDecl 0x{{.+}} prev 0x{{.+}} <{{.+}}:[[@LINE-32]]:3, col:41> col:19 TestFunctionTemplate 'void (testFunctionTemplateDecl::B)'
- // CHECK-NEXT: |-TemplateArgument type 'testFunctionTemplateDecl::B'
- // CHECK-NEXT: | `-RecordType 0{{.+}} 'testFunctionTemplateDecl::B'
- // CHECK-NEXT: | `-CXXRecord 0x{{.+}} 'B'
- // CHECK-NEXT: `-ParmVarDecl 0x{{.+}} <col:40> col:41 'testFunctionTemplateDecl::B'
-
-
-namespace testClassTemplateDecl {
- class A { };
- class B { };
- class C { };
- class D { };
-
- template<typename T> class TestClassTemplate {
- public:
- TestClassTemplate();
- ~TestClassTemplate();
- int j();
- 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;
- };
-
- template<typename T = int> struct TestTemplateDefaultType;
- template<typename T> struct TestTemplateDefaultType { };
-
- template<int I = 42> struct TestTemplateDefaultNonType;
- template<int I> struct TestTemplateDefaultNonType { };
-
- template<template<typename> class TT = TestClassTemplate> struct TestTemplateTemplateDefaultType;
- template<template<typename> class TT> struct TestTemplateTemplateDefaultType { };
-}
-
-// CHECK: ClassTemplateDecl 0x{{.+}} <{{.+}}:[[@LINE-40]]:3, line:[[@LINE-34]]:3> line:[[@LINE-40]]:30 TestClassTemplate
-// CHECK-NEXT: |-TemplateTypeParmDecl 0x{{.+}} <col:12, col:21> col:21 typename depth 0 index 0 T
-// CHECK-NEXT: |-CXXRecordDecl 0x{{.+}} <col:24, line:[[@LINE-36]]:3> line:[[@LINE-42]]:30 class TestClassTemplate definition
-// CHECK-NEXT: | |-DefinitionData standard_layout has_user_declared_ctor can_const_default_init
-// CHECK-NEXT: | | |-DefaultConstructor exists non_trivial user_provided
-// CHECK-NEXT: | | |-CopyConstructor simple trivial has_const_param needs_implicit implicit_has_const_param
-// CHECK-NEXT: | | |-MoveConstructor
-// CHECK-NEXT: | | |-CopyAssignment simple trivial has_const_param needs_implicit implicit_has_const_param
-// CHECK-NEXT: | | |-MoveAssignment
-// CHECK-NEXT: | | `-Destructor non_trivial user_declared
-// CHECK-NEXT: | |-CXXRecordDecl 0x{{.+}} <col:24, col:30> col:30 implicit referenced class TestClassTemplate
-// CHECK-NEXT: | |-AccessSpecDecl 0x{{.+}} <line:[[@LINE-50]]:3, col:9> col:3 public
-// CHECK-NEXT: | |-CXXConstructorDecl 0x{{.+}} <line:[[@LINE-50]]:5, col:23> col:5 TestClassTemplate<T> 'void ()'
-// CHECK-NEXT: | |-CXXDestructorDecl 0x{{.+}} <line:[[@LINE-50]]:5, col:24> col:5 ~TestClassTemplate<T> 'void ()'
-// CHECK-NEXT: | |-CXXMethodDecl 0x{{.+}} <line:[[@LINE-50]]:5, col:11> col:9 j 'int ()'
-// CHECK-NEXT: | `-FieldDecl 0x{{.+}} <line:[[@LINE-50]]:5, col:9> col:9 i 'int'
-// CHECK-NEXT: |-ClassTemplateSpecializationDecl 0x{{.+}} <line:[[@LINE-56]]:3, line:[[@LINE-50]]:3> line:[[@LINE-56]]:30 class TestClassTemplate definition
-// CHECK-NEXT: | |-DefinitionData standard_layout has_user_declared_ctor can_const_default_init
-// CHECK-NEXT: | | |-DefaultConstructor exists non_trivial user_provided
-// CHECK-NEXT: | | |-CopyConstructor simple trivial has_const_param implicit_has_const_param
-// CHECK-NEXT: | | |-MoveConstructor
-// CHECK-NEXT: | | |-CopyAssignment simple trivial has_const_param needs_implicit implicit_has_const_param
-// CHECK-NEXT: | | |-MoveAssignment
-// CHECK-NEXT: | | `-Destructor non_trivial user_declared
-// CHECK-NEXT: | |-TemplateArgument type 'testClassTemplateDecl::A'
-// CHECK-NEXT: | | `-RecordType 0{{.+}} 'testClassTemplateDecl::A'
-// CHECK-NEXT: | | `-CXXRecord 0x{{.+}} 'A'
-// CHECK-NEXT: | |-CXXRecordDecl 0x{{.+}} prev 0x{{.+}} <col:24, col:30> col:30 implicit class TestClassTemplate
-// CHECK-NEXT: | |-AccessSpecDecl 0x{{.+}} <line:[[@LINE-67]]:3, col:9> col:3 public
-// CHECK-NEXT: | |-CXXConstructorDecl 0x{{.+}} <line:[[@LINE-67]]:5, col:23> col:5 used TestClassTemplate 'void ()'
-// CHECK-NEXT: | |-CXXDestructorDecl 0x{{.+}} <line:[[@LINE-67]]:5, col:24> col:5 used ~TestClassTemplate 'void () noexcept'
-// CHECK-NEXT: | |-CXXMethodDecl 0x{{.+}} <line:[[@LINE-67]]:5, col:11> col:9 j 'int ()'
-// CHECK-NEXT: | |-FieldDecl 0x{{.+}} <line:[[@LINE-67]]:5, col:9> col:9 i 'int'
-// CHECK-NEXT: | `-CXXConstructorDecl 0x{{.+}} <line:[[@LINE-73]]:30> col:30 implicit constexpr TestClassTemplate 'void (const testClassTemplateDecl::TestClassTemplate<testClassTemplateDecl::A> &)' inline default trivial noexcept-unevaluated 0x{{.+}}
-// CHECK-NEXT: | `-ParmVarDecl 0x{{.+}} <col:30> col:30 'const testClassTemplateDecl::TestClassTemplate<testClassTemplateDecl::A> &'
-// CHECK-NEXT: |-ClassTemplateSpecialization 0x{{.+}} 'TestClassTemplate'
-// CHECK-NEXT: |-ClassTemplateSpecialization 0x{{.+}} 'TestClassTemplate'
-// CHECK-NEXT: `-ClassTemplateSpecialization 0x{{.+}} 'TestClassTemplate'
-
-// CHECK: ClassTemplateSpecializationDecl 0x{{.+}} <{{.+}}:[[@LINE-67]]:3, line:[[@LINE-65]]:3> line:[[@LINE-67]]:20 class TestClassTemplate definition
-// CHECK-NEXT: |-DefinitionData pass_in_registers standard_layout trivially_copyable trivial literal
-// CHECK-NEXT: | |-DefaultConstructor exists trivial needs_implicit
-// CHECK-NEXT: | |-CopyConstructor simple trivial has_const_param needs_implicit implicit_has_const_param
-// CHECK-NEXT: | |-MoveConstructor exists simple trivial needs_implicit
-// CHECK-NEXT: | |-CopyAssignment simple trivial has_const_param needs_implicit implicit_has_const_param
-// CHECK-NEXT: | |-MoveAssignment exists simple trivial needs_implicit
-// CHECK-NEXT: | `-Destructor simple irrelevant trivial needs_implicit
-// CHECK-NEXT: |-TemplateArgument type 'testClassTemplateDecl::B'
-// CHECK-NEXT: | `-RecordType 0{{.+}} 'testClassTemplateDecl::B'
-// CHECK-NEXT: | `-CXXRecord 0x{{.+}} 'B'
-// CHECK-NEXT: |-CXXRecordDecl 0x{{.+}} <col:14, col:20> col:20 implicit class TestClassTemplate
-// CHECK-NEXT: `-FieldDecl 0x{{.+}} <line:[[@LINE-78]]:5, col:9> col:9 j 'int'
-
-// CHECK: ClassTemplateSpecializationDecl 0x{{.+}} <{{.+}}:{{.*}}:3, col:44> col:25 class TestClassTemplate definition
-// CHECK-NEXT: |-DefinitionData standard_layout has_user_declared_ctor can_const_default_init
-// CHECK-NEXT: | |-DefaultConstructor exists non_trivial user_provided
-// CHECK-NEXT: | |-CopyConstructor simple trivial has_const_param needs_implicit implicit_has_const_param
-// CHECK-NEXT: | |-MoveConstructor
-// CHECK-NEXT: | |-CopyAssignment simple trivial has_const_param needs_implicit implicit_has_const_param
-// CHECK-NEXT: | |-MoveAssignment
-// CHECK-NEXT: | `-Destructor non_trivial user_declared
-// CHECK-NEXT: |-TemplateArgument type 'testClassTemplateDecl::C'
-// CHECK-NEXT: | `-RecordType 0{{.+}} 'testClassTemplateDecl::C'
-// CHECK-NEXT: | `-CXXRecord 0x{{.+}} 'C'
-// CHECK-NEXT: |-CXXRecordDecl 0x{{.+}} prev 0x{{.+}} <line:[[@LINE-104]]:24, col:30> col:30 implicit class TestClassTemplate
-// CHECK-NEXT: |-AccessSpecDecl 0x{{.+}} <line:[[@LINE-104]]:3, col:9> col:3 public
-// CHECK-NEXT: |-CXXConstructorDecl 0x{{.+}} <line:[[@LINE-104]]:5, col:23> col:5 TestClassTemplate 'void ()'
-// CHECK-NEXT: |-CXXDestructorDecl 0x{{.+}} <line:[[@LINE-104]]:5, col:24> col:5 ~TestClassTemplate 'void ()' noexcept-unevaluated 0x{{.+}}
-// CHECK-NEXT: |-CXXMethodDecl 0x{{.+}} <line:[[@LINE-104]]:5, col:11> col:9 j 'int ()'
-// CHECK-NEXT: `-FieldDecl 0x{{.+}} <line:[[@LINE-104]]:5, col:9> col:9 i 'int'
-
-// CHECK: ClassTemplateSpecializationDecl 0x{{.+}} <{{.+}}:[[@LINE-91]]:3, col:37> col:18 class TestClassTemplate definition
-// CHECK-NEXT: |-DefinitionData standard_layout has_user_declared_ctor can_const_default_init
-// CHECK-NEXT: | |-DefaultConstructor exists non_trivial user_provided
-// CHECK-NEXT: | |-CopyConstructor simple trivial has_const_param needs_implicit implicit_has_const_param
-// CHECK-NEXT: | |-MoveConstructor
-// CHECK-NEXT: | |-CopyAssignment simple trivial has_const_param needs_implicit implicit_has_const_param
-// CHECK-NEXT: | |-MoveAssignment
-// CHECK-NEXT: | `-Destructor non_trivial user_declared
-// CHECK-NEXT: |-TemplateArgument type 'testClassTemplateDecl::D'
-// CHECK-NEXT: | `-RecordType 0{{.+}} 'testClassTemplateDecl::D'
-// CHECK-NEXT: | `-CXXRecord 0x{{.+}} 'D'
-// CHECK-NEXT: |-CXXRecordDecl 0x{{.+}} prev 0x{{.+}} <line:[[@LINE-122]]:24, col:30> col:30 implicit class TestClassTemplate
-// CHECK-NEXT: |-AccessSpecDecl 0x{{.+}} <line:[[@LINE-122]]:3, col:9> col:3 public
-// CHECK-NEXT: |-CXXConstructorDecl 0x{{.+}} <line:[[@LINE-122]]:5, col:23> col:5 TestClassTemplate 'void ()'
-// CHECK-NEXT: |-CXXDestructorDecl 0x{{.+}} <line:[[@LINE-122]]:5, col:24> col:5 ~TestClassTemplate 'void ()' noexcept-unevaluated 0x{{.+}}
-// CHECK-NEXT: |-CXXMethodDecl 0x{{.+}} <line:[[@LINE-122]]:5, col:11> col:9 j 'int ()'
-// CHECK-NEXT: `-FieldDecl 0x{{.+}} <line:[[@LINE-122]]:5, col:9> col:9 i 'int'
-
-// CHECK: ClassTemplateDecl 0x{{.+}} <{{.+}}:[[@LINE-106]]:3, line:[[@LINE-104]]:3> line:[[@LINE-106]]:44 TestClassTemplatePartial
-// CHECK-NEXT: |-TemplateTypeParmDecl 0x{{.+}} <col:12, col:21> col:21 typename depth 0 index 0 T1
-// CHECK-NEXT: |-TemplateTypeParmDecl 0x{{.+}} <col:25, col:34> col:34 typename depth 0 index 1 T2
-// CHECK-NEXT: `-CXXRecordDecl 0x{{.+}} <col:38, line:[[@LINE-107]]:3> line:[[@LINE-109]]:44 class TestClassTemplatePartial definition
-// CHECK-NEXT: |-DefinitionData standard_layout trivially_copyable trivial literal
-// CHECK-NEXT: | |-DefaultConstructor exists trivial needs_implicit
-// CHECK-NEXT: | |-CopyConstructor simple trivial has_const_param needs_implicit implicit_has_const_param
-// CHECK-NEXT: | |-MoveConstructor exists simple trivial needs_implicit
-// CHECK-NEXT: | |-CopyAssignment simple trivial has_const_param needs_implicit implicit_has_const_param
-// CHECK-NEXT: | |-MoveAssignment exists simple trivial needs_implicit
-// CHECK-NEXT: | `-Destructor simple irrelevant trivial needs_implicit
-// CHECK-NEXT: |-CXXRecordDecl 0x{{.+}} <col:38, col:44> col:44 implicit class TestClassTemplatePartial
-// CHECK-NEXT: `-FieldDecl 0x{{.+}} <line:[[@LINE-117]]:5, col:9> col:9 i 'int'
-
-// CHECK: ClassTemplatePartialSpecializationDecl 0x{{.+}} <{{.+}}:[[@LINE-117]]:3, line:[[@LINE-115]]:3> line:[[@LINE-117]]:31 class TestClassTemplatePartial definition
-// CHECK-NEXT: |-DefinitionData standard_layout trivially_copyable trivial literal
-// CHECK-NEXT: | |-DefaultConstructor exists trivial needs_implicit
-// CHECK-NEXT: | |-CopyConstructor simple trivial has_const_param needs_implicit implicit_has_const_param
-// CHECK-NEXT: | |-MoveConstructor exists simple trivial needs_implicit
-// CHECK-NEXT: | |-CopyAssignment simple trivial has_const_param needs_implicit implicit_has_const_param
-// CHECK-NEXT: | |-MoveAssignment exists simple trivial needs_implicit
-// CHECK-NEXT: | `-Destructor simple irrelevant trivial needs_implicit
-// CHECK-NEXT: |-TemplateArgument type 'type-parameter-0-0'
-// CHECK-NEXT: | `-TemplateTypeParmType 0x{{.+}} 'type-parameter-0-0' dependent depth 0 index 0
-// CHECK-NEXT: |-TemplateArgument type 'testClassTemplateDecl::A'
-// CHECK-NEXT: | `-RecordType 0x{{.+}} 'testClassTemplateDecl::A'
-// CHECK-NEXT: | `-CXXRecord 0x{{.+}} 'A'
-// CHECK-NEXT: |-TemplateTypeParmDecl 0x{{.+}} <col:12, col:21> col:21 referenced typename depth 0 index 0 T1
-// CHECK-NEXT: |-CXXRecordDecl 0x{{.+}} <col:25, col:31> col:31 implicit class TestClassTemplatePartial
-// CHECK-NEXT: `-FieldDecl 0x{{.+}} <line:[[@LINE-131]]:5, col:9> col:9 j 'int'
-
-// CHECK: ClassTemplateDecl 0x{{.+}} <{{.+}}:[[@LINE-130]]:3, col:37> col:37 TestTemplateDefaultType
-// CHECK-NEXT: |-TemplateTypeParmDecl 0x{{.+}} <col:12, col:25> col:21 typename depth 0 index 0 T
-// CHECK-NEXT: | `-TemplateArgument type 'int'
-// CHECK-NEXT: | `-BuiltinType 0x{{.+}} 'int'
-// CHECK-NEXT: `-CXXRecordDecl 0x{{.+}} <col:30, col:37> col:37 struct TestTemplateDefaultType
-
-// CHECK: ClassTemplateDecl 0x{{.+}} prev 0x{{.+}} <{{.+}}:[[@LINE-135]]:3, col:57> col:31 TestTemplateDefaultType
-// CHECK-NEXT: |-TemplateTypeParmDecl 0x{{.+}} <col:12, col:21> col:21 typename depth 0 index 0 T
-// CHECK-NEXT: | `-TemplateArgument type 'int'
-// CHECK-NEXT: | |-inherited from TemplateTypeParm 0x{{.+}} 'T'
-// CHECK-NEXT: | `-BuiltinType 0x{{.+}} 'int'
-// CHECK-NEXT: `-CXXRecordDecl 0x{{.+}} prev 0x{{.+}} <col:24, col:57> col:31 struct TestTemplateDefaultType definition
-// CHECK-NEXT: |-DefinitionData empty aggregate standard_layout trivially_copyable pod trivial literal has_constexpr_non_copy_move_ctor can_const_default_init
-// CHECK-NEXT: | |-DefaultConstructor exists trivial constexpr needs_implicit defaulted_is_constexpr
-// CHECK-NEXT: | |-CopyConstructor simple trivial has_const_param needs_implicit implicit_has_const_param
-// CHECK-NEXT: | |-MoveConstructor exists simple trivial needs_implicit
-// CHECK-NEXT: | |-CopyAssignment simple trivial has_const_param needs_implicit implicit_has_const_param
-// CHECK-NEXT: | |-MoveAssignment exists simple trivial needs_implicit
-// CHECK-NEXT: | `-Destructor simple irrelevant trivial needs_implicit
-// CHECK-NEXT: `-CXXRecordDecl 0x{{.+}} <col:24, col:31> col:31 implicit struct TestTemplateDefaultType
-
-// CHECK: ClassTemplateDecl 0x{{.+}} <{{.+}}:[[@LINE-148]]:3, col:31> col:31 TestTemplateDefaultNonType
-// CHECK-NEXT: |-NonTypeTemplateParmDecl 0x{{.+}} <col:12, col:20> col:16 'int' depth 0 index 0 I
-// CHECK-NEXT: | `-TemplateArgument expr
-// CHECK-NEXT: | `-ConstantExpr 0x{{.+}} <col:20> 'int'
-// CHECK-NEXT: | |-value: Int 42
-// CHECK-NEXT: | `-IntegerLiteral 0x{{.+}} <col:20> 'int' 42
-// CHECK-NEXT: `-CXXRecordDecl 0x{{.+}} <col:24, col:31> col:31 struct TestTemplateDefaultNonType
-
-// CHECK: ClassTemplateDecl 0x{{.+}} <{{.+}}:{{.*}}:3, col:68> col:68 TestTemplateTemplateDefaultType
-// CHECK-NEXT: |-TemplateTemplateParmDecl 0x{{.+}} <col:12, col:42> col:37 depth 0 index 0 TT
-// CHECK-NEXT: | |-TemplateTypeParmDecl 0x{{.+}} <col:21> col:29 typename depth 1 index 0
-// CHECK-NEXT: | `-TemplateArgument <col:42> template TestClassTemplate
-// CHECK-NEXT: `-CXXRecordDecl 0x{{.+}} <col:61, col:68> col:68 struct TestTemplateTemplateDefaultType
-
-// CHECK: ClassTemplateDecl 0x{{.+}} prev 0x{{.+}} <{{.+}}:{{.*}}:3, col:82> col:48 TestTemplateTemplateDefaultType
-// CHECK-NEXT: |-TemplateTemplateParmDecl 0x{{.+}} <col:12, col:37> col:37 depth 0 index 0 TT
-// CHECK-NEXT: | |-TemplateTypeParmDecl 0x{{.+}} <col:21> col:29 typename depth 1 index 0
-// CHECK-NEXT: | `-TemplateArgument <line:{{.*}}:42> template TestClassTemplate
-// CHECK-NEXT: | `-inherited from TemplateTemplateParm 0x{{.+}} 'TT'
-// CHECK-NEXT: `-CXXRecordDecl 0x{{.+}} prev 0x{{.+}} <line:{{.*}}:41, col:82> col:48 struct TestTemplateTemplateDefaultType definition
-// CHECK-NEXT: |-DefinitionData empty aggregate standard_layout trivially_copyable pod trivial literal has_constexpr_non_copy_move_ctor can_const_default_init
-// CHECK-NEXT: | |-DefaultConstructor exists trivial constexpr needs_implicit defaulted_is_constexpr
-// CHECK-NEXT: | |-CopyConstructor simple trivial has_const_param needs_implicit implicit_has_const_param
-// CHECK-NEXT: | |-MoveConstructor exists simple trivial needs_implicit
-// CHECK-NEXT: | |-CopyAssignment simple trivial has_const_param needs_implicit implicit_has_const_param
-// CHECK-NEXT: | |-MoveAssignment exists simple trivial needs_implicit
-// CHECK-NEXT: | `-Destructor simple irrelevant trivial needs_implicit
-// CHECK-NEXT: `-CXXRecordDecl 0x{{.+}} <col:41, col:48> col:48 implicit struct TestTemplateTemplateDefaultType
-
-
-// PR15220 dump instantiation only once
-namespace testCanonicalTemplate {
- class A {};
-
- template<typename T> void TestFunctionTemplate(T);
- template<typename T> void TestFunctionTemplate(T);
- void bar(A a) { TestFunctionTemplate(a); }
- // CHECK: FunctionTemplateDecl 0x{{.+}} <{{.+}}:[[@LINE-3]]:3, col:51> col:29 TestFunctionTemplate
- // CHECK-NEXT: |-TemplateTypeParmDecl 0x{{.+}} <col:12, col:21> col:21 referenced typename depth 0 index 0 T
- // CHECK-NEXT: |-FunctionDecl 0x{{.*}} <col:24, col:51> col:29 TestFunctionTemplate 'void (T)'
- // CHECK-NEXT: | `-ParmVarDecl 0x{{.*}} <col:50> col:51 'T'
- // CHECK-NEXT: `-FunctionDecl 0x{{.*}} <line:[[@LINE-6]]:24, col:51> col:29 used TestFunctionTemplate 'void (testCanonicalTemplate::A)'
- // CHECK-NEXT: |-TemplateArgument type 'testCanonicalTemplate::A'
- // CHECK-NEXT: | `-RecordType 0x{{.+}} 'testCanonicalTemplate::A'
- // CHECK-NEXT: | `-CXXRecord 0x{{.+}} 'A'
- // CHECK-NEXT: `-ParmVarDecl 0x{{.*}} <col:50> col:51 'testCanonicalTemplate::A':'testCanonicalTemplate::A'
-
- // CHECK: FunctionTemplateDecl 0x{{.+}} prev 0x{{.+}} <{{.+}}:[[@LINE-12]]:3, col:51> col:29 TestFunctionTemplate
- // CHECK-NEXT: |-TemplateTypeParmDecl 0x{{.+}} <col:12, col:21> col:21 referenced typename depth 0 index 0 T
- // CHECK-NEXT: |-FunctionDecl{{.*}} 0x{{.+}} prev 0x{{.+}} <col:24, col:51> col:29 TestFunctionTemplate 'void (T)'
- // CHECK-NEXT: | `-ParmVarDecl 0x{{.+}} <col:50> col:51 'T'
- // CHECK-NEXT: `-Function 0x{{.+}} 'TestFunctionTemplate' 'void (testCanonicalTemplate::A)'
- // CHECK-NOT: TemplateArgument
-
- template<typename T1> class TestClassTemplate {
- template<typename T2> friend class TestClassTemplate;
- };
- TestClassTemplate<A> a;
- // CHECK: ClassTemplateDecl 0x{{.+}} <{{.+}}:[[@LINE-4]]:3, line:[[@LINE-2]]:3> line:[[@LINE-4]]:31 TestClassTemplate
- // CHECK-NEXT: |-TemplateTypeParmDecl 0x{{.+}} <col:12, col:21> col:21 typename depth 0 index 0 T1
- // CHECK-NEXT: |-CXXRecordDecl 0x{{.+}} <col:25, line:[[@LINE-4]]:3> line:[[@LINE-6]]:31 class TestClassTemplate definition
- // CHECK-NEXT: | |-DefinitionData empty aggregate standard_layout trivially_copyable pod trivial literal has_constexpr_non_copy_move_ctor can_const_default_init
- // CHECK-NEXT: | | |-DefaultConstructor exists trivial constexpr needs_implicit defaulted_is_constexpr
- // CHECK-NEXT: | | |-CopyConstructor simple trivial has_const_param needs_implicit implicit_has_const_param
- // CHECK-NEXT: | | |-MoveConstructor exists simple trivial needs_implicit
- // CHECK-NEXT: | | |-CopyAssignment simple trivial has_const_param needs_implicit implicit_has_const_param
- // CHECK-NEXT: | | |-MoveAssignment exists simple trivial needs_implicit
- // CHECK-NEXT: | | `-Destructor simple irrelevant trivial needs_implicit
- // CHECK-NEXT: | |-CXXRecordDecl 0x{{.+}} <col:25, col:31> col:31 implicit class TestClassTemplate
- // CHECK-NEXT: | `-FriendDecl 0x{{.+}} <line:[[@LINE-14]]:5, col:40> col:40
- // CHECK-NEXT: | `-ClassTemplateDecl 0x{{.+}} parent 0x{{.+}} <col:5, col:40> col:40 TestClassTemplate
- // CHECK-NEXT: | |-TemplateTypeParmDecl 0x{{.+}} <col:14, col:23> col:23 typename depth 1 index 0 T2
- // CHECK-NEXT: | `-CXXRecordDecl 0x{{.+}} parent 0x{{.+}} <col:34, col:40> col:40 class TestClassTemplate
- // CHECK-NEXT: `-ClassTemplateSpecializationDecl 0x{{.+}} <line:[[@LINE-19]]:3, line:[[@LINE-17]]:3> line:[[@LINE-19]]:31 class TestClassTemplate definition
- // CHECK-NEXT: |-DefinitionData pass_in_registers empty aggregate standard_layout trivially_copyable pod trivial literal has_constexpr_non_copy_move_ctor can_const_default_init
- // CHECK-NEXT: | |-DefaultConstructor exists trivial constexpr defaulted_is_constexpr
- // CHECK-NEXT: | |-CopyConstructor simple trivial has_const_param implicit_has_const_param
- // CHECK-NEXT: | |-MoveConstructor exists simple trivial
- // CHECK-NEXT: | |-CopyAssignment simple trivial has_const_param needs_implicit implicit_has_const_param
- // CHECK-NEXT: | |-MoveAssignment exists simple trivial needs_implicit
- // CHECK-NEXT: | `-Destructor simple irrelevant trivial needs_implicit
- // CHECK-NEXT: |-TemplateArgument type 'testCanonicalTemplate::A'
- // CHECK-NEXT: | `-RecordType 0x{{.+}} 'testCanonicalTemplate::A'
- // CHECK-NEXT: | `-CXXRecord 0x{{.+}} 'A'
- // CHECK-NEXT: |-CXXRecordDecl 0x{{.+}} prev 0x{{.+}} <col:25, col:31> col:31 implicit class TestClassTemplate
- // CHECK-NEXT: |-FriendDecl 0x{{.+}} <line:[[@LINE-30]]:5, col:40> col:40
- // CHECK-NEXT: | `-ClassTemplateDecl 0x{{.+}} parent 0x{{.+}} prev 0x{{.+}} <col:5, col:40> col:40 TestClassTemplate
- // CHECK-NEXT: | |-TemplateTypeParmDecl 0x{{.+}} <col:14, col:23> col:23 typename depth 0 index 0 T2
- // CHECK-NEXT: | |-CXXRecordDecl 0x{{.+}} parent 0x{{.+}} prev 0x{{.+}} <col:34, col:40> col:40 class TestClassTemplate
- // CHECK-NEXT: | `-ClassTemplateSpecialization 0x{{.+}} 'TestClassTemplate'
- // CHECK-NEXT: |-CXXConstructorDecl 0x{{.+}} <line:[[@LINE-36]]:31> col:31 implicit used constexpr TestClassTemplate 'void () noexcept' inline default trivial
- // CHECK-NEXT: | `-CompoundStmt 0x{{.+}} <col:31>
- // CHECK-NEXT: |-CXXConstructorDecl 0x{{.+}} <col:31> col:31 implicit constexpr TestClassTemplate 'void (const testCanonicalTemplate::TestClassTemplate<testCanonicalTemplate::A> &)' inline default trivial noexcept-unevaluated 0x{{.+}}
- // CHECK-NEXT: | `-ParmVarDecl 0x{{.+}} <col:31> col:31 'const testCanonicalTemplate::TestClassTemplate<testCanonicalTemplate::A> &'
- // CHECK-NEXT: `-CXXConstructorDecl 0x{{.+}} <col:31> col:31 implicit constexpr TestClassTemplate 'void (testCanonicalTemplate::TestClassTemplate<testCanonicalTemplate::A> &&)' inline default trivial noexcept-unevaluated 0x{{.+}}
- // CHECK-NEXT: `-ParmVarDecl 0x{{.+}} <col:31> col:31 'testCanonicalTemplate::TestClassTemplate<testCanonicalTemplate::A> &&'
-
-
- template<typename T1> class TestClassTemplate2;
- template<typename T1> class TestClassTemplate2;
- template<typename T1> class TestClassTemplate2 {
- };
- TestClassTemplate2<A> a2;
- // CHECK: ClassTemplateDecl 0x{{.+}} <{{.+}}:[[@LINE-5]]:3, col:31> col:31 TestClassTemplate2
- // CHECK-NEXT: |-TemplateTypeParmDecl 0x{{.+}} <col:12, col:21> col:21 typename depth 0 index 0 T1
- // CHECK-NEXT: |-CXXRecordDecl 0x{{.+}} <col:25, col:31> col:31 class TestClassTemplate2
- // CHECK-NEXT: `-ClassTemplateSpecializationDecl 0x{{.+}} <line:[[@LINE-6]]:3, line:[[@LINE-5]]:3> line:[[@LINE-6]]:31 class TestClassTemplate2 definition
- // CHECK-NEXT: |-DefinitionData pass_in_registers empty aggregate standard_layout trivially_copyable pod trivial literal has_constexpr_non_copy_move_ctor can_const_default_init
- // CHECK-NEXT: | |-DefaultConstructor exists trivial constexpr defaulted_is_constexpr
- // CHECK-NEXT: | |-CopyConstructor simple trivial has_const_param implicit_has_const_param
- // CHECK-NEXT: | |-MoveConstructor exists simple trivial
- // CHECK-NEXT: | |-CopyAssignment simple trivial has_const_param needs_implicit implicit_has_const_param
- // CHECK-NEXT: | |-MoveAssignment exists simple trivial needs_implicit
- // CHECK-NEXT: | `-Destructor simple irrelevant trivial needs_implicit
- // CHECK-NEXT: |-TemplateArgument type 'testCanonicalTemplate::A'
- // CHECK-NEXT: | `-RecordType 0x{{.+}} 'testCanonicalTemplate::A'
- // CHECK-NEXT: | `-CXXRecord 0x{{.+}} 'A'
- // CHECK-NEXT: |-CXXRecordDecl 0x{{.+}} prev 0x{{.+}} <col:25, col:31> col:31 implicit class TestClassTemplate2
- // CHECK-NEXT: |-CXXConstructorDecl 0x{{.+}} <col:31> col:31 implicit used constexpr TestClassTemplate2 'void () noexcept' inline default trivial
- // CHECK-NEXT: | `-CompoundStmt 0x{{.+}} <col:31>
- // CHECK-NEXT: |-CXXConstructorDecl 0x{{.+}} <col:31> col:31 implicit constexpr TestClassTemplate2 'void (const testCanonicalTemplate::TestClassTemplate2<testCanonicalTemplate::A> &)' inline default trivial noexcept-unevaluated 0x{{.+}}
- // CHECK-NEXT: | `-ParmVarDecl 0x{{.+}} <col:31> col:31 'const testCanonicalTemplate::TestClassTemplate2<testCanonicalTemplate::A> &'
- // CHECK-NEXT: `-CXXConstructorDecl 0x{{.+}} <col:31> col:31 implicit constexpr TestClassTemplate2 'void (testCanonicalTemplate::TestClassTemplate2<testCanonicalTemplate::A> &&)' inline default trivial noexcept-unevaluated 0x{{.+}}
- // CHECK-NEXT: `-ParmVarDecl 0x{{.+}} <col:31> col:31 'testCanonicalTemplate::TestClassTemplate2<testCanonicalTemplate::A> &&'
-
- // CHECK: ClassTemplateDecl 0x{{.+}} prev 0x{{.+}} <{{.+}}:[[@LINE-26]]:3, col:31> col:31 TestClassTemplate2
- // CHECK-NEXT: |-TemplateTypeParmDecl 0x{{.+}} <col:12, col:21> col:21 typename depth 0 index 0 T1
- // CHECK-NEXT: |-CXXRecordDecl 0x{{.+}} prev 0x{{.+}} <col:25, col:31> col:31 class TestClassTemplate2
- // CHECK-NEXT: `-ClassTemplateSpecialization 0x{{.+}} 'TestClassTemplate2'
-
- // CHECK: ClassTemplateDecl 0x{{.+}} prev 0x{{.+}} <{{.+}}:[[@LINE-30]]:3, line:[[@LINE-29]]:3> line:[[@LINE-30]]:31 TestClassTemplate2
- // CHECK-NEXT: |-TemplateTypeParmDecl 0x{{.+}} <col:12, col:21> col:21 typename depth 0 index 0 T1
- // CHECK-NEXT: |-CXXRecordDecl 0x{{.+}} prev 0x{{.+}} <col:25, line:[[@LINE-31]]:3> line:[[@LINE-32]]:31 class TestClassTemplate2 definition
- // CHECK-NEXT: | |-DefinitionData empty aggregate standard_layout trivially_copyable pod trivial literal has_constexpr_non_copy_move_ctor can_const_default_init
- // CHECK-NEXT: | | |-DefaultConstructor exists trivial constexpr needs_implicit defaulted_is_constexpr
- // CHECK-NEXT: | | |-CopyConstructor simple trivial has_const_param needs_implicit implicit_has_const_param
- // CHECK-NEXT: | | |-MoveConstructor exists simple trivial needs_implicit
- // CHECK-NEXT: | | |-CopyAssignment simple trivial has_const_param needs_implicit implicit_has_const_param
- // CHECK-NEXT: | | |-MoveAssignment exists simple trivial needs_implicit
- // CHECK-NEXT: | | `-Destructor simple irrelevant trivial needs_implicit
- // CHECK-NEXT: | `-CXXRecordDecl 0x{{.+}} <col:25, col:31> col:31 implicit class TestClassTemplate2
- // CHECK-NEXT: `-ClassTemplateSpecialization 0x{{.+}} 'TestClassTemplate2'
-
- struct S {
- template<typename T> static const T TestVarTemplate; // declaration of a static data member template
- };
- template<typename T>
- const T S::TestVarTemplate = { }; // definition of a static data member template
-
- void f()
- {
- int i = S::TestVarTemplate<int>;
- int j = S::TestVarTemplate<int>;
- }
-
- // CHECK: VarTemplateDecl 0x{{.+}} <{{.+}}:[[@LINE-11]]:7, col:43> col:43 TestVarTemplate
- // CHECK-NEXT: |-TemplateTypeParmDecl 0x{{.+}} <col:16, col:25> col:25 referenced typename depth 0 index 0 T
- // CHECK-NEXT: |-VarDecl 0x{{.+}} <col:28, col:43> col:43 TestVarTemplate 'const T' static
- // CHECK-NEXT: |-VarTemplateSpecializationDecl 0x{{.+}} parent 0x{{.+}} prev 0x{{.+}} <line:[[@LINE-11]]:3, col:34> col:14 referenced TestVarTemplate 'const int':'const int' cinit
- // CHECK-NEXT: | |-TemplateArgument type 'int'
- // CHECK-NEXT: | | `-BuiltinType 0x{{.+}} 'int'
- // CHECK-NEXT: | `-InitListExpr 0x{{.+}} <col:32, col:34> 'int':'int'
- // CHECK-NEXT: `-VarTemplateSpecializationDecl 0x{{.+}} <line:[[@LINE-18]]:28, col:43> col:43 referenced TestVarTemplate 'const int':'const int' static
- // CHECK-NEXT: `-TemplateArgument type 'int'
-
- // CHECK: VarTemplateSpecializationDecl 0x{{.+}} <{{.+}}:[[@LINE-21]]:28, col:43> col:43 referenced TestVarTemplate 'const int':'const int' static
- // CHECK-NEXT:`-TemplateArgument type 'int'
- // CHECK-NEXT: `-BuiltinType 0x{{.+}} 'int'
-
- // CHECK: VarTemplateDecl 0x{{.+}} parent 0x{{.+}} prev 0x{{.+}} <{{.+}}:[[@LINE-23]]:3, line:[[@LINE-22]]:34> col:14 TestVarTemplate
- // CHECK-NEXT: |-TemplateTypeParmDecl 0x{{.+}} <line:[[@LINE-24]]:12, col:21> col:21 referenced typename depth 0 index 0 T
- // CHECK-NEXT: |-VarDecl 0x{{.+}} parent 0x{{.+}} prev 0x{{.+}} <line:[[@LINE-24]]:3, col:34> col:14 TestVarTemplate 'const T' cinit
- // CHECK-NEXT: | `-InitListExpr 0x{{.+}} <col:32, col:34> 'void'
- // CHECK-NEXT: |-VarTemplateSpecialization 0x{{.+}} 'TestVarTemplate' 'const int':'const int'
- // CHECK-NEXT: `-VarTemplateSpecialization 0x{{.+}} 'TestVarTemplate' 'const int':'const int'
-
- // CHECK: VarTemplateSpecializationDecl 0x{{.+}} parent 0x{{.+}} prev 0x{{.+}} <{{.+}}:[[@LINE-29]]:3, col:34> col:14 referenced TestVarTemplate 'const int':'const int' cinit
- // CHECK-NEXT: |-TemplateArgument type 'int'
- // CHECK-NEXT: | `-BuiltinType 0x{{.+}} 'int'
- // CHECK-NEXT: `-InitListExpr 0x{{.+}} <col:32, col:34> 'int':'int'
-}
-
-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: ParmVarDecl
-// CHECK-NEXT: CompoundStmt
-// CHECK-NEXT: TemplateArgument{{.*}} 'int'
-
-namespace TestTemplateTypeParmDecl {
- template<typename ... T, class U = int> void foo();
-}
-// CHECK: NamespaceDecl{{.*}} TestTemplateTypeParmDecl
-// CHECK-NEXT: FunctionTemplateDecl
-// CHECK-NEXT: TemplateTypeParmDecl{{.*}} typename depth 0 index 0 ... T
-// CHECK-NEXT: TemplateTypeParmDecl{{.*}} class depth 0 index 1 U
-// CHECK-NEXT: TemplateArgument type 'int'
-
-namespace TestNonTypeTemplateParmDecl {
- template<int I = 1, int ... J> void foo();
-}
-// CHECK: NamespaceDecl{{.*}} TestNonTypeTemplateParmDecl
-// CHECK-NEXT: FunctionTemplateDecl
-// CHECK-NEXT: NonTypeTemplateParmDecl{{.*}} 'int' depth 0 index 0 I
-// CHECK-NEXT: TemplateArgument expr
-// CHECK-NEXT: ConstantExpr{{.*}} 'int'
-// CHECK-NEXT: value: Int 1
-// CHECK-NEXT: IntegerLiteral{{.*}} 'int' 1
-// CHECK-NEXT: NonTypeTemplateParmDecl{{.*}} 'int' depth 0 index 1 ... 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: TemplateArgument{{.*}} type 'int'
-
- template<int fp(void)> class testDecl { };
- template class testDecl<foo>;
- // CHECK: ClassTemplateSpecializationDecl{{.*}} class testDecl
- // CHECK: TemplateArgument{{.*}} decl
- // CHECK-NEXT: Function{{.*}}foo
-
- template class testDecl<nullptr>;
- // CHECK: ClassTemplateSpecializationDecl{{.*}} class testDecl
- // CHECK: TemplateArgument{{.*}} nullptr
-
- template<int> class testIntegral { };
- template class testIntegral<1>;
- // CHECK: ClassTemplateSpecializationDecl{{.*}} class testIntegral
- // CHECK: TemplateArgument{{.*}} integral 1
-
- template<template<typename> class> class testTemplate { };
- template class testTemplate<A>;
- // CHECK: ClassTemplateSpecializationDecl{{.*}} class testTemplate
- // CHECK: 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: TemplateArgument{{.*}} expr
- // CHECK-NEXT: DeclRefExpr{{.*}}I
-
- template<int, int ...> class testPack { };
- template class testPack<0, 1, 2>;
- // CHECK: ClassTemplateSpecializationDecl{{.*}} class testPack
- // CHECK: 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: 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: CXXRecord{{.*}} TestFriendDecl
-// CHECK-NEXT: FriendDecl
-// CHECK-NEXT: FunctionDecl{{.*}} foo
-// CHECK-NEXT: FriendDecl{{.*}} 'class A':'A'
-// CHECK-NEXT: FriendDecl{{.*}} 'T'
-
-namespace TestFileScopeAsmDecl {
- asm("ret");
-}
-// CHECK: NamespaceDecl{{.*}} TestFileScopeAsmDecl{{$}}
-// CHECK: FileScopeAsmDecl{{.*> .*$}}
-// CHECK-NEXT: StringLiteral
-
-namespace TestFriendDecl2 {
- void f();
- struct S {
- friend void f();
- };
-}
-// CHECK: NamespaceDecl [[TestFriendDecl2:0x.*]] <{{.*}}> {{.*}} TestFriendDecl2
-// CHECK: |-FunctionDecl [[TestFriendDecl2_f:0x.*]] <{{.*}}> {{.*}} f 'void ()'
-// CHECK: `-CXXRecordDecl {{.*}} struct S
-// CHECK: |-CXXRecordDecl {{.*}} struct S
-// CHECK: `-FriendDecl
-// CHECK: `-FunctionDecl {{.*}} parent [[TestFriendDecl2]] prev [[TestFriendDecl2_f]] <{{.*}}> {{.*}} f 'void ()'
-
-namespace Comment {
- extern int Test;
- /// Something here.
- extern int Test;
- extern int Test;
-}
-
-// CHECK: VarDecl {{.*}} Test 'int' extern
-// CHECK-NOT: FullComment
-// CHECK: VarDecl {{.*}} Test 'int' extern
-// CHECK: `-FullComment
-// CHECK: `-ParagraphComment
-// CHECK: `-TextComment
-// CHECK: VarDecl {{.*}} Test 'int' extern
-// CHECK-NOT: FullComment
+// Test without serialization:
+// RUN: %clang_cc1 -std=c++11 -triple x86_64-linux-gnu -fms-extensions \
+// RUN: -ast-dump -ast-dump-filter Test %s \
+// RUN: | FileCheck --strict-whitespace %s
+//
+// Test with serialization: FIXME: Find why the outputs
diff ers and fix it!
+// : %clang_cc1 -std=c++11 -triple x86_64-linux-gnu -fms-extensions -emit-pch -o %t %s
+// : %clang_cc1 -x c++ -std=c++11 -triple x86_64-linux-gnu -fms-extensions -include-pch %t \
+// : -ast-dump-all -ast-dump-filter Test /dev/null \
+// : | sed -e "s/ <undeserialized declarations>//" -e "s/ imported//" \
+// : | FileCheck --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 '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 TestEmpty {};
+// CHECK: CXXRecordDecl{{.*}} class TestEmpty
+// CHECK-NEXT: DefinitionData pass_in_registers empty aggregate standard_layout trivially_copyable pod trivial literal has_constexpr_non_copy_move_ctor can_const_default_init
+// CHECK-NEXT: DefaultConstructor exists trivial constexpr
+// CHECK-NEXT: CopyConstructor simple trivial has_const_param
+// CHECK-NEXT: MoveConstructor exists simple trivial
+// CHECK-NEXT: CopyAssignment simple trivial has_const_param
+// CHECK-NEXT: MoveAssignment exists simple trivial
+// CHECK-NEXT: Destructor simple irrelevant trivial
+
+ class A { };
+ class B { };
+ class TestCXXRecordDecl : virtual A, public B {
+ int i;
+ };
+}
+// CHECK: CXXRecordDecl{{.*}} class TestCXXRecordDecl
+// CHECK-NEXT: DefinitionData{{$}}
+// CHECK-NEXT: DefaultConstructor exists non_trivial
+// CHECK-NEXT: CopyConstructor simple non_trivial has_const_param
+// CHECK-NEXT: MoveConstructor exists simple non_trivial
+// CHECK-NEXT: CopyAssignment simple non_trivial has_const_param
+// CHECK-NEXT: MoveAssignment exists simple non_trivial
+// CHECK-NEXT: Destructor simple irrelevant trivial
+// CHECK-NEXT: virtual private 'testCXXRecordDecl::A'
+// CHECK-NEXT: public 'testCXXRecordDecl::B'
+// CHECK-NEXT: CXXRecordDecl{{.*}} class TestCXXRecordDecl
+// CHECK-NEXT: FieldDecl
+
+template<class...T>
+class TestCXXRecordDeclPack : public T... {
+};
+// CHECK: CXXRecordDecl{{.*}} class TestCXXRecordDeclPack
+// CHECK: public 'T'...
+// CHECK-NEXT: CXXRecordDecl{{.*}} class TestCXXRecordDeclPack
+
+thread_local int TestThreadLocalInt;
+// CHECK: TestThreadLocalInt {{.*}} tls_dynamic
+
+class testCXXMethodDecl {
+ virtual void TestCXXMethodDeclPure() = 0;
+ void TestCXXMethodDeclDelete() = delete;
+ void TestCXXMethodDeclThrow() throw();
+ void TestCXXMethodDeclThrowType() throw(int);
+};
+// CHECK: CXXMethodDecl{{.*}} TestCXXMethodDeclPure 'void ()' virtual pure
+// CHECK: CXXMethodDecl{{.*}} TestCXXMethodDeclDelete 'void ()' delete
+// CHECK: CXXMethodDecl{{.*}} TestCXXMethodDeclThrow 'void () throw()'
+// CHECK: CXXMethodDecl{{.*}} TestCXXMethodDeclThrowType 'void () throw(int)'
+
+namespace testCXXConstructorDecl {
+ class A { };
+ class TestCXXConstructorDecl : public A {
+ int I;
+ TestCXXConstructorDecl(A &a, int i) : A(a), I(i) { }
+ TestCXXConstructorDecl(A &a) : TestCXXConstructorDecl(a, 0) { }
+ };
+}
+// 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
+// CHECK: CXXConstructorDecl{{.*}} TestCXXConstructorDecl 'void {{.*}}'
+// CHECK-NEXT: ParmVarDecl{{.*}} a
+// CHECK-NEXT: CXXCtorInitializer{{.*}}TestCXXConstructorDecl
+// CHECK-NEXT: CXXConstructExpr{{.*}}TestCXXConstructorDecl
+
+class TestCXXDestructorDecl {
+ ~TestCXXDestructorDecl() { }
+};
+// CHECK: CXXDestructorDecl{{.*}} ~TestCXXDestructorDecl 'void () noexcept'
+// CHECK-NEXT: CompoundStmt
+
+// Test that the range of a defaulted members is computed correctly.
+class TestMemberRanges {
+public:
+ TestMemberRanges() = default;
+ TestMemberRanges(const TestMemberRanges &Other) = default;
+ TestMemberRanges(TestMemberRanges &&Other) = default;
+ ~TestMemberRanges() = default;
+ TestMemberRanges &operator=(const TestMemberRanges &Other) = default;
+ TestMemberRanges &operator=(TestMemberRanges &&Other) = default;
+};
+void SomeFunction() {
+ TestMemberRanges A;
+ TestMemberRanges B(A);
+ B = A;
+ A = static_cast<TestMemberRanges &&>(B);
+ TestMemberRanges C(static_cast<TestMemberRanges &&>(A));
+}
+// CHECK: CXXConstructorDecl{{.*}} <line:{{.*}}:3, col:30>
+// CHECK: CXXConstructorDecl{{.*}} <line:{{.*}}:3, col:59>
+// CHECK: CXXConstructorDecl{{.*}} <line:{{.*}}:3, col:54>
+// CHECK: CXXDestructorDecl{{.*}} <line:{{.*}}:3, col:31>
+// CHECK: CXXMethodDecl{{.*}} <line:{{.*}}:3, col:70>
+// CHECK: CXXMethodDecl{{.*}} <line:{{.*}}:3, col:65>
+
+class TestCXXConversionDecl {
+ operator int() { return 0; }
+};
+// CHECK: CXXConversionDecl{{.*}} operator int 'int ()'
+// 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 0x{{.+}} <{{.+}}:[[@LINE-14]]:3, col:55> col:29 TestFunctionTemplate
+ // CHECK-NEXT: |-TemplateTypeParmDecl 0x{{.+}} <col:12, col:21> col:21 referenced typename depth 0 index 0 T
+ // CHECK-NEXT: |-FunctionDecl 0x{{.+}} <col:24, col:55> col:29 TestFunctionTemplate 'void (T)'
+ // CHECK-NEXT: | |-ParmVarDecl 0x{{.+}} <col:50> col:51 'T'
+ // CHECK-NEXT: | `-CompoundStmt 0x{{.+}} <col:53, col:55>
+ // CHECK-NEXT: |-FunctionDecl 0x{{.+}} <col:24, col:55> col:29 used TestFunctionTemplate 'void (testFunctionTemplateDecl::A)'
+ // CHECK-NEXT: | |-TemplateArgument type 'testFunctionTemplateDecl::A'
+ // CHECK-NEXT: | | `-RecordType 0{{.+}} 'testFunctionTemplateDecl::A'
+ // CHECK-NEXT: | | `-CXXRecord 0x{{.+}} 'A'
+ // CHECK-NEXT: | |-ParmVarDecl 0x{{.+}} <col:50> col:51 'testFunctionTemplateDecl::A':'testFunctionTemplateDecl::A'
+ // CHECK-NEXT: | `-CompoundStmt 0x{{.+}} <col:53, col:55>
+ // CHECK-NEXT: |-Function 0x{{.+}} 'TestFunctionTemplate' 'void (testFunctionTemplateDecl::B)'
+ // CHECK-NEXT: |-FunctionDecl 0x{{.+}} <col:24, col:55> col:29 TestFunctionTemplate 'void (testFunctionTemplateDecl::C)'
+ // CHECK-NEXT: | |-TemplateArgument type 'testFunctionTemplateDecl::C'
+ // CHECK-NEXT: | | `-RecordType 0{{.+}} 'testFunctionTemplateDecl::C'
+ // CHECK-NEXT: | | `-CXXRecord 0x{{.+}} 'C'
+ // CHECK-NEXT: | `-ParmVarDecl 0x{{.+}} <col:50> col:51 'testFunctionTemplateDecl::C':'testFunctionTemplateDecl::C'
+ // CHECK-NEXT: `-FunctionDecl 0x{{.+}} <col:24, col:55> col:29 TestFunctionTemplate 'void (testFunctionTemplateDecl::D)'
+ // CHECK-NEXT: |-TemplateArgument type 'testFunctionTemplateDecl::D'
+ // CHECK-NEXT: | `-RecordType 0{{.+}} 'testFunctionTemplateDecl::D'
+ // CHECK-NEXT: | `-CXXRecord 0x{{.+}} 'D'
+ // CHECK-NEXT: |-ParmVarDecl 0x{{.+}} <col:50> col:51 'testFunctionTemplateDecl::D':'testFunctionTemplateDecl::D'
+ // CHECK-NEXT: `-CompoundStmt 0x{{.+}} <col:53, col:55>
+
+ // CHECK: FunctionDecl 0x{{.+}} prev 0x{{.+}} <{{.+}}:[[@LINE-32]]:3, col:41> col:19 TestFunctionTemplate 'void (testFunctionTemplateDecl::B)'
+ // CHECK-NEXT: |-TemplateArgument type 'testFunctionTemplateDecl::B'
+ // CHECK-NEXT: | `-RecordType 0{{.+}} 'testFunctionTemplateDecl::B'
+ // CHECK-NEXT: | `-CXXRecord 0x{{.+}} 'B'
+ // CHECK-NEXT: `-ParmVarDecl 0x{{.+}} <col:40> col:41 'testFunctionTemplateDecl::B'
+
+
+namespace testClassTemplateDecl {
+ class A { };
+ class B { };
+ class C { };
+ class D { };
+
+ template<typename T> class TestClassTemplate {
+ public:
+ TestClassTemplate();
+ ~TestClassTemplate();
+ int j();
+ 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;
+ };
+
+ template<typename T = int> struct TestTemplateDefaultType;
+ template<typename T> struct TestTemplateDefaultType { };
+
+ template<int I = 42> struct TestTemplateDefaultNonType;
+ template<int I> struct TestTemplateDefaultNonType { };
+
+ template<template<typename> class TT = TestClassTemplate> struct TestTemplateTemplateDefaultType;
+ template<template<typename> class TT> struct TestTemplateTemplateDefaultType { };
+}
+
+// CHECK: ClassTemplateDecl 0x{{.+}} <{{.+}}:[[@LINE-40]]:3, line:[[@LINE-34]]:3> line:[[@LINE-40]]:30 TestClassTemplate
+// CHECK-NEXT: |-TemplateTypeParmDecl 0x{{.+}} <col:12, col:21> col:21 typename depth 0 index 0 T
+// CHECK-NEXT: |-CXXRecordDecl 0x{{.+}} <col:24, line:[[@LINE-36]]:3> line:[[@LINE-42]]:30 class TestClassTemplate definition
+// CHECK-NEXT: | |-DefinitionData standard_layout has_user_declared_ctor can_const_default_init
+// CHECK-NEXT: | | |-DefaultConstructor exists non_trivial user_provided
+// CHECK-NEXT: | | |-CopyConstructor simple trivial has_const_param needs_implicit implicit_has_const_param
+// CHECK-NEXT: | | |-MoveConstructor
+// CHECK-NEXT: | | |-CopyAssignment simple trivial has_const_param needs_implicit implicit_has_const_param
+// CHECK-NEXT: | | |-MoveAssignment
+// CHECK-NEXT: | | `-Destructor non_trivial user_declared
+// CHECK-NEXT: | |-CXXRecordDecl 0x{{.+}} <col:24, col:30> col:30 implicit referenced class TestClassTemplate
+// CHECK-NEXT: | |-AccessSpecDecl 0x{{.+}} <line:[[@LINE-50]]:3, col:9> col:3 public
+// CHECK-NEXT: | |-CXXConstructorDecl 0x{{.+}} <line:[[@LINE-50]]:5, col:23> col:5 TestClassTemplate<T> 'void ()'
+// CHECK-NEXT: | |-CXXDestructorDecl 0x{{.+}} <line:[[@LINE-50]]:5, col:24> col:5 ~TestClassTemplate<T> 'void ()'
+// CHECK-NEXT: | |-CXXMethodDecl 0x{{.+}} <line:[[@LINE-50]]:5, col:11> col:9 j 'int ()'
+// CHECK-NEXT: | `-FieldDecl 0x{{.+}} <line:[[@LINE-50]]:5, col:9> col:9 i 'int'
+// CHECK-NEXT: |-ClassTemplateSpecializationDecl 0x{{.+}} <line:[[@LINE-56]]:3, line:[[@LINE-50]]:3> line:[[@LINE-56]]:30 class TestClassTemplate definition
+// CHECK-NEXT: | |-DefinitionData standard_layout has_user_declared_ctor can_const_default_init
+// CHECK-NEXT: | | |-DefaultConstructor exists non_trivial user_provided
+// CHECK-NEXT: | | |-CopyConstructor simple trivial has_const_param implicit_has_const_param
+// CHECK-NEXT: | | |-MoveConstructor
+// CHECK-NEXT: | | |-CopyAssignment simple trivial has_const_param needs_implicit implicit_has_const_param
+// CHECK-NEXT: | | |-MoveAssignment
+// CHECK-NEXT: | | `-Destructor non_trivial user_declared
+// CHECK-NEXT: | |-TemplateArgument type 'testClassTemplateDecl::A'
+// CHECK-NEXT: | | `-RecordType 0{{.+}} 'testClassTemplateDecl::A'
+// CHECK-NEXT: | | `-CXXRecord 0x{{.+}} 'A'
+// CHECK-NEXT: | |-CXXRecordDecl 0x{{.+}} prev 0x{{.+}} <col:24, col:30> col:30 implicit class TestClassTemplate
+// CHECK-NEXT: | |-AccessSpecDecl 0x{{.+}} <line:[[@LINE-67]]:3, col:9> col:3 public
+// CHECK-NEXT: | |-CXXConstructorDecl 0x{{.+}} <line:[[@LINE-67]]:5, col:23> col:5 used TestClassTemplate 'void ()'
+// CHECK-NEXT: | |-CXXDestructorDecl 0x{{.+}} <line:[[@LINE-67]]:5, col:24> col:5 used ~TestClassTemplate 'void () noexcept'
+// CHECK-NEXT: | |-CXXMethodDecl 0x{{.+}} <line:[[@LINE-67]]:5, col:11> col:9 j 'int ()'
+// CHECK-NEXT: | |-FieldDecl 0x{{.+}} <line:[[@LINE-67]]:5, col:9> col:9 i 'int'
+// CHECK-NEXT: | `-CXXConstructorDecl 0x{{.+}} <line:[[@LINE-73]]:30> col:30 implicit constexpr TestClassTemplate 'void (const testClassTemplateDecl::TestClassTemplate<testClassTemplateDecl::A> &)' inline default trivial noexcept-unevaluated 0x{{.+}}
+// CHECK-NEXT: | `-ParmVarDecl 0x{{.+}} <col:30> col:30 'const testClassTemplateDecl::TestClassTemplate<testClassTemplateDecl::A> &'
+// CHECK-NEXT: |-ClassTemplateSpecialization 0x{{.+}} 'TestClassTemplate'
+// CHECK-NEXT: |-ClassTemplateSpecialization 0x{{.+}} 'TestClassTemplate'
+// CHECK-NEXT: `-ClassTemplateSpecialization 0x{{.+}} 'TestClassTemplate'
+
+// CHECK: ClassTemplateSpecializationDecl 0x{{.+}} <{{.+}}:[[@LINE-67]]:3, line:[[@LINE-65]]:3> line:[[@LINE-67]]:20 class TestClassTemplate definition
+// CHECK-NEXT: |-DefinitionData pass_in_registers standard_layout trivially_copyable trivial literal
+// CHECK-NEXT: | |-DefaultConstructor exists trivial needs_implicit
+// CHECK-NEXT: | |-CopyConstructor simple trivial has_const_param needs_implicit implicit_has_const_param
+// CHECK-NEXT: | |-MoveConstructor exists simple trivial needs_implicit
+// CHECK-NEXT: | |-CopyAssignment simple trivial has_const_param needs_implicit implicit_has_const_param
+// CHECK-NEXT: | |-MoveAssignment exists simple trivial needs_implicit
+// CHECK-NEXT: | `-Destructor simple irrelevant trivial needs_implicit
+// CHECK-NEXT: |-TemplateArgument type 'testClassTemplateDecl::B'
+// CHECK-NEXT: | `-RecordType 0{{.+}} 'testClassTemplateDecl::B'
+// CHECK-NEXT: | `-CXXRecord 0x{{.+}} 'B'
+// CHECK-NEXT: |-CXXRecordDecl 0x{{.+}} <col:14, col:20> col:20 implicit class TestClassTemplate
+// CHECK-NEXT: `-FieldDecl 0x{{.+}} <line:[[@LINE-78]]:5, col:9> col:9 j 'int'
+
+// CHECK: ClassTemplateSpecializationDecl 0x{{.+}} <{{.+}}:{{.*}}:3, col:44> col:25 class TestClassTemplate definition
+// CHECK-NEXT: |-DefinitionData standard_layout has_user_declared_ctor can_const_default_init
+// CHECK-NEXT: | |-DefaultConstructor exists non_trivial user_provided
+// CHECK-NEXT: | |-CopyConstructor simple trivial has_const_param needs_implicit implicit_has_const_param
+// CHECK-NEXT: | |-MoveConstructor
+// CHECK-NEXT: | |-CopyAssignment simple trivial has_const_param needs_implicit implicit_has_const_param
+// CHECK-NEXT: | |-MoveAssignment
+// CHECK-NEXT: | `-Destructor non_trivial user_declared
+// CHECK-NEXT: |-TemplateArgument type 'testClassTemplateDecl::C'
+// CHECK-NEXT: | `-RecordType 0{{.+}} 'testClassTemplateDecl::C'
+// CHECK-NEXT: | `-CXXRecord 0x{{.+}} 'C'
+// CHECK-NEXT: |-CXXRecordDecl 0x{{.+}} prev 0x{{.+}} <line:[[@LINE-104]]:24, col:30> col:30 implicit class TestClassTemplate
+// CHECK-NEXT: |-AccessSpecDecl 0x{{.+}} <line:[[@LINE-104]]:3, col:9> col:3 public
+// CHECK-NEXT: |-CXXConstructorDecl 0x{{.+}} <line:[[@LINE-104]]:5, col:23> col:5 TestClassTemplate 'void ()'
+// CHECK-NEXT: |-CXXDestructorDecl 0x{{.+}} <line:[[@LINE-104]]:5, col:24> col:5 ~TestClassTemplate 'void ()' noexcept-unevaluated 0x{{.+}}
+// CHECK-NEXT: |-CXXMethodDecl 0x{{.+}} <line:[[@LINE-104]]:5, col:11> col:9 j 'int ()'
+// CHECK-NEXT: `-FieldDecl 0x{{.+}} <line:[[@LINE-104]]:5, col:9> col:9 i 'int'
+
+// CHECK: ClassTemplateSpecializationDecl 0x{{.+}} <{{.+}}:[[@LINE-91]]:3, col:37> col:18 class TestClassTemplate definition
+// CHECK-NEXT: |-DefinitionData standard_layout has_user_declared_ctor can_const_default_init
+// CHECK-NEXT: | |-DefaultConstructor exists non_trivial user_provided
+// CHECK-NEXT: | |-CopyConstructor simple trivial has_const_param needs_implicit implicit_has_const_param
+// CHECK-NEXT: | |-MoveConstructor
+// CHECK-NEXT: | |-CopyAssignment simple trivial has_const_param needs_implicit implicit_has_const_param
+// CHECK-NEXT: | |-MoveAssignment
+// CHECK-NEXT: | `-Destructor non_trivial user_declared
+// CHECK-NEXT: |-TemplateArgument type 'testClassTemplateDecl::D'
+// CHECK-NEXT: | `-RecordType 0{{.+}} 'testClassTemplateDecl::D'
+// CHECK-NEXT: | `-CXXRecord 0x{{.+}} 'D'
+// CHECK-NEXT: |-CXXRecordDecl 0x{{.+}} prev 0x{{.+}} <line:[[@LINE-122]]:24, col:30> col:30 implicit class TestClassTemplate
+// CHECK-NEXT: |-AccessSpecDecl 0x{{.+}} <line:[[@LINE-122]]:3, col:9> col:3 public
+// CHECK-NEXT: |-CXXConstructorDecl 0x{{.+}} <line:[[@LINE-122]]:5, col:23> col:5 TestClassTemplate 'void ()'
+// CHECK-NEXT: |-CXXDestructorDecl 0x{{.+}} <line:[[@LINE-122]]:5, col:24> col:5 ~TestClassTemplate 'void ()' noexcept-unevaluated 0x{{.+}}
+// CHECK-NEXT: |-CXXMethodDecl 0x{{.+}} <line:[[@LINE-122]]:5, col:11> col:9 j 'int ()'
+// CHECK-NEXT: `-FieldDecl 0x{{.+}} <line:[[@LINE-122]]:5, col:9> col:9 i 'int'
+
+// CHECK: ClassTemplateDecl 0x{{.+}} <{{.+}}:[[@LINE-106]]:3, line:[[@LINE-104]]:3> line:[[@LINE-106]]:44 TestClassTemplatePartial
+// CHECK-NEXT: |-TemplateTypeParmDecl 0x{{.+}} <col:12, col:21> col:21 typename depth 0 index 0 T1
+// CHECK-NEXT: |-TemplateTypeParmDecl 0x{{.+}} <col:25, col:34> col:34 typename depth 0 index 1 T2
+// CHECK-NEXT: `-CXXRecordDecl 0x{{.+}} <col:38, line:[[@LINE-107]]:3> line:[[@LINE-109]]:44 class TestClassTemplatePartial definition
+// CHECK-NEXT: |-DefinitionData standard_layout trivially_copyable trivial literal
+// CHECK-NEXT: | |-DefaultConstructor exists trivial needs_implicit
+// CHECK-NEXT: | |-CopyConstructor simple trivial has_const_param needs_implicit implicit_has_const_param
+// CHECK-NEXT: | |-MoveConstructor exists simple trivial needs_implicit
+// CHECK-NEXT: | |-CopyAssignment simple trivial has_const_param needs_implicit implicit_has_const_param
+// CHECK-NEXT: | |-MoveAssignment exists simple trivial needs_implicit
+// CHECK-NEXT: | `-Destructor simple irrelevant trivial needs_implicit
+// CHECK-NEXT: |-CXXRecordDecl 0x{{.+}} <col:38, col:44> col:44 implicit class TestClassTemplatePartial
+// CHECK-NEXT: `-FieldDecl 0x{{.+}} <line:[[@LINE-117]]:5, col:9> col:9 i 'int'
+
+// CHECK: ClassTemplatePartialSpecializationDecl 0x{{.+}} <{{.+}}:[[@LINE-117]]:3, line:[[@LINE-115]]:3> line:[[@LINE-117]]:31 class TestClassTemplatePartial definition
+// CHECK-NEXT: |-DefinitionData standard_layout trivially_copyable trivial literal
+// CHECK-NEXT: | |-DefaultConstructor exists trivial needs_implicit
+// CHECK-NEXT: | |-CopyConstructor simple trivial has_const_param needs_implicit implicit_has_const_param
+// CHECK-NEXT: | |-MoveConstructor exists simple trivial needs_implicit
+// CHECK-NEXT: | |-CopyAssignment simple trivial has_const_param needs_implicit implicit_has_const_param
+// CHECK-NEXT: | |-MoveAssignment exists simple trivial needs_implicit
+// CHECK-NEXT: | `-Destructor simple irrelevant trivial needs_implicit
+// CHECK-NEXT: |-TemplateArgument type 'type-parameter-0-0'
+// CHECK-NEXT: | `-TemplateTypeParmType 0x{{.+}} 'type-parameter-0-0' dependent depth 0 index 0
+// CHECK-NEXT: |-TemplateArgument type 'testClassTemplateDecl::A'
+// CHECK-NEXT: | `-RecordType 0x{{.+}} 'testClassTemplateDecl::A'
+// CHECK-NEXT: | `-CXXRecord 0x{{.+}} 'A'
+// CHECK-NEXT: |-TemplateTypeParmDecl 0x{{.+}} <col:12, col:21> col:21 referenced typename depth 0 index 0 T1
+// CHECK-NEXT: |-CXXRecordDecl 0x{{.+}} <col:25, col:31> col:31 implicit class TestClassTemplatePartial
+// CHECK-NEXT: `-FieldDecl 0x{{.+}} <line:[[@LINE-131]]:5, col:9> col:9 j 'int'
+
+// CHECK: ClassTemplateDecl 0x{{.+}} <{{.+}}:[[@LINE-130]]:3, col:37> col:37 TestTemplateDefaultType
+// CHECK-NEXT: |-TemplateTypeParmDecl 0x{{.+}} <col:12, col:25> col:21 typename depth 0 index 0 T
+// CHECK-NEXT: | `-TemplateArgument type 'int'
+// CHECK-NEXT: | `-BuiltinType 0x{{.+}} 'int'
+// CHECK-NEXT: `-CXXRecordDecl 0x{{.+}} <col:30, col:37> col:37 struct TestTemplateDefaultType
+
+// CHECK: ClassTemplateDecl 0x{{.+}} prev 0x{{.+}} <{{.+}}:[[@LINE-135]]:3, col:57> col:31 TestTemplateDefaultType
+// CHECK-NEXT: |-TemplateTypeParmDecl 0x{{.+}} <col:12, col:21> col:21 typename depth 0 index 0 T
+// CHECK-NEXT: | `-TemplateArgument type 'int'
+// CHECK-NEXT: | |-inherited from TemplateTypeParm 0x{{.+}} 'T'
+// CHECK-NEXT: | `-BuiltinType 0x{{.+}} 'int'
+// CHECK-NEXT: `-CXXRecordDecl 0x{{.+}} prev 0x{{.+}} <col:24, col:57> col:31 struct TestTemplateDefaultType definition
+// CHECK-NEXT: |-DefinitionData empty aggregate standard_layout trivially_copyable pod trivial literal has_constexpr_non_copy_move_ctor can_const_default_init
+// CHECK-NEXT: | |-DefaultConstructor exists trivial constexpr needs_implicit defaulted_is_constexpr
+// CHECK-NEXT: | |-CopyConstructor simple trivial has_const_param needs_implicit implicit_has_const_param
+// CHECK-NEXT: | |-MoveConstructor exists simple trivial needs_implicit
+// CHECK-NEXT: | |-CopyAssignment simple trivial has_const_param needs_implicit implicit_has_const_param
+// CHECK-NEXT: | |-MoveAssignment exists simple trivial needs_implicit
+// CHECK-NEXT: | `-Destructor simple irrelevant trivial needs_implicit
+// CHECK-NEXT: `-CXXRecordDecl 0x{{.+}} <col:24, col:31> col:31 implicit struct TestTemplateDefaultType
+
+// CHECK: ClassTemplateDecl 0x{{.+}} <{{.+}}:[[@LINE-148]]:3, col:31> col:31 TestTemplateDefaultNonType
+// CHECK-NEXT: |-NonTypeTemplateParmDecl 0x{{.+}} <col:12, col:20> col:16 'int' depth 0 index 0 I
+// CHECK-NEXT: | `-TemplateArgument expr
+// CHECK-NEXT: | `-ConstantExpr 0x{{.+}} <col:20> 'int'
+// CHECK-NEXT: | |-value: Int 42
+// CHECK-NEXT: | `-IntegerLiteral 0x{{.+}} <col:20> 'int' 42
+// CHECK-NEXT: `-CXXRecordDecl 0x{{.+}} <col:24, col:31> col:31 struct TestTemplateDefaultNonType
+
+// CHECK: ClassTemplateDecl 0x{{.+}} <{{.+}}:{{.*}}:3, col:68> col:68 TestTemplateTemplateDefaultType
+// CHECK-NEXT: |-TemplateTemplateParmDecl 0x{{.+}} <col:12, col:42> col:37 depth 0 index 0 TT
+// CHECK-NEXT: | |-TemplateTypeParmDecl 0x{{.+}} <col:21> col:29 typename depth 1 index 0
+// CHECK-NEXT: | `-TemplateArgument <col:42> template TestClassTemplate
+// CHECK-NEXT: `-CXXRecordDecl 0x{{.+}} <col:61, col:68> col:68 struct TestTemplateTemplateDefaultType
+
+// CHECK: ClassTemplateDecl 0x{{.+}} prev 0x{{.+}} <{{.+}}:{{.*}}:3, col:82> col:48 TestTemplateTemplateDefaultType
+// CHECK-NEXT: |-TemplateTemplateParmDecl 0x{{.+}} <col:12, col:37> col:37 depth 0 index 0 TT
+// CHECK-NEXT: | |-TemplateTypeParmDecl 0x{{.+}} <col:21> col:29 typename depth 1 index 0
+// CHECK-NEXT: | `-TemplateArgument <line:{{.*}}:42> template TestClassTemplate
+// CHECK-NEXT: | `-inherited from TemplateTemplateParm 0x{{.+}} 'TT'
+// CHECK-NEXT: `-CXXRecordDecl 0x{{.+}} prev 0x{{.+}} <line:{{.*}}:41, col:82> col:48 struct TestTemplateTemplateDefaultType definition
+// CHECK-NEXT: |-DefinitionData empty aggregate standard_layout trivially_copyable pod trivial literal has_constexpr_non_copy_move_ctor can_const_default_init
+// CHECK-NEXT: | |-DefaultConstructor exists trivial constexpr needs_implicit defaulted_is_constexpr
+// CHECK-NEXT: | |-CopyConstructor simple trivial has_const_param needs_implicit implicit_has_const_param
+// CHECK-NEXT: | |-MoveConstructor exists simple trivial needs_implicit
+// CHECK-NEXT: | |-CopyAssignment simple trivial has_const_param needs_implicit implicit_has_const_param
+// CHECK-NEXT: | |-MoveAssignment exists simple trivial needs_implicit
+// CHECK-NEXT: | `-Destructor simple irrelevant trivial needs_implicit
+// CHECK-NEXT: `-CXXRecordDecl 0x{{.+}} <col:41, col:48> col:48 implicit struct TestTemplateTemplateDefaultType
+
+
+// PR15220 dump instantiation only once
+namespace testCanonicalTemplate {
+ class A {};
+
+ template<typename T> void TestFunctionTemplate(T);
+ template<typename T> void TestFunctionTemplate(T);
+ void bar(A a) { TestFunctionTemplate(a); }
+ // CHECK: FunctionTemplateDecl 0x{{.+}} <{{.+}}:[[@LINE-3]]:3, col:51> col:29 TestFunctionTemplate
+ // CHECK-NEXT: |-TemplateTypeParmDecl 0x{{.+}} <col:12, col:21> col:21 referenced typename depth 0 index 0 T
+ // CHECK-NEXT: |-FunctionDecl 0x{{.*}} <col:24, col:51> col:29 TestFunctionTemplate 'void (T)'
+ // CHECK-NEXT: | `-ParmVarDecl 0x{{.*}} <col:50> col:51 'T'
+ // CHECK-NEXT: `-FunctionDecl 0x{{.*}} <line:[[@LINE-6]]:24, col:51> col:29 used TestFunctionTemplate 'void (testCanonicalTemplate::A)'
+ // CHECK-NEXT: |-TemplateArgument type 'testCanonicalTemplate::A'
+ // CHECK-NEXT: | `-RecordType 0x{{.+}} 'testCanonicalTemplate::A'
+ // CHECK-NEXT: | `-CXXRecord 0x{{.+}} 'A'
+ // CHECK-NEXT: `-ParmVarDecl 0x{{.*}} <col:50> col:51 'testCanonicalTemplate::A':'testCanonicalTemplate::A'
+
+ // CHECK: FunctionTemplateDecl 0x{{.+}} prev 0x{{.+}} <{{.+}}:[[@LINE-12]]:3, col:51> col:29 TestFunctionTemplate
+ // CHECK-NEXT: |-TemplateTypeParmDecl 0x{{.+}} <col:12, col:21> col:21 referenced typename depth 0 index 0 T
+ // CHECK-NEXT: |-FunctionDecl{{.*}} 0x{{.+}} prev 0x{{.+}} <col:24, col:51> col:29 TestFunctionTemplate 'void (T)'
+ // CHECK-NEXT: | `-ParmVarDecl 0x{{.+}} <col:50> col:51 'T'
+ // CHECK-NEXT: `-Function 0x{{.+}} 'TestFunctionTemplate' 'void (testCanonicalTemplate::A)'
+ // CHECK-NOT: TemplateArgument
+
+ template<typename T1> class TestClassTemplate {
+ template<typename T2> friend class TestClassTemplate;
+ };
+ TestClassTemplate<A> a;
+ // CHECK: ClassTemplateDecl 0x{{.+}} <{{.+}}:[[@LINE-4]]:3, line:[[@LINE-2]]:3> line:[[@LINE-4]]:31 TestClassTemplate
+ // CHECK-NEXT: |-TemplateTypeParmDecl 0x{{.+}} <col:12, col:21> col:21 typename depth 0 index 0 T1
+ // CHECK-NEXT: |-CXXRecordDecl 0x{{.+}} <col:25, line:[[@LINE-4]]:3> line:[[@LINE-6]]:31 class TestClassTemplate definition
+ // CHECK-NEXT: | |-DefinitionData empty aggregate standard_layout trivially_copyable pod trivial literal has_constexpr_non_copy_move_ctor can_const_default_init
+ // CHECK-NEXT: | | |-DefaultConstructor exists trivial constexpr needs_implicit defaulted_is_constexpr
+ // CHECK-NEXT: | | |-CopyConstructor simple trivial has_const_param needs_implicit implicit_has_const_param
+ // CHECK-NEXT: | | |-MoveConstructor exists simple trivial needs_implicit
+ // CHECK-NEXT: | | |-CopyAssignment simple trivial has_const_param needs_implicit implicit_has_const_param
+ // CHECK-NEXT: | | |-MoveAssignment exists simple trivial needs_implicit
+ // CHECK-NEXT: | | `-Destructor simple irrelevant trivial needs_implicit
+ // CHECK-NEXT: | |-CXXRecordDecl 0x{{.+}} <col:25, col:31> col:31 implicit class TestClassTemplate
+ // CHECK-NEXT: | `-FriendDecl 0x{{.+}} <line:[[@LINE-14]]:5, col:40> col:40
+ // CHECK-NEXT: | `-ClassTemplateDecl 0x{{.+}} parent 0x{{.+}} <col:5, col:40> col:40 TestClassTemplate
+ // CHECK-NEXT: | |-TemplateTypeParmDecl 0x{{.+}} <col:14, col:23> col:23 typename depth 1 index 0 T2
+ // CHECK-NEXT: | `-CXXRecordDecl 0x{{.+}} parent 0x{{.+}} <col:34, col:40> col:40 class TestClassTemplate
+ // CHECK-NEXT: `-ClassTemplateSpecializationDecl 0x{{.+}} <line:[[@LINE-19]]:3, line:[[@LINE-17]]:3> line:[[@LINE-19]]:31 class TestClassTemplate definition
+ // CHECK-NEXT: |-DefinitionData pass_in_registers empty aggregate standard_layout trivially_copyable pod trivial literal has_constexpr_non_copy_move_ctor can_const_default_init
+ // CHECK-NEXT: | |-DefaultConstructor exists trivial constexpr defaulted_is_constexpr
+ // CHECK-NEXT: | |-CopyConstructor simple trivial has_const_param implicit_has_const_param
+ // CHECK-NEXT: | |-MoveConstructor exists simple trivial
+ // CHECK-NEXT: | |-CopyAssignment simple trivial has_const_param needs_implicit implicit_has_const_param
+ // CHECK-NEXT: | |-MoveAssignment exists simple trivial needs_implicit
+ // CHECK-NEXT: | `-Destructor simple irrelevant trivial needs_implicit
+ // CHECK-NEXT: |-TemplateArgument type 'testCanonicalTemplate::A'
+ // CHECK-NEXT: | `-RecordType 0x{{.+}} 'testCanonicalTemplate::A'
+ // CHECK-NEXT: | `-CXXRecord 0x{{.+}} 'A'
+ // CHECK-NEXT: |-CXXRecordDecl 0x{{.+}} prev 0x{{.+}} <col:25, col:31> col:31 implicit class TestClassTemplate
+ // CHECK-NEXT: |-FriendDecl 0x{{.+}} <line:[[@LINE-30]]:5, col:40> col:40
+ // CHECK-NEXT: | `-ClassTemplateDecl 0x{{.+}} parent 0x{{.+}} prev 0x{{.+}} <col:5, col:40> col:40 TestClassTemplate
+ // CHECK-NEXT: | |-TemplateTypeParmDecl 0x{{.+}} <col:14, col:23> col:23 typename depth 0 index 0 T2
+ // CHECK-NEXT: | |-CXXRecordDecl 0x{{.+}} parent 0x{{.+}} prev 0x{{.+}} <col:34, col:40> col:40 class TestClassTemplate
+ // CHECK-NEXT: | `-ClassTemplateSpecialization 0x{{.+}} 'TestClassTemplate'
+ // CHECK-NEXT: |-CXXConstructorDecl 0x{{.+}} <line:[[@LINE-36]]:31> col:31 implicit used constexpr TestClassTemplate 'void () noexcept' inline default trivial
+ // CHECK-NEXT: | `-CompoundStmt 0x{{.+}} <col:31>
+ // CHECK-NEXT: |-CXXConstructorDecl 0x{{.+}} <col:31> col:31 implicit constexpr TestClassTemplate 'void (const testCanonicalTemplate::TestClassTemplate<testCanonicalTemplate::A> &)' inline default trivial noexcept-unevaluated 0x{{.+}}
+ // CHECK-NEXT: | `-ParmVarDecl 0x{{.+}} <col:31> col:31 'const testCanonicalTemplate::TestClassTemplate<testCanonicalTemplate::A> &'
+ // CHECK-NEXT: `-CXXConstructorDecl 0x{{.+}} <col:31> col:31 implicit constexpr TestClassTemplate 'void (testCanonicalTemplate::TestClassTemplate<testCanonicalTemplate::A> &&)' inline default trivial noexcept-unevaluated 0x{{.+}}
+ // CHECK-NEXT: `-ParmVarDecl 0x{{.+}} <col:31> col:31 'testCanonicalTemplate::TestClassTemplate<testCanonicalTemplate::A> &&'
+
+
+ template<typename T1> class TestClassTemplate2;
+ template<typename T1> class TestClassTemplate2;
+ template<typename T1> class TestClassTemplate2 {
+ };
+ TestClassTemplate2<A> a2;
+ // CHECK: ClassTemplateDecl 0x{{.+}} <{{.+}}:[[@LINE-5]]:3, col:31> col:31 TestClassTemplate2
+ // CHECK-NEXT: |-TemplateTypeParmDecl 0x{{.+}} <col:12, col:21> col:21 typename depth 0 index 0 T1
+ // CHECK-NEXT: |-CXXRecordDecl 0x{{.+}} <col:25, col:31> col:31 class TestClassTemplate2
+ // CHECK-NEXT: `-ClassTemplateSpecializationDecl 0x{{.+}} <line:[[@LINE-6]]:3, line:[[@LINE-5]]:3> line:[[@LINE-6]]:31 class TestClassTemplate2 definition
+ // CHECK-NEXT: |-DefinitionData pass_in_registers empty aggregate standard_layout trivially_copyable pod trivial literal has_constexpr_non_copy_move_ctor can_const_default_init
+ // CHECK-NEXT: | |-DefaultConstructor exists trivial constexpr defaulted_is_constexpr
+ // CHECK-NEXT: | |-CopyConstructor simple trivial has_const_param implicit_has_const_param
+ // CHECK-NEXT: | |-MoveConstructor exists simple trivial
+ // CHECK-NEXT: | |-CopyAssignment simple trivial has_const_param needs_implicit implicit_has_const_param
+ // CHECK-NEXT: | |-MoveAssignment exists simple trivial needs_implicit
+ // CHECK-NEXT: | `-Destructor simple irrelevant trivial needs_implicit
+ // CHECK-NEXT: |-TemplateArgument type 'testCanonicalTemplate::A'
+ // CHECK-NEXT: | `-RecordType 0x{{.+}} 'testCanonicalTemplate::A'
+ // CHECK-NEXT: | `-CXXRecord 0x{{.+}} 'A'
+ // CHECK-NEXT: |-CXXRecordDecl 0x{{.+}} prev 0x{{.+}} <col:25, col:31> col:31 implicit class TestClassTemplate2
+ // CHECK-NEXT: |-CXXConstructorDecl 0x{{.+}} <col:31> col:31 implicit used constexpr TestClassTemplate2 'void () noexcept' inline default trivial
+ // CHECK-NEXT: | `-CompoundStmt 0x{{.+}} <col:31>
+ // CHECK-NEXT: |-CXXConstructorDecl 0x{{.+}} <col:31> col:31 implicit constexpr TestClassTemplate2 'void (const testCanonicalTemplate::TestClassTemplate2<testCanonicalTemplate::A> &)' inline default trivial noexcept-unevaluated 0x{{.+}}
+ // CHECK-NEXT: | `-ParmVarDecl 0x{{.+}} <col:31> col:31 'const testCanonicalTemplate::TestClassTemplate2<testCanonicalTemplate::A> &'
+ // CHECK-NEXT: `-CXXConstructorDecl 0x{{.+}} <col:31> col:31 implicit constexpr TestClassTemplate2 'void (testCanonicalTemplate::TestClassTemplate2<testCanonicalTemplate::A> &&)' inline default trivial noexcept-unevaluated 0x{{.+}}
+ // CHECK-NEXT: `-ParmVarDecl 0x{{.+}} <col:31> col:31 'testCanonicalTemplate::TestClassTemplate2<testCanonicalTemplate::A> &&'
+
+ // CHECK: ClassTemplateDecl 0x{{.+}} prev 0x{{.+}} <{{.+}}:[[@LINE-26]]:3, col:31> col:31 TestClassTemplate2
+ // CHECK-NEXT: |-TemplateTypeParmDecl 0x{{.+}} <col:12, col:21> col:21 typename depth 0 index 0 T1
+ // CHECK-NEXT: |-CXXRecordDecl 0x{{.+}} prev 0x{{.+}} <col:25, col:31> col:31 class TestClassTemplate2
+ // CHECK-NEXT: `-ClassTemplateSpecialization 0x{{.+}} 'TestClassTemplate2'
+
+ // CHECK: ClassTemplateDecl 0x{{.+}} prev 0x{{.+}} <{{.+}}:[[@LINE-30]]:3, line:[[@LINE-29]]:3> line:[[@LINE-30]]:31 TestClassTemplate2
+ // CHECK-NEXT: |-TemplateTypeParmDecl 0x{{.+}} <col:12, col:21> col:21 typename depth 0 index 0 T1
+ // CHECK-NEXT: |-CXXRecordDecl 0x{{.+}} prev 0x{{.+}} <col:25, line:[[@LINE-31]]:3> line:[[@LINE-32]]:31 class TestClassTemplate2 definition
+ // CHECK-NEXT: | |-DefinitionData empty aggregate standard_layout trivially_copyable pod trivial literal has_constexpr_non_copy_move_ctor can_const_default_init
+ // CHECK-NEXT: | | |-DefaultConstructor exists trivial constexpr needs_implicit defaulted_is_constexpr
+ // CHECK-NEXT: | | |-CopyConstructor simple trivial has_const_param needs_implicit implicit_has_const_param
+ // CHECK-NEXT: | | |-MoveConstructor exists simple trivial needs_implicit
+ // CHECK-NEXT: | | |-CopyAssignment simple trivial has_const_param needs_implicit implicit_has_const_param
+ // CHECK-NEXT: | | |-MoveAssignment exists simple trivial needs_implicit
+ // CHECK-NEXT: | | `-Destructor simple irrelevant trivial needs_implicit
+ // CHECK-NEXT: | `-CXXRecordDecl 0x{{.+}} <col:25, col:31> col:31 implicit class TestClassTemplate2
+ // CHECK-NEXT: `-ClassTemplateSpecialization 0x{{.+}} 'TestClassTemplate2'
+
+ struct S {
+ template<typename T> static const T TestVarTemplate; // declaration of a static data member template
+ };
+ template<typename T>
+ const T S::TestVarTemplate = { }; // definition of a static data member template
+
+ void f()
+ {
+ int i = S::TestVarTemplate<int>;
+ int j = S::TestVarTemplate<int>;
+ }
+
+ // CHECK: VarTemplateDecl 0x{{.+}} <{{.+}}:[[@LINE-11]]:7, col:43> col:43 TestVarTemplate
+ // CHECK-NEXT: |-TemplateTypeParmDecl 0x{{.+}} <col:16, col:25> col:25 referenced typename depth 0 index 0 T
+ // CHECK-NEXT: |-VarDecl 0x{{.+}} <col:28, col:43> col:43 TestVarTemplate 'const T' static
+ // CHECK-NEXT: |-VarTemplateSpecializationDecl 0x{{.+}} parent 0x{{.+}} prev 0x{{.+}} <line:[[@LINE-11]]:3, col:34> col:14 referenced TestVarTemplate 'const int':'const int' cinit
+ // CHECK-NEXT: | |-TemplateArgument type 'int'
+ // CHECK-NEXT: | | `-BuiltinType 0x{{.+}} 'int'
+ // CHECK-NEXT: | `-InitListExpr 0x{{.+}} <col:32, col:34> 'int':'int'
+ // CHECK-NEXT: `-VarTemplateSpecializationDecl 0x{{.+}} <line:[[@LINE-18]]:28, col:43> col:43 referenced TestVarTemplate 'const int':'const int' static
+ // CHECK-NEXT: `-TemplateArgument type 'int'
+
+ // CHECK: VarTemplateSpecializationDecl 0x{{.+}} <{{.+}}:[[@LINE-21]]:28, col:43> col:43 referenced TestVarTemplate 'const int':'const int' static
+ // CHECK-NEXT:`-TemplateArgument type 'int'
+ // CHECK-NEXT: `-BuiltinType 0x{{.+}} 'int'
+
+ // CHECK: VarTemplateDecl 0x{{.+}} parent 0x{{.+}} prev 0x{{.+}} <{{.+}}:[[@LINE-23]]:3, line:[[@LINE-22]]:34> col:14 TestVarTemplate
+ // CHECK-NEXT: |-TemplateTypeParmDecl 0x{{.+}} <line:[[@LINE-24]]:12, col:21> col:21 referenced typename depth 0 index 0 T
+ // CHECK-NEXT: |-VarDecl 0x{{.+}} parent 0x{{.+}} prev 0x{{.+}} <line:[[@LINE-24]]:3, col:34> col:14 TestVarTemplate 'const T' cinit
+ // CHECK-NEXT: | `-InitListExpr 0x{{.+}} <col:32, col:34> 'void'
+ // CHECK-NEXT: |-VarTemplateSpecialization 0x{{.+}} 'TestVarTemplate' 'const int':'const int'
+ // CHECK-NEXT: `-VarTemplateSpecialization 0x{{.+}} 'TestVarTemplate' 'const int':'const int'
+
+ // CHECK: VarTemplateSpecializationDecl 0x{{.+}} parent 0x{{.+}} prev 0x{{.+}} <{{.+}}:[[@LINE-29]]:3, col:34> col:14 referenced TestVarTemplate 'const int':'const int' cinit
+ // CHECK-NEXT: |-TemplateArgument type 'int'
+ // CHECK-NEXT: | `-BuiltinType 0x{{.+}} 'int'
+ // CHECK-NEXT: `-InitListExpr 0x{{.+}} <col:32, col:34> 'int':'int'
+}
+
+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: ParmVarDecl
+// CHECK-NEXT: CompoundStmt
+// CHECK-NEXT: TemplateArgument{{.*}} 'int'
+
+namespace TestTemplateTypeParmDecl {
+ template<typename ... T, class U = int> void foo();
+}
+// CHECK: NamespaceDecl{{.*}} TestTemplateTypeParmDecl
+// CHECK-NEXT: FunctionTemplateDecl
+// CHECK-NEXT: TemplateTypeParmDecl{{.*}} typename depth 0 index 0 ... T
+// CHECK-NEXT: TemplateTypeParmDecl{{.*}} class depth 0 index 1 U
+// CHECK-NEXT: TemplateArgument type 'int'
+
+namespace TestNonTypeTemplateParmDecl {
+ template<int I = 1, int ... J> void foo();
+}
+// CHECK: NamespaceDecl{{.*}} TestNonTypeTemplateParmDecl
+// CHECK-NEXT: FunctionTemplateDecl
+// CHECK-NEXT: NonTypeTemplateParmDecl{{.*}} 'int' depth 0 index 0 I
+// CHECK-NEXT: TemplateArgument expr
+// CHECK-NEXT: ConstantExpr{{.*}} 'int'
+// CHECK-NEXT: value: Int 1
+// CHECK-NEXT: IntegerLiteral{{.*}} 'int' 1
+// CHECK-NEXT: NonTypeTemplateParmDecl{{.*}} 'int' depth 0 index 1 ... 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: TemplateArgument{{.*}} type 'int'
+
+ template<int fp(void)> class testDecl { };
+ template class testDecl<foo>;
+ // CHECK: ClassTemplateSpecializationDecl{{.*}} class testDecl
+ // CHECK: TemplateArgument{{.*}} decl
+ // CHECK-NEXT: Function{{.*}}foo
+
+ template class testDecl<nullptr>;
+ // CHECK: ClassTemplateSpecializationDecl{{.*}} class testDecl
+ // CHECK: TemplateArgument{{.*}} nullptr
+
+ template<int> class testIntegral { };
+ template class testIntegral<1>;
+ // CHECK: ClassTemplateSpecializationDecl{{.*}} class testIntegral
+ // CHECK: TemplateArgument{{.*}} integral 1
+
+ template<template<typename> class> class testTemplate { };
+ template class testTemplate<A>;
+ // CHECK: ClassTemplateSpecializationDecl{{.*}} class testTemplate
+ // CHECK: 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: TemplateArgument{{.*}} expr
+ // CHECK-NEXT: DeclRefExpr{{.*}}I
+
+ template<int, int ...> class testPack { };
+ template class testPack<0, 1, 2>;
+ // CHECK: ClassTemplateSpecializationDecl{{.*}} class testPack
+ // CHECK: 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: 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: CXXRecord{{.*}} TestFriendDecl
+// CHECK-NEXT: FriendDecl
+// CHECK-NEXT: FunctionDecl{{.*}} foo
+// CHECK-NEXT: FriendDecl{{.*}} 'class A':'A'
+// CHECK-NEXT: FriendDecl{{.*}} 'T'
+
+namespace TestFileScopeAsmDecl {
+ asm("ret");
+}
+// CHECK: NamespaceDecl{{.*}} TestFileScopeAsmDecl{{$}}
+// CHECK: FileScopeAsmDecl{{.*> .*$}}
+// CHECK-NEXT: StringLiteral
+
+namespace TestFriendDecl2 {
+ void f();
+ struct S {
+ friend void f();
+ };
+}
+// CHECK: NamespaceDecl [[TestFriendDecl2:0x.*]] <{{.*}}> {{.*}} TestFriendDecl2
+// CHECK: |-FunctionDecl [[TestFriendDecl2_f:0x.*]] <{{.*}}> {{.*}} f 'void ()'
+// CHECK: `-CXXRecordDecl {{.*}} struct S
+// CHECK: |-CXXRecordDecl {{.*}} struct S
+// CHECK: `-FriendDecl
+// CHECK: `-FunctionDecl {{.*}} parent [[TestFriendDecl2]] prev [[TestFriendDecl2_f]] <{{.*}}> {{.*}} f 'void ()'
+
+namespace Comment {
+ extern int Test;
+ /// Something here.
+ extern int Test;
+ extern int Test;
+}
+
+// CHECK: VarDecl {{.*}} Test 'int' extern
+// CHECK-NOT: FullComment
+// CHECK: VarDecl {{.*}} Test 'int' extern
+// CHECK: `-FullComment
+// CHECK: `-ParagraphComment
+// CHECK: `-TextComment
+// CHECK: VarDecl {{.*}} Test 'int' extern
+// CHECK-NOT: FullComment
diff --git a/clang/test/AST/ast-dump-invalid.cpp b/clang/test/AST/ast-dump-invalid.cpp
index 8f7e6eb14e5e3..d0db13786306a 100644
--- a/clang/test/AST/ast-dump-invalid.cpp
+++ b/clang/test/AST/ast-dump-invalid.cpp
@@ -1,62 +1,62 @@
-// RUN: not %clang_cc1 -std=c++11 -triple x86_64-linux-gnu -fms-extensions -ast-dump -ast-dump-filter Test %s | FileCheck -check-prefix CHECK -strict-whitespace %s
-
-namespace TestInvalidRParenOnCXXUnresolvedConstructExpr {
-template <class T>
-void f(T i, T j) {
- return T (i, j;
-}
-}
-
-// CHECK: NamespaceDecl {{.*}} <{{.*}}> {{.*}} TestInvalidRParenOnCXXUnresolvedConstructExpr
-// CHECK-NEXT: `-FunctionTemplateDecl
-// CHECK-NEXT: |-TemplateTypeParmDecl
-// CHECK-NEXT: `-FunctionDecl
-// CHECK-NEXT: |-ParmVarDecl
-// CHECK-NEXT: |-ParmVarDecl
-// CHECK-NEXT: `-CompoundStmt
-// CHECK-NEXT: `-ReturnStmt
-// CHECK-NEXT: `-CXXUnresolvedConstructExpr {{.*}} <col:10, col:16> 'T'
-// CHECK-NEXT: |-DeclRefExpr {{.*}} <col:13> 'T' lvalue ParmVar {{.*}} 'i' 'T'
-// CHECK-NEXT: `-DeclRefExpr {{.*}} <col:16> 'T' lvalue ParmVar {{.*}} 'j' 'T'
-
-
-namespace TestInvalidIf {
-int g(int i) {
- if (invalid_condition)
- return 4;
- else
- return i;
-}
-}
-// CHECK: NamespaceDecl {{.*}} <{{.*}}> {{.*}} TestInvalidIf
-// CHECK-NEXT: `-FunctionDecl
-// CHECK-NEXT: |-ParmVarDecl
-// CHECK-NEXT: `-CompoundStmt
-// CHECK-NEXT: `-IfStmt {{.*}} <line:25:3, line:28:12>
-// CHECK-NEXT: |-OpaqueValueExpr {{.*}} <<invalid sloc>> 'bool'
-// CHECK-NEXT: |-ReturnStmt {{.*}} <line:26:5, col:12>
-// CHECK-NEXT: | `-IntegerLiteral {{.*}} <col:12> 'int' 4
-// CHECK-NEXT: `-ReturnStmt {{.*}} <line:28:5, col:12>
-// CHECK-NEXT: `-ImplicitCastExpr {{.*}} <col:12> 'int' <LValueToRValue>
-// CHECK-NEXT: `-DeclRefExpr {{.*}} <col:12> 'int' lvalue ParmVar {{.*}} 'i' 'int'
-
-namespace TestInvalidFunctionDecl {
-struct Str {
- double foo1(double, invalid_type);
-};
-double Str::foo1(double, invalid_type)
-{ return 45; }
-}
-// CHECK: NamespaceDecl {{.*}} <{{.*}}> {{.*}} TestInvalidFunctionDecl
-// CHECK-NEXT: |-CXXRecordDecl {{.*}} <line:44:1, line:46:1> line:44:8 struct Str definition
-// CHECK: | |-CXXRecordDecl {{.*}} <col:1, col:8> col:8 implicit struct Str
-// CHECK-NEXT: | `-CXXMethodDecl {{.*}} <line:45:4, col:36> col:11 invalid foo1 'double (double, int)'
-// CHECK-NEXT: | |-ParmVarDecl {{.*}} <col:16> col:22 'double'
-// CHECK-NEXT: | `-ParmVarDecl {{.*}} <col:24, <invalid sloc>> col:36 invalid 'int'
-// CHECK-NEXT: `-CXXMethodDecl {{.*}} parent {{.*}} <line:47:1, line:48:14> line:47:13 invalid foo1 'double (double, int)'
-// CHECK-NEXT: |-ParmVarDecl {{.*}} <col:18> col:24 'double'
-// CHECK-NEXT: |-ParmVarDecl {{.*}} <col:26, <invalid sloc>> col:38 invalid 'int'
-// CHECK-NEXT: `-CompoundStmt {{.*}} <line:48:1, col:14>
-// CHECK-NEXT: `-ReturnStmt {{.*}} <col:3, col:10>
-// CHECK-NEXT: `-ImplicitCastExpr {{.*}} <col:10> 'double' <IntegralToFloating>
-// CHECK-NEXT: `-IntegerLiteral {{.*}} <col:10> 'int' 45
+// RUN: not %clang_cc1 -std=c++11 -triple x86_64-linux-gnu -fms-extensions -ast-dump -ast-dump-filter Test %s | FileCheck -check-prefix CHECK -strict-whitespace %s
+
+namespace TestInvalidRParenOnCXXUnresolvedConstructExpr {
+template <class T>
+void f(T i, T j) {
+ return T (i, j;
+}
+}
+
+// CHECK: NamespaceDecl {{.*}} <{{.*}}> {{.*}} TestInvalidRParenOnCXXUnresolvedConstructExpr
+// CHECK-NEXT: `-FunctionTemplateDecl
+// CHECK-NEXT: |-TemplateTypeParmDecl
+// CHECK-NEXT: `-FunctionDecl
+// CHECK-NEXT: |-ParmVarDecl
+// CHECK-NEXT: |-ParmVarDecl
+// CHECK-NEXT: `-CompoundStmt
+// CHECK-NEXT: `-ReturnStmt
+// CHECK-NEXT: `-CXXUnresolvedConstructExpr {{.*}} <col:10, col:16> 'T'
+// CHECK-NEXT: |-DeclRefExpr {{.*}} <col:13> 'T' lvalue ParmVar {{.*}} 'i' 'T'
+// CHECK-NEXT: `-DeclRefExpr {{.*}} <col:16> 'T' lvalue ParmVar {{.*}} 'j' 'T'
+
+
+namespace TestInvalidIf {
+int g(int i) {
+ if (invalid_condition)
+ return 4;
+ else
+ return i;
+}
+}
+// CHECK: NamespaceDecl {{.*}} <{{.*}}> {{.*}} TestInvalidIf
+// CHECK-NEXT: `-FunctionDecl
+// CHECK-NEXT: |-ParmVarDecl
+// CHECK-NEXT: `-CompoundStmt
+// CHECK-NEXT: `-IfStmt {{.*}} <line:25:3, line:28:12>
+// CHECK-NEXT: |-OpaqueValueExpr {{.*}} <<invalid sloc>> 'bool'
+// CHECK-NEXT: |-ReturnStmt {{.*}} <line:26:5, col:12>
+// CHECK-NEXT: | `-IntegerLiteral {{.*}} <col:12> 'int' 4
+// CHECK-NEXT: `-ReturnStmt {{.*}} <line:28:5, col:12>
+// CHECK-NEXT: `-ImplicitCastExpr {{.*}} <col:12> 'int' <LValueToRValue>
+// CHECK-NEXT: `-DeclRefExpr {{.*}} <col:12> 'int' lvalue ParmVar {{.*}} 'i' 'int'
+
+namespace TestInvalidFunctionDecl {
+struct Str {
+ double foo1(double, invalid_type);
+};
+double Str::foo1(double, invalid_type)
+{ return 45; }
+}
+// CHECK: NamespaceDecl {{.*}} <{{.*}}> {{.*}} TestInvalidFunctionDecl
+// CHECK-NEXT: |-CXXRecordDecl {{.*}} <line:44:1, line:46:1> line:44:8 struct Str definition
+// CHECK: | |-CXXRecordDecl {{.*}} <col:1, col:8> col:8 implicit struct Str
+// CHECK-NEXT: | `-CXXMethodDecl {{.*}} <line:45:4, col:36> col:11 invalid foo1 'double (double, int)'
+// CHECK-NEXT: | |-ParmVarDecl {{.*}} <col:16> col:22 'double'
+// CHECK-NEXT: | `-ParmVarDecl {{.*}} <col:24, <invalid sloc>> col:36 invalid 'int'
+// CHECK-NEXT: `-CXXMethodDecl {{.*}} parent {{.*}} <line:47:1, line:48:14> line:47:13 invalid foo1 'double (double, int)'
+// CHECK-NEXT: |-ParmVarDecl {{.*}} <col:18> col:24 'double'
+// CHECK-NEXT: |-ParmVarDecl {{.*}} <col:26, <invalid sloc>> col:38 invalid 'int'
+// CHECK-NEXT: `-CompoundStmt {{.*}} <line:48:1, col:14>
+// CHECK-NEXT: `-ReturnStmt {{.*}} <col:3, col:10>
+// CHECK-NEXT: `-ImplicitCastExpr {{.*}} <col:10> 'double' <IntegralToFloating>
+// CHECK-NEXT: `-IntegerLiteral {{.*}} <col:10> 'int' 45
diff --git a/clang/test/AST/ast-dump-stmt.c b/clang/test/AST/ast-dump-stmt.c
index dddd0e290d4ef..50b37196e6fe4 100644
--- a/clang/test/AST/ast-dump-stmt.c
+++ b/clang/test/AST/ast-dump-stmt.c
@@ -38,356 +38,356 @@ int TestOpaqueValueExpr = 0 ?: 1;
// CHECK-NEXT: IntegerLiteral
// CHECK-NEXT: OpaqueValueExpr
// CHECK-NEXT: IntegerLiteral
-// CHECK-NEXT: OpaqueValueExpr
-// CHECK-NEXT: IntegerLiteral
-// CHECK-NEXT: IntegerLiteral
-
-void TestUnaryOperatorExpr(void) {
- char T1 = 1;
- int T2 = 1;
-
- T1++;
- T2++;
- // CHECK: UnaryOperator{{.*}}postfix '++' cannot overflow
- // CHECK-NEXT: DeclRefExpr{{.*}}'T1' 'char'
- // CHECK-NOT: UnaryOperator{{.*}}postfix '++' cannot overflow
- // CHECK: DeclRefExpr{{.*}}'T2' 'int'
-
- -T1;
- -T2;
- // CHECK: UnaryOperator{{.*}}prefix '-' cannot overflow
- // CHECK-NEXT: ImplicitCastExpr
- // CHECK-NEXT: ImplicitCastExpr
- // CHECK-NEXT: DeclRefExpr{{.*}}'T1' 'char'
- // CHECK-NOT: UnaryOperator{{.*}}prefix '-' cannot overflow
- // CHECK: ImplicitCastExpr
- // CHECK: DeclRefExpr{{.*}}'T2' 'int'
-
- ~T1;
- ~T2;
- // CHECK: UnaryOperator{{.*}}prefix '~' cannot overflow
- // CHECK-NEXT: ImplicitCastExpr
- // CHECK-NEXT: ImplicitCastExpr
- // CHECK-NEXT: DeclRefExpr{{.*}}'T1' 'char'
- // CHECK: UnaryOperator{{.*}}prefix '~' cannot overflow
- // CHECK-NEXT: ImplicitCastExpr
- // CHECK-NEXT: DeclRefExpr{{.*}}'T2' 'int'
-}
-
-void TestGenericSelectionExpressions(int i) {
- _Generic(i, int : 12);
- // CHECK: GenericSelectionExpr 0x{{[^ ]*}} <line:[[@LINE-1]]:3, col:23> 'int'
- // CHECK-NEXT: ImplicitCastExpr 0x{{[^ ]*}}
- // CHECK-NEXT: DeclRefExpr 0x{{[^ ]*}} <col:12> 'int' lvalue ParmVar 0x{{[^ ]*}} 'i' 'int'
- // CHECK-NEXT: BuiltinType 0x{{[^ ]*}} 'int'
- // FIXME: note that the following test line has a spurious whitespace.
- // CHECK-NEXT: case 'int' selected
- // CHECK-NEXT: BuiltinType 0x{{[^ ]*}} 'int'
- // CHECK-NEXT: IntegerLiteral 0x{{[^ ]*}} <col:21> 'int' 12
- _Generic(i, int : 12, default : 0);
- // CHECK: GenericSelectionExpr 0x{{[^ ]*}} <line:[[@LINE-1]]:3, col:36> 'int'
- // CHECK-NEXT: ImplicitCastExpr 0x{{[^ ]*}}
- // CHECK-NEXT: DeclRefExpr 0x{{[^ ]*}} <col:12> 'int' lvalue ParmVar 0x{{[^ ]*}} 'i' 'int'
- // CHECK-NEXT: BuiltinType 0x{{[^ ]*}} 'int'
- // FIXME: note that the following test line has a spurious whitespace.
- // CHECK-NEXT: case 'int' selected
- // CHECK-NEXT: BuiltinType 0x{{[^ ]*}} 'int'
- // CHECK-NEXT: IntegerLiteral 0x{{[^ ]*}} <col:21> 'int' 12
- // CHECK-NEXT: default
- // CHECK-NEXT: IntegerLiteral 0x{{[^ ]*}} <col:35> 'int' 0
- _Generic(i, default : 0, int : 12);
- // CHECK: GenericSelectionExpr 0x{{[^ ]*}} <line:[[@LINE-1]]:3, col:36> 'int'
- // CHECK-NEXT: ImplicitCastExpr 0x{{[^ ]*}}
- // CHECK-NEXT: DeclRefExpr 0x{{[^ ]*}} <col:12> 'int' lvalue ParmVar 0x{{[^ ]*}} 'i' 'int'
- // CHECK-NEXT: BuiltinType 0x{{[^ ]*}} 'int'
- // CHECK-NEXT: default
- // CHECK-NEXT: IntegerLiteral 0x{{[^ ]*}} <col:25> 'int' 0
- // FIXME: note that the following test line has a spurious whitespace.
- // CHECK-NEXT: case 'int' selected
- // CHECK-NEXT: BuiltinType 0x{{[^ ]*}} 'int'
- // CHECK-NEXT: IntegerLiteral 0x{{[^ ]*}} <col:34> 'int' 12
- _Generic(i, int : 12, float : 10, default : 100);
- // CHECK: GenericSelectionExpr 0x{{[^ ]*}} <line:[[@LINE-1]]:3, col:50> 'int'
- // CHECK-NEXT: ImplicitCastExpr 0x{{[^ ]*}}
- // CHECK-NEXT: DeclRefExpr 0x{{[^ ]*}} <col:12> 'int' lvalue ParmVar 0x{{[^ ]*}} 'i' 'int'
- // CHECK-NEXT: BuiltinType 0x{{[^ ]*}} 'int'
- // FIXME: note that the following test line has a spurious whitespace.
- // CHECK-NEXT: case 'int' selected
- // CHECK-NEXT: BuiltinType 0x{{[^ ]*}} 'int'
- // CHECK-NEXT: IntegerLiteral 0x{{[^ ]*}} <col:21> 'int' 12
- // FIXME: note that the following test line has a spurious whitespace.
- // CHECK-NEXT: case 'float'
- // CHECK-NEXT: BuiltinType 0x{{[^ ]*}} 'float'
- // CHECK-NEXT: IntegerLiteral 0x{{[^ ]*}} <col:33> 'int' 10
- // CHECK-NEXT: default
- // CHECK-NEXT: IntegerLiteral 0x{{[^ ]*}} <col:47> 'int' 100
-
- int j = _Generic(i, int : 12);
- // CHECK: DeclStmt 0x{{[^ ]*}} <line:[[@LINE-1]]:3, col:32>
- // CHECK-NEXT: VarDecl 0x{{[^ ]*}} <col:3, col:31> col:7 j 'int' cinit
- // CHECK-NEXT: GenericSelectionExpr 0x{{[^ ]*}} <col:11, col:31> 'int'
- // CHECK-NEXT: ImplicitCastExpr 0x{{[^ ]*}}
- // CHECK-NEXT: DeclRefExpr 0x{{[^ ]*}} <col:20> 'int' lvalue ParmVar 0x{{[^ ]*}} 'i' 'int'
- // CHECK-NEXT: BuiltinType 0x{{[^ ]*}} 'int'
- // FIXME: note that the following test line has a spurious whitespace.
- // CHECK-NEXT: case 'int' selected
- // CHECK-NEXT: BuiltinType 0x{{[^ ]*}} 'int'
- // CHECK-NEXT: IntegerLiteral 0x{{[^ ]*}} <col:29> 'int' 12
-}
-
-void TestLabelsAndGoto(void) {
- // Note: case and default labels are handled by TestSwitch().
-
-label1:
- ;
- // CHECK: LabelStmt 0x{{[^ ]*}} <line:[[@LINE-2]]:1, line:[[@LINE-1]]:3> 'label1'
- // CHECK-NEXT: NullStmt 0x{{[^ ]*}} <col:3>
-
- goto label2;
- // CHECK-NEXT: GotoStmt 0x{{[^ ]*}} <line:[[@LINE-1]]:3, col:8> 'label2' 0x{{[^ ]*}}
-
-label2:
- 0;
- // CHECK-NEXT: LabelStmt 0x{{[^ ]*}} <line:[[@LINE-2]]:1, line:[[@LINE-1]]:3> 'label2'
- // CHECK-NEXT: IntegerLiteral 0x{{[^ ]*}} <col:3> 'int' 0
-
- void *ptr = &&label1;
- // CHECK-NEXT: DeclStmt
- // CHECK-NEXT: VarDecl
- // CHECK-NEXT: AddrLabelExpr 0x{{[^ ]*}} <col:15, col:17> 'void *' label1 0x{{[^ ]*}}
-
- goto *ptr;
- // CHECK-NEXT: IndirectGotoStmt 0x{{[^ ]*}} <line:[[@LINE-1]]:3, col:9>
- // CHECK-NEXT: ImplicitCastExpr
- // CHECK-NEXT: ImplicitCastExpr
- // CHECK-NEXT: DeclRefExpr 0x{{[^ ]*}} <col:9> 'void *' lvalue Var 0x{{[^ ]*}} 'ptr' 'void *'
-}
-
-void TestSwitch(int i) {
- switch (i) {
- // CHECK: SwitchStmt 0x{{[^ ]*}} <line:[[@LINE-1]]:3, line:[[@LINE+32]]:3>
- // CHECK-NEXT: ImplicitCastExpr
- // CHECK-NEXT: DeclRefExpr 0x{{[^ ]*}} <col:11> 'int' lvalue ParmVar 0x{{[^ ]*}} 'i' 'int'
- // CHECK-NEXT: CompoundStmt 0x{{[^ ]*}} <col:14, line:[[@LINE+29]]:3>
- case 0:
- break;
- // CHECK-NEXT: CaseStmt 0x{{[^ ]*}} <line:[[@LINE-2]]:3, line:[[@LINE-1]]:5>
- // CHECK-NEXT: ConstantExpr
- // CHECK-NEXT: IntegerLiteral 0x{{[^ ]*}} <col:8> 'int' 0
- // CHECK-NEXT: BreakStmt 0x{{[^ ]*}} <line:[[@LINE-4]]:5>
- case 1:
- case 2:
- break;
- // CHECK-NEXT: CaseStmt 0x{{[^ ]*}} <line:[[@LINE-3]]:3, line:[[@LINE-1]]:5>
- // CHECK-NEXT: ConstantExpr
- // CHECK-NEXT: IntegerLiteral 0x{{[^ ]*}} <col:8> 'int' 1
- // CHECK-NEXT: CaseStmt 0x{{[^ ]*}} <line:[[@LINE-5]]:3, line:[[@LINE-4]]:5>
- // CHECK-NEXT: ConstantExpr
- // CHECK-NEXT: IntegerLiteral 0x{{[^ ]*}} <col:8> 'int' 2
- // CHECK-NEXT: BreakStmt 0x{{[^ ]*}} <line:[[@LINE-7]]:5>
- default:
- break;
- // CHECK-NEXT: DefaultStmt 0x{{[^ ]*}} <line:[[@LINE-2]]:3, line:[[@LINE-1]]:5>
- // CHECK-NEXT: BreakStmt 0x{{[^ ]*}} <col:5>
- case 3 ... 5:
- break;
- // CHECK-NEXT: CaseStmt 0x{{[^ ]*}} <line:[[@LINE-2]]:3, line:[[@LINE-1]]:5> gnu_range
- // CHECK-NEXT: ConstantExpr
- // CHECK-NEXT: IntegerLiteral 0x{{[^ ]*}} <col:8> 'int' 3
- // CHECK-NEXT: ConstantExpr
- // CHECK-NEXT: IntegerLiteral 0x{{[^ ]*}} <col:14> 'int' 5
- // CHECK-NEXT: BreakStmt 0x{{[^ ]*}} <line:[[@LINE-6]]:5>
- }
-}
-
-void TestIf(_Bool b) {
- if (b)
- ;
- // CHECK: IfStmt 0x{{[^ ]*}} <line:[[@LINE-2]]:3, line:[[@LINE-1]]:5>
- // CHECK-NEXT: ImplicitCastExpr
- // CHECK-NEXT: DeclRefExpr 0x{{[^ ]*}} <col:7> '_Bool' lvalue ParmVar 0x{{[^ ]*}} 'b' '_Bool'
- // CHECK-NEXT: NullStmt
-
- if (b) {}
- // CHECK: IfStmt 0x{{[^ ]*}} <line:[[@LINE-1]]:3, col:11>
- // CHECK-NEXT: ImplicitCastExpr
- // CHECK-NEXT: DeclRefExpr 0x{{[^ ]*}} <col:7> '_Bool' lvalue ParmVar 0x{{[^ ]*}} 'b' '_Bool'
- // CHECK-NEXT: CompoundStmt
-
- if (b)
- ;
- else
- ;
- // CHECK: IfStmt 0x{{[^ ]*}} <line:[[@LINE-4]]:3, line:[[@LINE-1]]:5> has_else
- // CHECK-NEXT: ImplicitCastExpr
- // CHECK-NEXT: DeclRefExpr 0x{{[^ ]*}} <col:7> '_Bool' lvalue ParmVar 0x{{[^ ]*}} 'b' '_Bool'
- // CHECK-NEXT: NullStmt 0x{{[^ ]*}} <line:[[@LINE-6]]:5>
- // CHECK-NEXT: NullStmt 0x{{[^ ]*}} <line:[[@LINE-5]]:5>
-
- if (b) {}
- else {}
- // CHECK: IfStmt 0x{{[^ ]*}} <line:[[@LINE-2]]:3, line:[[@LINE-1]]:9> has_else
- // CHECK-NEXT: ImplicitCastExpr
- // CHECK-NEXT: DeclRefExpr 0x{{[^ ]*}} <col:7> '_Bool' lvalue ParmVar 0x{{[^ ]*}} 'b' '_Bool'
- // CHECK-NEXT: CompoundStmt 0x{{[^ ]*}} <col:10, col:11>
- // CHECK-NEXT: CompoundStmt 0x{{[^ ]*}} <line:[[@LINE-5]]:8, col:9>
-
- if (b)
- ;
- else if (b)
- ;
- // CHECK: IfStmt 0x{{[^ ]*}} <line:[[@LINE-4]]:3, line:[[@LINE-1]]:5> has_else
- // CHECK-NEXT: ImplicitCastExpr
- // CHECK-NEXT: DeclRefExpr 0x{{[^ ]*}} <col:7> '_Bool' lvalue ParmVar 0x{{[^ ]*}} 'b' '_Bool'
- // CHECK-NEXT: NullStmt 0x{{[^ ]*}} <line:[[@LINE-6]]:5>
- // CHECK-NEXT: IfStmt 0x{{[^ ]*}} <line:[[@LINE-6]]:8, line:[[@LINE-5]]:5>
- // CHECK-NEXT: ImplicitCastExpr
- // CHECK-NEXT: DeclRefExpr 0x{{[^ ]*}} <col:12> '_Bool' lvalue ParmVar 0x{{[^ ]*}} 'b' '_Bool'
- // CHECK-NEXT: NullStmt 0x{{[^ ]*}} <line:[[@LINE-8]]:5>
-
- if (b)
- ;
- else if (b)
- ;
- else
- ;
- // CHECK: IfStmt 0x{{[^ ]*}} <line:[[@LINE-6]]:3, line:[[@LINE-1]]:5> has_else
- // CHECK-NEXT: ImplicitCastExpr
- // CHECK-NEXT: DeclRefExpr 0x{{[^ ]*}} <col:7> '_Bool' lvalue ParmVar 0x{{[^ ]*}} 'b' '_Bool'
- // CHECK-NEXT: NullStmt 0x{{[^ ]*}} <line:[[@LINE-8]]:5>
- // CHECK-NEXT: IfStmt 0x{{[^ ]*}} <line:[[@LINE-8]]:8, line:[[@LINE-5]]:5> has_else
- // CHECK-NEXT: ImplicitCastExpr
- // CHECK-NEXT: DeclRefExpr 0x{{[^ ]*}} <col:12> '_Bool' lvalue ParmVar 0x{{[^ ]*}} 'b' '_Bool'
- // CHECK-NEXT: NullStmt 0x{{[^ ]*}} <line:[[@LINE-10]]:5>
- // CHECK-NEXT: NullStmt 0x{{[^ ]*}} <line:[[@LINE-9]]:5>
-}
-
-void TestIteration(_Bool b) {
- while (b)
- ;
- // CHECK: WhileStmt 0x{{[^ ]*}} <line:[[@LINE-2]]:3, line:[[@LINE-1]]:5>
- // CHECK-NEXT: ImplicitCastExpr
- // CHECK-NEXT: DeclRefExpr 0x{{[^ ]*}} <col:10> '_Bool' lvalue ParmVar 0x{{[^ ]*}} 'b' '_Bool'
- // CHECK-NEXT: NullStmt 0x{{[^ ]*}} <line:[[@LINE-4]]:5>
-
- do
- ;
- while (b);
- // CHECK: DoStmt 0x{{[^ ]*}} <line:[[@LINE-3]]:3, line:[[@LINE-1]]:11>
- // CHECK-NEXT: NullStmt 0x{{[^ ]*}} <line:[[@LINE-3]]:5>
- // CHECK-NEXT: ImplicitCastExpr
- // CHECK-NEXT: DeclRefExpr 0x{{[^ ]*}} <col:10> '_Bool' lvalue ParmVar 0x{{[^ ]*}} 'b' '_Bool'
-
- for (int i = 0; i < 10; ++i)
- ;
- // CHECK: ForStmt 0x{{[^ ]*}} <line:[[@LINE-2]]:3, line:[[@LINE-1]]:5>
- // CHECK-NEXT: DeclStmt
- // CHECK-NEXT: VarDecl 0x{{[^ ]*}} <col:8, col:16> col:12 used i 'int' cinit
- // CHECK-NEXT: IntegerLiteral 0x{{[^ ]*}} <col:16> 'int' 0
- // CHECK-NEXT: <<<NULL>>>
- // CHECK-NEXT: BinaryOperator 0x{{[^ ]*}} <col:19, col:23> 'int' '<'
- // CHECK-NEXT: ImplicitCastExpr
- // CHECK-NEXT: DeclRefExpr 0x{{[^ ]*}} <col:19> 'int' lvalue Var 0x{{[^ ]*}} 'i' 'int'
- // CHECK-NEXT: IntegerLiteral 0x{{[^ ]*}} <col:23> 'int' 10
- // CHECK-NEXT: UnaryOperator 0x{{[^ ]*}} <col:27, col:29> 'int' prefix '++'
- // CHECK-NEXT: DeclRefExpr 0x{{[^ ]*}} <col:29> 'int' lvalue Var 0x{{[^ ]*}} 'i' 'int'
- // CHECK-NEXT: NullStmt
-
- for (b; b; b)
- ;
- // CHECK: ForStmt 0x{{[^ ]*}} <line:[[@LINE-2]]:3, line:[[@LINE-1]]:5>
- // CHECK-NEXT: ImplicitCastExpr
- // CHECK-NEXT: DeclRefExpr 0x{{[^ ]*}} <col:8> '_Bool' lvalue ParmVar 0x{{[^ ]*}} 'b' '_Bool'
- // CHECK-NEXT: <<<NULL>>>
- // CHECK-NEXT: ImplicitCastExpr
- // CHECK-NEXT: DeclRefExpr 0x{{[^ ]*}} <col:11> '_Bool' lvalue ParmVar 0x{{[^ ]*}} 'b' '_Bool'
- // CHECK-NEXT: ImplicitCastExpr
- // CHECK-NEXT: DeclRefExpr 0x{{[^ ]*}} <col:14> '_Bool' lvalue ParmVar 0x{{[^ ]*}} 'b' '_Bool'
- // CHECK-NEXT: NullStmt
-
- for (; b; b = !b)
- ;
- // CHECK: ForStmt 0x{{[^ ]*}} <line:[[@LINE-2]]:3, line:[[@LINE-1]]:5>
- // CHECK-NEXT: <<<NULL>>>
- // CHECK-NEXT: <<<NULL>>>
- // CHECK-NEXT: ImplicitCastExpr
- // CHECK-NEXT: DeclRefExpr 0x{{[^ ]*}} <col:10> '_Bool' lvalue ParmVar 0x{{[^ ]*}} 'b' '_Bool'
- // CHECK-NEXT: BinaryOperator 0x{{[^ ]*}} <col:13, col:18> '_Bool' '='
- // CHECK-NEXT: DeclRefExpr 0x{{[^ ]*}} <col:13> '_Bool' lvalue ParmVar 0x{{[^ ]*}} 'b' '_Bool'
- // CHECK-NEXT: ImplicitCastExpr
- // CHECK-NEXT: UnaryOperator 0x{{[^ ]*}} <col:17, col:18> 'int' prefix '!' cannot overflow
- // CHECK-NEXT: ImplicitCastExpr
- // CHECK-NEXT: DeclRefExpr 0x{{[^ ]*}} <col:18> '_Bool' lvalue ParmVar 0x{{[^ ]*}} 'b' '_Bool'
- // CHECK-NEXT: NullStmt
-
- for (; b;)
- ;
- // CHECK: ForStmt 0x{{[^ ]*}} <line:[[@LINE-2]]:3, line:[[@LINE-1]]:5>
- // CHECK-NEXT: <<<NULL>>>
- // CHECK-NEXT: <<<NULL>>>
- // CHECK-NEXT: ImplicitCastExpr
- // CHECK-NEXT: DeclRefExpr 0x{{[^ ]*}} <col:10> '_Bool' lvalue ParmVar 0x{{[^ ]*}} 'b' '_Bool'
- // CHECK-NEXT: <<<NULL>>>
- // CHECK-NEXT: NullStmt
-
- for (;; b = !b)
- ;
- // CHECK: ForStmt 0x{{[^ ]*}} <line:[[@LINE-2]]:3, line:[[@LINE-1]]:5>
- // CHECK-NEXT: <<<NULL>>>
- // CHECK-NEXT: <<<NULL>>>
- // CHECK-NEXT: <<<NULL>>>
- // CHECK-NEXT: BinaryOperator 0x{{[^ ]*}} <line:[[@LINE-6]]:11, col:16> '_Bool' '='
- // CHECK-NEXT: DeclRefExpr 0x{{[^ ]*}} <col:11> '_Bool' lvalue ParmVar 0x{{[^ ]*}} 'b' '_Bool'
- // CHECK-NEXT: ImplicitCastExpr
- // CHECK-NEXT: UnaryOperator 0x{{[^ ]*}} <col:15, col:16> 'int' prefix '!' cannot overflow
- // CHECK-NEXT: ImplicitCastExpr
- // CHECK-NEXT: DeclRefExpr 0x{{[^ ]*}} <col:16> '_Bool' lvalue ParmVar 0x{{[^ ]*}} 'b' '_Bool'
- // CHECK-NEXT: NullStmt
-
- for (;;)
- ;
- // CHECK: ForStmt 0x{{[^ ]*}} <line:[[@LINE-2]]:3, line:[[@LINE-1]]:5>
- // CHECK-NEXT: <<<NULL>>>
- // CHECK-NEXT: <<<NULL>>>
- // CHECK-NEXT: <<<NULL>>>
- // CHECK-NEXT: <<<NULL>>>
- // CHECK-NEXT: NullStmt
-}
-
-void TestJumps(void) {
- // goto and computed goto was tested in TestLabelsAndGoto().
-
- while (1) {
- continue;
- // CHECK: ContinueStmt 0x{{[^ ]*}} <line:[[@LINE-1]]:5>
- break;
- // CHECK: BreakStmt 0x{{[^ ]*}} <line:[[@LINE-1]]:5>
- }
- return;
- // CHECK: ReturnStmt 0x{{[^ ]*}} <line:[[@LINE-1]]:3>
-
- return TestSwitch(1);
- // CHECK: ReturnStmt 0x{{[^ ]*}} <line:[[@LINE-1]]:3, col:22>
- // CHECK-NEXT: CallExpr 0x{{[^ ]*}} <col:10, col:22> 'void'
-}
-
-void TestMiscStmts(void) {
- ({int a = 10; a;});
- // CHECK: StmtExpr 0x{{[^ ]*}} <line:[[@LINE-1]]:3, col:20> 'int'
- // CHECK-NEXT: CompoundStmt
- // CHECK-NEXT: DeclStmt
- // CHECK-NEXT: VarDecl 0x{{[^ ]*}} <col:5, col:13> col:9 used a 'int' cinit
- // CHECK-NEXT: IntegerLiteral 0x{{[^ ]*}} <col:13> 'int' 10
- // CHECK-NEXT: ImplicitCastExpr
- // CHECK-NEXT: DeclRefExpr 0x{{[^ ]*}} <col:17> 'int' lvalue Var 0x{{[^ ]*}} 'a' 'int'
- ({int a = 10; a;;; });
- // CHECK-NEXT: StmtExpr 0x{{[^ ]*}} <line:[[@LINE-1]]:3, col:23> 'int'
- // CHECK-NEXT: CompoundStmt
- // CHECK-NEXT: DeclStmt
- // CHECK-NEXT: VarDecl 0x{{[^ ]*}} <col:5, col:13> col:9 used a 'int' cinit
- // CHECK-NEXT: IntegerLiteral 0x{{[^ ]*}} <col:13> 'int' 10
- // CHECK-NEXT: ImplicitCastExpr
- // CHECK-NEXT: DeclRefExpr 0x{{[^ ]*}} <col:17> 'int' lvalue Var 0x{{[^ ]*}} 'a' 'int'
- // CHECK-NEXT: NullStmt
- // CHECK-NEXT: NullStmt
-}
+// CHECK-NEXT: OpaqueValueExpr
+// CHECK-NEXT: IntegerLiteral
+// CHECK-NEXT: IntegerLiteral
+
+void TestUnaryOperatorExpr(void) {
+ char T1 = 1;
+ int T2 = 1;
+
+ T1++;
+ T2++;
+ // CHECK: UnaryOperator{{.*}}postfix '++' cannot overflow
+ // CHECK-NEXT: DeclRefExpr{{.*}}'T1' 'char'
+ // CHECK-NOT: UnaryOperator{{.*}}postfix '++' cannot overflow
+ // CHECK: DeclRefExpr{{.*}}'T2' 'int'
+
+ -T1;
+ -T2;
+ // CHECK: UnaryOperator{{.*}}prefix '-' cannot overflow
+ // CHECK-NEXT: ImplicitCastExpr
+ // CHECK-NEXT: ImplicitCastExpr
+ // CHECK-NEXT: DeclRefExpr{{.*}}'T1' 'char'
+ // CHECK-NOT: UnaryOperator{{.*}}prefix '-' cannot overflow
+ // CHECK: ImplicitCastExpr
+ // CHECK: DeclRefExpr{{.*}}'T2' 'int'
+
+ ~T1;
+ ~T2;
+ // CHECK: UnaryOperator{{.*}}prefix '~' cannot overflow
+ // CHECK-NEXT: ImplicitCastExpr
+ // CHECK-NEXT: ImplicitCastExpr
+ // CHECK-NEXT: DeclRefExpr{{.*}}'T1' 'char'
+ // CHECK: UnaryOperator{{.*}}prefix '~' cannot overflow
+ // CHECK-NEXT: ImplicitCastExpr
+ // CHECK-NEXT: DeclRefExpr{{.*}}'T2' 'int'
+}
+
+void TestGenericSelectionExpressions(int i) {
+ _Generic(i, int : 12);
+ // CHECK: GenericSelectionExpr 0x{{[^ ]*}} <line:[[@LINE-1]]:3, col:23> 'int'
+ // CHECK-NEXT: ImplicitCastExpr 0x{{[^ ]*}}
+ // CHECK-NEXT: DeclRefExpr 0x{{[^ ]*}} <col:12> 'int' lvalue ParmVar 0x{{[^ ]*}} 'i' 'int'
+ // CHECK-NEXT: BuiltinType 0x{{[^ ]*}} 'int'
+ // FIXME: note that the following test line has a spurious whitespace.
+ // CHECK-NEXT: case 'int' selected
+ // CHECK-NEXT: BuiltinType 0x{{[^ ]*}} 'int'
+ // CHECK-NEXT: IntegerLiteral 0x{{[^ ]*}} <col:21> 'int' 12
+ _Generic(i, int : 12, default : 0);
+ // CHECK: GenericSelectionExpr 0x{{[^ ]*}} <line:[[@LINE-1]]:3, col:36> 'int'
+ // CHECK-NEXT: ImplicitCastExpr 0x{{[^ ]*}}
+ // CHECK-NEXT: DeclRefExpr 0x{{[^ ]*}} <col:12> 'int' lvalue ParmVar 0x{{[^ ]*}} 'i' 'int'
+ // CHECK-NEXT: BuiltinType 0x{{[^ ]*}} 'int'
+ // FIXME: note that the following test line has a spurious whitespace.
+ // CHECK-NEXT: case 'int' selected
+ // CHECK-NEXT: BuiltinType 0x{{[^ ]*}} 'int'
+ // CHECK-NEXT: IntegerLiteral 0x{{[^ ]*}} <col:21> 'int' 12
+ // CHECK-NEXT: default
+ // CHECK-NEXT: IntegerLiteral 0x{{[^ ]*}} <col:35> 'int' 0
+ _Generic(i, default : 0, int : 12);
+ // CHECK: GenericSelectionExpr 0x{{[^ ]*}} <line:[[@LINE-1]]:3, col:36> 'int'
+ // CHECK-NEXT: ImplicitCastExpr 0x{{[^ ]*}}
+ // CHECK-NEXT: DeclRefExpr 0x{{[^ ]*}} <col:12> 'int' lvalue ParmVar 0x{{[^ ]*}} 'i' 'int'
+ // CHECK-NEXT: BuiltinType 0x{{[^ ]*}} 'int'
+ // CHECK-NEXT: default
+ // CHECK-NEXT: IntegerLiteral 0x{{[^ ]*}} <col:25> 'int' 0
+ // FIXME: note that the following test line has a spurious whitespace.
+ // CHECK-NEXT: case 'int' selected
+ // CHECK-NEXT: BuiltinType 0x{{[^ ]*}} 'int'
+ // CHECK-NEXT: IntegerLiteral 0x{{[^ ]*}} <col:34> 'int' 12
+ _Generic(i, int : 12, float : 10, default : 100);
+ // CHECK: GenericSelectionExpr 0x{{[^ ]*}} <line:[[@LINE-1]]:3, col:50> 'int'
+ // CHECK-NEXT: ImplicitCastExpr 0x{{[^ ]*}}
+ // CHECK-NEXT: DeclRefExpr 0x{{[^ ]*}} <col:12> 'int' lvalue ParmVar 0x{{[^ ]*}} 'i' 'int'
+ // CHECK-NEXT: BuiltinType 0x{{[^ ]*}} 'int'
+ // FIXME: note that the following test line has a spurious whitespace.
+ // CHECK-NEXT: case 'int' selected
+ // CHECK-NEXT: BuiltinType 0x{{[^ ]*}} 'int'
+ // CHECK-NEXT: IntegerLiteral 0x{{[^ ]*}} <col:21> 'int' 12
+ // FIXME: note that the following test line has a spurious whitespace.
+ // CHECK-NEXT: case 'float'
+ // CHECK-NEXT: BuiltinType 0x{{[^ ]*}} 'float'
+ // CHECK-NEXT: IntegerLiteral 0x{{[^ ]*}} <col:33> 'int' 10
+ // CHECK-NEXT: default
+ // CHECK-NEXT: IntegerLiteral 0x{{[^ ]*}} <col:47> 'int' 100
+
+ int j = _Generic(i, int : 12);
+ // CHECK: DeclStmt 0x{{[^ ]*}} <line:[[@LINE-1]]:3, col:32>
+ // CHECK-NEXT: VarDecl 0x{{[^ ]*}} <col:3, col:31> col:7 j 'int' cinit
+ // CHECK-NEXT: GenericSelectionExpr 0x{{[^ ]*}} <col:11, col:31> 'int'
+ // CHECK-NEXT: ImplicitCastExpr 0x{{[^ ]*}}
+ // CHECK-NEXT: DeclRefExpr 0x{{[^ ]*}} <col:20> 'int' lvalue ParmVar 0x{{[^ ]*}} 'i' 'int'
+ // CHECK-NEXT: BuiltinType 0x{{[^ ]*}} 'int'
+ // FIXME: note that the following test line has a spurious whitespace.
+ // CHECK-NEXT: case 'int' selected
+ // CHECK-NEXT: BuiltinType 0x{{[^ ]*}} 'int'
+ // CHECK-NEXT: IntegerLiteral 0x{{[^ ]*}} <col:29> 'int' 12
+}
+
+void TestLabelsAndGoto(void) {
+ // Note: case and default labels are handled by TestSwitch().
+
+label1:
+ ;
+ // CHECK: LabelStmt 0x{{[^ ]*}} <line:[[@LINE-2]]:1, line:[[@LINE-1]]:3> 'label1'
+ // CHECK-NEXT: NullStmt 0x{{[^ ]*}} <col:3>
+
+ goto label2;
+ // CHECK-NEXT: GotoStmt 0x{{[^ ]*}} <line:[[@LINE-1]]:3, col:8> 'label2' 0x{{[^ ]*}}
+
+label2:
+ 0;
+ // CHECK-NEXT: LabelStmt 0x{{[^ ]*}} <line:[[@LINE-2]]:1, line:[[@LINE-1]]:3> 'label2'
+ // CHECK-NEXT: IntegerLiteral 0x{{[^ ]*}} <col:3> 'int' 0
+
+ void *ptr = &&label1;
+ // CHECK-NEXT: DeclStmt
+ // CHECK-NEXT: VarDecl
+ // CHECK-NEXT: AddrLabelExpr 0x{{[^ ]*}} <col:15, col:17> 'void *' label1 0x{{[^ ]*}}
+
+ goto *ptr;
+ // CHECK-NEXT: IndirectGotoStmt 0x{{[^ ]*}} <line:[[@LINE-1]]:3, col:9>
+ // CHECK-NEXT: ImplicitCastExpr
+ // CHECK-NEXT: ImplicitCastExpr
+ // CHECK-NEXT: DeclRefExpr 0x{{[^ ]*}} <col:9> 'void *' lvalue Var 0x{{[^ ]*}} 'ptr' 'void *'
+}
+
+void TestSwitch(int i) {
+ switch (i) {
+ // CHECK: SwitchStmt 0x{{[^ ]*}} <line:[[@LINE-1]]:3, line:[[@LINE+32]]:3>
+ // CHECK-NEXT: ImplicitCastExpr
+ // CHECK-NEXT: DeclRefExpr 0x{{[^ ]*}} <col:11> 'int' lvalue ParmVar 0x{{[^ ]*}} 'i' 'int'
+ // CHECK-NEXT: CompoundStmt 0x{{[^ ]*}} <col:14, line:[[@LINE+29]]:3>
+ case 0:
+ break;
+ // CHECK-NEXT: CaseStmt 0x{{[^ ]*}} <line:[[@LINE-2]]:3, line:[[@LINE-1]]:5>
+ // CHECK-NEXT: ConstantExpr
+ // CHECK-NEXT: IntegerLiteral 0x{{[^ ]*}} <col:8> 'int' 0
+ // CHECK-NEXT: BreakStmt 0x{{[^ ]*}} <line:[[@LINE-4]]:5>
+ case 1:
+ case 2:
+ break;
+ // CHECK-NEXT: CaseStmt 0x{{[^ ]*}} <line:[[@LINE-3]]:3, line:[[@LINE-1]]:5>
+ // CHECK-NEXT: ConstantExpr
+ // CHECK-NEXT: IntegerLiteral 0x{{[^ ]*}} <col:8> 'int' 1
+ // CHECK-NEXT: CaseStmt 0x{{[^ ]*}} <line:[[@LINE-5]]:3, line:[[@LINE-4]]:5>
+ // CHECK-NEXT: ConstantExpr
+ // CHECK-NEXT: IntegerLiteral 0x{{[^ ]*}} <col:8> 'int' 2
+ // CHECK-NEXT: BreakStmt 0x{{[^ ]*}} <line:[[@LINE-7]]:5>
+ default:
+ break;
+ // CHECK-NEXT: DefaultStmt 0x{{[^ ]*}} <line:[[@LINE-2]]:3, line:[[@LINE-1]]:5>
+ // CHECK-NEXT: BreakStmt 0x{{[^ ]*}} <col:5>
+ case 3 ... 5:
+ break;
+ // CHECK-NEXT: CaseStmt 0x{{[^ ]*}} <line:[[@LINE-2]]:3, line:[[@LINE-1]]:5> gnu_range
+ // CHECK-NEXT: ConstantExpr
+ // CHECK-NEXT: IntegerLiteral 0x{{[^ ]*}} <col:8> 'int' 3
+ // CHECK-NEXT: ConstantExpr
+ // CHECK-NEXT: IntegerLiteral 0x{{[^ ]*}} <col:14> 'int' 5
+ // CHECK-NEXT: BreakStmt 0x{{[^ ]*}} <line:[[@LINE-6]]:5>
+ }
+}
+
+void TestIf(_Bool b) {
+ if (b)
+ ;
+ // CHECK: IfStmt 0x{{[^ ]*}} <line:[[@LINE-2]]:3, line:[[@LINE-1]]:5>
+ // CHECK-NEXT: ImplicitCastExpr
+ // CHECK-NEXT: DeclRefExpr 0x{{[^ ]*}} <col:7> '_Bool' lvalue ParmVar 0x{{[^ ]*}} 'b' '_Bool'
+ // CHECK-NEXT: NullStmt
+
+ if (b) {}
+ // CHECK: IfStmt 0x{{[^ ]*}} <line:[[@LINE-1]]:3, col:11>
+ // CHECK-NEXT: ImplicitCastExpr
+ // CHECK-NEXT: DeclRefExpr 0x{{[^ ]*}} <col:7> '_Bool' lvalue ParmVar 0x{{[^ ]*}} 'b' '_Bool'
+ // CHECK-NEXT: CompoundStmt
+
+ if (b)
+ ;
+ else
+ ;
+ // CHECK: IfStmt 0x{{[^ ]*}} <line:[[@LINE-4]]:3, line:[[@LINE-1]]:5> has_else
+ // CHECK-NEXT: ImplicitCastExpr
+ // CHECK-NEXT: DeclRefExpr 0x{{[^ ]*}} <col:7> '_Bool' lvalue ParmVar 0x{{[^ ]*}} 'b' '_Bool'
+ // CHECK-NEXT: NullStmt 0x{{[^ ]*}} <line:[[@LINE-6]]:5>
+ // CHECK-NEXT: NullStmt 0x{{[^ ]*}} <line:[[@LINE-5]]:5>
+
+ if (b) {}
+ else {}
+ // CHECK: IfStmt 0x{{[^ ]*}} <line:[[@LINE-2]]:3, line:[[@LINE-1]]:9> has_else
+ // CHECK-NEXT: ImplicitCastExpr
+ // CHECK-NEXT: DeclRefExpr 0x{{[^ ]*}} <col:7> '_Bool' lvalue ParmVar 0x{{[^ ]*}} 'b' '_Bool'
+ // CHECK-NEXT: CompoundStmt 0x{{[^ ]*}} <col:10, col:11>
+ // CHECK-NEXT: CompoundStmt 0x{{[^ ]*}} <line:[[@LINE-5]]:8, col:9>
+
+ if (b)
+ ;
+ else if (b)
+ ;
+ // CHECK: IfStmt 0x{{[^ ]*}} <line:[[@LINE-4]]:3, line:[[@LINE-1]]:5> has_else
+ // CHECK-NEXT: ImplicitCastExpr
+ // CHECK-NEXT: DeclRefExpr 0x{{[^ ]*}} <col:7> '_Bool' lvalue ParmVar 0x{{[^ ]*}} 'b' '_Bool'
+ // CHECK-NEXT: NullStmt 0x{{[^ ]*}} <line:[[@LINE-6]]:5>
+ // CHECK-NEXT: IfStmt 0x{{[^ ]*}} <line:[[@LINE-6]]:8, line:[[@LINE-5]]:5>
+ // CHECK-NEXT: ImplicitCastExpr
+ // CHECK-NEXT: DeclRefExpr 0x{{[^ ]*}} <col:12> '_Bool' lvalue ParmVar 0x{{[^ ]*}} 'b' '_Bool'
+ // CHECK-NEXT: NullStmt 0x{{[^ ]*}} <line:[[@LINE-8]]:5>
+
+ if (b)
+ ;
+ else if (b)
+ ;
+ else
+ ;
+ // CHECK: IfStmt 0x{{[^ ]*}} <line:[[@LINE-6]]:3, line:[[@LINE-1]]:5> has_else
+ // CHECK-NEXT: ImplicitCastExpr
+ // CHECK-NEXT: DeclRefExpr 0x{{[^ ]*}} <col:7> '_Bool' lvalue ParmVar 0x{{[^ ]*}} 'b' '_Bool'
+ // CHECK-NEXT: NullStmt 0x{{[^ ]*}} <line:[[@LINE-8]]:5>
+ // CHECK-NEXT: IfStmt 0x{{[^ ]*}} <line:[[@LINE-8]]:8, line:[[@LINE-5]]:5> has_else
+ // CHECK-NEXT: ImplicitCastExpr
+ // CHECK-NEXT: DeclRefExpr 0x{{[^ ]*}} <col:12> '_Bool' lvalue ParmVar 0x{{[^ ]*}} 'b' '_Bool'
+ // CHECK-NEXT: NullStmt 0x{{[^ ]*}} <line:[[@LINE-10]]:5>
+ // CHECK-NEXT: NullStmt 0x{{[^ ]*}} <line:[[@LINE-9]]:5>
+}
+
+void TestIteration(_Bool b) {
+ while (b)
+ ;
+ // CHECK: WhileStmt 0x{{[^ ]*}} <line:[[@LINE-2]]:3, line:[[@LINE-1]]:5>
+ // CHECK-NEXT: ImplicitCastExpr
+ // CHECK-NEXT: DeclRefExpr 0x{{[^ ]*}} <col:10> '_Bool' lvalue ParmVar 0x{{[^ ]*}} 'b' '_Bool'
+ // CHECK-NEXT: NullStmt 0x{{[^ ]*}} <line:[[@LINE-4]]:5>
+
+ do
+ ;
+ while (b);
+ // CHECK: DoStmt 0x{{[^ ]*}} <line:[[@LINE-3]]:3, line:[[@LINE-1]]:11>
+ // CHECK-NEXT: NullStmt 0x{{[^ ]*}} <line:[[@LINE-3]]:5>
+ // CHECK-NEXT: ImplicitCastExpr
+ // CHECK-NEXT: DeclRefExpr 0x{{[^ ]*}} <col:10> '_Bool' lvalue ParmVar 0x{{[^ ]*}} 'b' '_Bool'
+
+ for (int i = 0; i < 10; ++i)
+ ;
+ // CHECK: ForStmt 0x{{[^ ]*}} <line:[[@LINE-2]]:3, line:[[@LINE-1]]:5>
+ // CHECK-NEXT: DeclStmt
+ // CHECK-NEXT: VarDecl 0x{{[^ ]*}} <col:8, col:16> col:12 used i 'int' cinit
+ // CHECK-NEXT: IntegerLiteral 0x{{[^ ]*}} <col:16> 'int' 0
+ // CHECK-NEXT: <<<NULL>>>
+ // CHECK-NEXT: BinaryOperator 0x{{[^ ]*}} <col:19, col:23> 'int' '<'
+ // CHECK-NEXT: ImplicitCastExpr
+ // CHECK-NEXT: DeclRefExpr 0x{{[^ ]*}} <col:19> 'int' lvalue Var 0x{{[^ ]*}} 'i' 'int'
+ // CHECK-NEXT: IntegerLiteral 0x{{[^ ]*}} <col:23> 'int' 10
+ // CHECK-NEXT: UnaryOperator 0x{{[^ ]*}} <col:27, col:29> 'int' prefix '++'
+ // CHECK-NEXT: DeclRefExpr 0x{{[^ ]*}} <col:29> 'int' lvalue Var 0x{{[^ ]*}} 'i' 'int'
+ // CHECK-NEXT: NullStmt
+
+ for (b; b; b)
+ ;
+ // CHECK: ForStmt 0x{{[^ ]*}} <line:[[@LINE-2]]:3, line:[[@LINE-1]]:5>
+ // CHECK-NEXT: ImplicitCastExpr
+ // CHECK-NEXT: DeclRefExpr 0x{{[^ ]*}} <col:8> '_Bool' lvalue ParmVar 0x{{[^ ]*}} 'b' '_Bool'
+ // CHECK-NEXT: <<<NULL>>>
+ // CHECK-NEXT: ImplicitCastExpr
+ // CHECK-NEXT: DeclRefExpr 0x{{[^ ]*}} <col:11> '_Bool' lvalue ParmVar 0x{{[^ ]*}} 'b' '_Bool'
+ // CHECK-NEXT: ImplicitCastExpr
+ // CHECK-NEXT: DeclRefExpr 0x{{[^ ]*}} <col:14> '_Bool' lvalue ParmVar 0x{{[^ ]*}} 'b' '_Bool'
+ // CHECK-NEXT: NullStmt
+
+ for (; b; b = !b)
+ ;
+ // CHECK: ForStmt 0x{{[^ ]*}} <line:[[@LINE-2]]:3, line:[[@LINE-1]]:5>
+ // CHECK-NEXT: <<<NULL>>>
+ // CHECK-NEXT: <<<NULL>>>
+ // CHECK-NEXT: ImplicitCastExpr
+ // CHECK-NEXT: DeclRefExpr 0x{{[^ ]*}} <col:10> '_Bool' lvalue ParmVar 0x{{[^ ]*}} 'b' '_Bool'
+ // CHECK-NEXT: BinaryOperator 0x{{[^ ]*}} <col:13, col:18> '_Bool' '='
+ // CHECK-NEXT: DeclRefExpr 0x{{[^ ]*}} <col:13> '_Bool' lvalue ParmVar 0x{{[^ ]*}} 'b' '_Bool'
+ // CHECK-NEXT: ImplicitCastExpr
+ // CHECK-NEXT: UnaryOperator 0x{{[^ ]*}} <col:17, col:18> 'int' prefix '!' cannot overflow
+ // CHECK-NEXT: ImplicitCastExpr
+ // CHECK-NEXT: DeclRefExpr 0x{{[^ ]*}} <col:18> '_Bool' lvalue ParmVar 0x{{[^ ]*}} 'b' '_Bool'
+ // CHECK-NEXT: NullStmt
+
+ for (; b;)
+ ;
+ // CHECK: ForStmt 0x{{[^ ]*}} <line:[[@LINE-2]]:3, line:[[@LINE-1]]:5>
+ // CHECK-NEXT: <<<NULL>>>
+ // CHECK-NEXT: <<<NULL>>>
+ // CHECK-NEXT: ImplicitCastExpr
+ // CHECK-NEXT: DeclRefExpr 0x{{[^ ]*}} <col:10> '_Bool' lvalue ParmVar 0x{{[^ ]*}} 'b' '_Bool'
+ // CHECK-NEXT: <<<NULL>>>
+ // CHECK-NEXT: NullStmt
+
+ for (;; b = !b)
+ ;
+ // CHECK: ForStmt 0x{{[^ ]*}} <line:[[@LINE-2]]:3, line:[[@LINE-1]]:5>
+ // CHECK-NEXT: <<<NULL>>>
+ // CHECK-NEXT: <<<NULL>>>
+ // CHECK-NEXT: <<<NULL>>>
+ // CHECK-NEXT: BinaryOperator 0x{{[^ ]*}} <line:[[@LINE-6]]:11, col:16> '_Bool' '='
+ // CHECK-NEXT: DeclRefExpr 0x{{[^ ]*}} <col:11> '_Bool' lvalue ParmVar 0x{{[^ ]*}} 'b' '_Bool'
+ // CHECK-NEXT: ImplicitCastExpr
+ // CHECK-NEXT: UnaryOperator 0x{{[^ ]*}} <col:15, col:16> 'int' prefix '!' cannot overflow
+ // CHECK-NEXT: ImplicitCastExpr
+ // CHECK-NEXT: DeclRefExpr 0x{{[^ ]*}} <col:16> '_Bool' lvalue ParmVar 0x{{[^ ]*}} 'b' '_Bool'
+ // CHECK-NEXT: NullStmt
+
+ for (;;)
+ ;
+ // CHECK: ForStmt 0x{{[^ ]*}} <line:[[@LINE-2]]:3, line:[[@LINE-1]]:5>
+ // CHECK-NEXT: <<<NULL>>>
+ // CHECK-NEXT: <<<NULL>>>
+ // CHECK-NEXT: <<<NULL>>>
+ // CHECK-NEXT: <<<NULL>>>
+ // CHECK-NEXT: NullStmt
+}
+
+void TestJumps(void) {
+ // goto and computed goto was tested in TestLabelsAndGoto().
+
+ while (1) {
+ continue;
+ // CHECK: ContinueStmt 0x{{[^ ]*}} <line:[[@LINE-1]]:5>
+ break;
+ // CHECK: BreakStmt 0x{{[^ ]*}} <line:[[@LINE-1]]:5>
+ }
+ return;
+ // CHECK: ReturnStmt 0x{{[^ ]*}} <line:[[@LINE-1]]:3>
+
+ return TestSwitch(1);
+ // CHECK: ReturnStmt 0x{{[^ ]*}} <line:[[@LINE-1]]:3, col:22>
+ // CHECK-NEXT: CallExpr 0x{{[^ ]*}} <col:10, col:22> 'void'
+}
+
+void TestMiscStmts(void) {
+ ({int a = 10; a;});
+ // CHECK: StmtExpr 0x{{[^ ]*}} <line:[[@LINE-1]]:3, col:20> 'int'
+ // CHECK-NEXT: CompoundStmt
+ // CHECK-NEXT: DeclStmt
+ // CHECK-NEXT: VarDecl 0x{{[^ ]*}} <col:5, col:13> col:9 used a 'int' cinit
+ // CHECK-NEXT: IntegerLiteral 0x{{[^ ]*}} <col:13> 'int' 10
+ // CHECK-NEXT: ImplicitCastExpr
+ // CHECK-NEXT: DeclRefExpr 0x{{[^ ]*}} <col:17> 'int' lvalue Var 0x{{[^ ]*}} 'a' 'int'
+ ({int a = 10; a;;; });
+ // CHECK-NEXT: StmtExpr 0x{{[^ ]*}} <line:[[@LINE-1]]:3, col:23> 'int'
+ // CHECK-NEXT: CompoundStmt
+ // CHECK-NEXT: DeclStmt
+ // CHECK-NEXT: VarDecl 0x{{[^ ]*}} <col:5, col:13> col:9 used a 'int' cinit
+ // CHECK-NEXT: IntegerLiteral 0x{{[^ ]*}} <col:13> 'int' 10
+ // CHECK-NEXT: ImplicitCastExpr
+ // CHECK-NEXT: DeclRefExpr 0x{{[^ ]*}} <col:17> 'int' lvalue Var 0x{{[^ ]*}} 'a' 'int'
+ // CHECK-NEXT: NullStmt
+ // CHECK-NEXT: NullStmt
+}
diff --git a/clang/test/AST/float16.cpp b/clang/test/AST/float16.cpp
index 104ade6b54d6b..508247c08c6a6 100644
--- a/clang/test/AST/float16.cpp
+++ b/clang/test/AST/float16.cpp
@@ -1,341 +1,341 @@
-// Tests without serialization:
-// RUN: %clang_cc1 -std=c++11 -ast-dump -triple aarch64-linux-gnu %s \
-// RUN: | FileCheck %s --strict-whitespace
-//
-// RUN: %clang_cc1 -std=c++11 -ast-dump -triple aarch64-linux-gnu -fnative-half-type %s \
-// RUN: | FileCheck %s --check-prefix=CHECK-NATIVE --strict-whitespace
-//
-// Tests with serialization:
-// RUN: %clang_cc1 -std=c++11 -triple aarch64-linux-gnu -emit-pch -o %t %s
-// RUN: %clang_cc1 -x c++ -std=c++11 -triple aarch64-linux-gnu -include-pch %t -ast-dump-all /dev/null \
-// RUN: | sed -e "s/ <undeserialized declarations>//" -e "s/ imported//" \
-// RUN: | FileCheck %s --strict-whitespace
-//
-// RUN: %clang_cc1 -std=c++11 -triple aarch64-linux-gnu -fnative-half-type -emit-pch -o %t %s
-// RUN: %clang_cc1 -x c++ -std=c++11 -triple aarch64-linux-gnu -fnative-half-type -include-pch %t -ast-dump-all /dev/null \
-// RUN: | sed -e "s/ <undeserialized declarations>//" -e "s/ imported//" \
-// RUN: | FileCheck %s --check-prefix=CHECK-NATIVE --strict-whitespace
-
-/* Various contexts where type _Float16 can appear. */
-
-/* Namespace */
-namespace {
- _Float16 f1n;
- _Float16 f2n = 33.f16;
- _Float16 arr1n[10];
- _Float16 arr2n[] = { 1.2, 3.0, 3.e4 };
- const volatile _Float16 func1n(const _Float16 &arg) {
- return arg + f2n + arr1n[4] - arr2n[1];
- }
-}
-
-//CHECK: |-NamespaceDecl
-//CHECK-NEXT: | |-VarDecl {{.*}} f1n '_Float16'
-//CHECK-NEXT: | |-VarDecl {{.*}} f2n '_Float16' cinit
-//CHECK-NEXT: | | `-FloatingLiteral {{.*}} '_Float16' 3.300000e+01
-//CHECK-NEXT: | |-VarDecl {{.*}} arr1n '_Float16[10]'
-//CHECK-NEXT: | |-VarDecl {{.*}} arr2n '_Float16[3]' cinit
-//CHECK-NEXT: | | `-InitListExpr {{.*}} '_Float16[3]'
-//CHECK-NEXT: | | |-ImplicitCastExpr {{.*}} '_Float16' <FloatingCast>
-//CHECK-NEXT: | | | `-FloatingLiteral {{.*}} 'double' 1.200000e+00
-//CHECK-NEXT: | | |-ImplicitCastExpr {{.*}} '_Float16' <FloatingCast>
-//CHECK-NEXT: | | | `-FloatingLiteral {{.*}} 'double' 3.000000e+00
-//CHECK-NEXT: | | `-ImplicitCastExpr {{.*}} '_Float16' <FloatingCast>
-//CHECK-NEXT: | | `-FloatingLiteral {{.*}} 'double' 3.000000e+04
-//CHECK-NEXT: | `-FunctionDecl {{.*}} func1n 'const volatile _Float16 (const _Float16 &)'
-
-/* File */
-_Float16 f1f;
-_Float16 f2f = 32.4;
-_Float16 arr1f[10];
-_Float16 arr2f[] = { -1.2, -3.0, -3.e4 };
-_Float16 func1f(_Float16 arg);
-
-//CHECK: |-VarDecl {{.*}} f1f '_Float16'
-//CHECK-NEXT: |-VarDecl {{.*}} f2f '_Float16' cinit
-//CHECK-NEXT: | `-ImplicitCastExpr {{.*}} '_Float16' <FloatingCast>
-//CHECK-NEXT: | `-FloatingLiteral {{.*}} 'double' 3.240000e+01
-//CHECK-NEXT: |-VarDecl {{.*}} arr1f '_Float16[10]'
-//CHECK-NEXT: |-VarDecl {{.*}} arr2f '_Float16[3]' cinit
-//CHECK-NEXT: | `-InitListExpr {{.*}} '_Float16[3]'
-//CHECK-NEXT: | |-ImplicitCastExpr {{.*}} '_Float16' <FloatingCast>
-//CHECK-NEXT: | | `-UnaryOperator {{.*}} 'double' prefix '-'
-//CHECK-NEXT: | | `-FloatingLiteral {{.*}} 'double' 1.200000e+00
-//CHECK-NEXT: | |-ImplicitCastExpr {{.*}} '_Float16' <FloatingCast>
-//CHECK-NEXT: | | `-UnaryOperator {{.*}} 'double' prefix '-'
-//CHECK-NEXT: | | `-FloatingLiteral {{.*}} 'double' 3.000000e+00
-//CHECK-NEXT: | `-ImplicitCastExpr {{.*}} '_Float16' <FloatingCast>
-//CHECK-NEXT: | `-UnaryOperator {{.*}} 'double' prefix '-'
-//CHECK-NEXT: | `-FloatingLiteral {{.*}} 'double' 3.000000e+04
-//CHECK-NEXT: |-FunctionDecl {{.*}} func1f '_Float16 (_Float16)'
-//CHECK-NEXT: | `-ParmVarDecl {{.*}} arg '_Float16'
-
-
-// Mixing __fp16 and Float16 types:
-// The _Float16 type is first converted to __fp16 type and then the operation
-// is completed as if both operands were of __fp16 type.
-
-__fp16 B = -0.1;
-auto C = -1.0f16 + B;
-
-// When we do *not* have native half types, we expect __fp16 to be promoted to
-// float, and consequently also _Float16 promotions to float:
-
-//CHECK: -VarDecl {{.*}} used B '__fp16' cinit
-//CHECK-NEXT: | `-ImplicitCastExpr {{.*}} '__fp16' <FloatingCast>
-//CHECK-NEXT: | `-UnaryOperator {{.*}} 'double' prefix '-'
-//CHECK-NEXT: | `-FloatingLiteral {{.*}} 'double' 1.000000e-01
-//CHECK-NEXT: |-VarDecl {{.*}} C 'float':'float' cinit
-//CHECK-NEXT: | `-BinaryOperator {{.*}} 'float' '+'
-//CHECK-NEXT: | |-ImplicitCastExpr {{.*}} 'float' <FloatingCast>
-//CHECK-NEXT: | | `-UnaryOperator {{.*}} '_Float16' prefix '-'
-//CHECK-NEXT: | | `-FloatingLiteral {{.*}} '_Float16' 1.000000e+00
-//CHECK-NEXT: | `-ImplicitCastExpr {{.*}} 'float' <FloatingCast>
-//CHECK-NEXT: | `-ImplicitCastExpr {{.*}} '__fp16' <LValueToRValue>
-//CHECK-NEXT: | `-DeclRefExpr {{.*}} '__fp16' lvalue Var 0x{{.*}} 'B' '__fp16'
-
-// When do have native half types, we expect to see promotions to fp16:
-
-//CHECK-NATIVE: |-VarDecl {{.*}} used B '__fp16' cinit
-//CHECK-NATIVE: | `-ImplicitCastExpr {{.*}} '__fp16' <FloatingCast>
-//CHECK-NATIVE: | `-UnaryOperator {{.*}} 'double' prefix '-'
-//CHECK-NATIVE: | `-FloatingLiteral {{.*}} 'double' 1.000000e-01
-//CHECK-NATIVE: |-VarDecl {{.*}} C '__fp16':'__fp16' cinit
-//CHECK-NATIVE: | `-BinaryOperator {{.*}} '__fp16' '+'
-//CHECK-NATIVE: | |-ImplicitCastExpr {{.*}} '__fp16' <FloatingCast>
-//CHECK-NATIVE: | | `-UnaryOperator {{.*}} '_Float16' prefix '-'
-//CHECK-NATIVE: | | `-FloatingLiteral {{.*}} '_Float16' 1.000000e+00
-//CHECK-NATIVE: | `-ImplicitCastExpr {{.*}} '__fp16' <LValueToRValue>
-//CHECK-NATIVE: | `-DeclRefExpr {{.*}} '__fp16' lvalue Var 0x{{.*}} 'B' '__fp16'
-
-
-/* Class */
-
-class C1 {
- _Float16 f1c;
- static const _Float16 f2c;
- volatile _Float16 f3c;
-public:
- C1(_Float16 arg) : f1c(arg), f3c(arg) { }
- _Float16 func1c(_Float16 arg ) {
- return f1c + arg;
- }
- static _Float16 func2c(_Float16 arg) {
- return arg * C1::f2c;
- }
-};
-
-//CHECK: |-CXXRecordDecl {{.*}} referenced class C1 definition
-//CHECK: | |-CXXRecordDecl {{.*}} implicit referenced class C1
-//CHECK-NEXT: | |-FieldDecl {{.*}} referenced f1c '_Float16'
-//CHECK-NEXT: | |-VarDecl {{.*}} used f2c 'const _Float16' static
-//CHECK-NEXT: | |-FieldDecl {{.*}} f3c 'volatile _Float16'
-//CHECK-NEXT: | |-AccessSpecDecl
-//CHECK-NEXT: | |-CXXConstructorDecl {{.*}} used C1 'void (_Float16)
-//CHECK-NEXT: | | |-ParmVarDecl {{.*}} used arg '_Float16'
-//CHECK-NEXT: | | |-CXXCtorInitializer Field {{.*}} 'f1c' '_Float16'
-//CHECK-NEXT: | | | `-ImplicitCastExpr {{.*}} '_Float16' <LValueToRValue>
-//CHECK-NEXT: | | | `-DeclRefExpr {{.*}} '_Float16' lvalue ParmVar 0x{{.*}} 'arg' '_Float16'
-//CHECK-NEXT: | | |-CXXCtorInitializer Field {{.*}} 'f3c' 'volatile _Float16'
-//CHECK-NEXT: | | | `-ImplicitCastExpr {{.*}} '_Float16' <LValueToRValue>
-//CHECK-NEXT: | | | `-DeclRefExpr {{.*}} '_Float16' lvalue ParmVar 0x{{.*}} 'arg' '_Float16'
-//CHECK-NEXT: | | `-CompoundStmt
-//CHECK-NEXT: | |-CXXMethodDecl {{.*}} used func1c '_Float16 (_Float16)
-//CHECK-NEXT: | | |-ParmVarDecl {{.*}} used arg '_Float16'
-//CHECK-NEXT: | | `-CompoundStmt
-//CHECK-NEXT: | | `-ReturnStmt
-//CHECK-NEXT: | | `-BinaryOperator {{.*}} '_Float16' '+'
-//CHECK-NEXT: | | |-ImplicitCastExpr {{.*}} '_Float16' <LValueToRValue>
-//CHECK-NEXT: | | | `-MemberExpr {{.*}} '_Float16' lvalue ->f1c 0x{{.*}}
-//CHECK-NEXT: | | | `-CXXThisExpr {{.*}} 'C1 *' implicit this
-//CHECK-NEXT: | | `-ImplicitCastExpr {{.*}} '_Float16' <LValueToRValue>
-//CHECK-NEXT: | | `-DeclRefExpr {{.*}} '_Float16' lvalue ParmVar 0x{{.*}} 'arg' '_Float16'
-//CHECK-NEXT: | |-CXXMethodDecl {{.*}} used func2c '_Float16 (_Float16)' static
-//CHECK-NEXT: | | |-ParmVarDecl {{.*}} used arg '_Float16'
-//CHECK-NEXT: | | `-CompoundStmt
-//CHECK-NEXT: | | `-ReturnStmt
-//CHECK-NEXT: | | `-BinaryOperator {{.*}} '_Float16' '*'
-//CHECK-NEXT: | | |-ImplicitCastExpr {{.*}} '_Float16' <LValueToRValue>
-//CHECK-NEXT: | | | `-DeclRefExpr {{.*}} '_Float16' lvalue ParmVar 0x{{.*}} 'arg' '_Float16'
-//CHECK-NEXT: | | `-ImplicitCastExpr {{.*}} '_Float16' <LValueToRValue>
-//CHECK-NEXT: | | `-DeclRefExpr {{.*}} 'const _Float16' lvalue Var 0x{{.*}} 'f2c' 'const _Float16'
-
-
-/* Template */
-
-template <class C> C func1t(C arg) {
- return arg * 2.f16;
-}
-
-//CHECK: |-FunctionTemplateDecl {{.*}} func1t
-//CHECK-NEXT: | |-TemplateTypeParmDecl {{.*}} C
-//CHECK-NEXT: | |-FunctionDecl {{.*}} func1t 'C (C)'
-//CHECK-NEXT: | | |-ParmVarDecl {{.*}} referenced arg 'C'
-//CHECK-NEXT: | | `-CompoundStmt
-//CHECK-NEXT: | | `-ReturnStmt
-//CHECK-NEXT: | | `-BinaryOperator {{.*}} '<dependent type>' '*'
-//CHECK-NEXT: | | |-DeclRefExpr {{.*}} 'C' lvalue ParmVar {{.*}} 'arg' 'C'
-//CHECK-NEXT: | | `-FloatingLiteral {{.*}} '_Float16' 2.000000e+00
-//CHECK-NEXT: | `-FunctionDecl {{.*}} used func1t '_Float16 (_Float16)'
-//CHECK-NEXT: | |-TemplateArgument type '_Float16'
-//CHECK: | |-ParmVarDecl {{.*}} used arg '_Float16':'_Float16'
-//CHECK-NEXT: | `-CompoundStmt
-//CHECK-NEXT: | `-ReturnStmt
-//CHECK-NEXT: | `-BinaryOperator {{.*}} '_Float16' '*'
-//CHECK-NEXT: | |-ImplicitCastExpr {{.*}} '_Float16':'_Float16' <LValueToRValue>
-//CHECK-NEXT: | | `-DeclRefExpr {{.*}} '_Float16':'_Float16' lvalue ParmVar {{.*}} 'arg' '_Float16':'_Float16'
-//CHECK-NEXT: | `-FloatingLiteral {{.*}} '_Float16' 2.000000e+00
-
-
-template <class C> struct S1 {
- C mem1;
-};
-
-//CHECK: |-ClassTemplateDecl {{.*}} S1
-//CHECK-NEXT: | |-TemplateTypeParmDecl {{.*}} referenced class depth 0 index 0 C
-//CHECK-NEXT: | |-CXXRecordDecl {{.*}} struct S1 definition
-//CHECK: | | |-CXXRecordDecl {{.*}} implicit struct S1
-//CHECK-NEXT: | | `-FieldDecl {{.*}} mem1 'C'
-//CHECK-NEXT: | `-ClassTemplateSpecialization {{.*}} 'S1'
-
-template <> struct S1<_Float16> {
- _Float16 mem2;
-};
-
-
-/* Local */
-
-extern int printf (const char *__restrict __format, ...);
-
-int main(void) {
- _Float16 f1l = 1e3f16;
-//CHECK: | `-VarDecl {{.*}} used f1l '_Float16' cinit
-//CHECK-NEXT: | `-FloatingLiteral {{.*}} '_Float16' 1.000000e+03
-
- _Float16 f2l = -0.f16;
-//CHECK: | `-VarDecl {{.*}} used f2l '_Float16' cinit
-//CHECK-NEXT: | `-UnaryOperator {{.*}} '_Float16' prefix '-'
-//CHECK-NEXT: | `-FloatingLiteral {{.*}} '_Float16' 0.000000e+00
-
- _Float16 f3l = 1.000976562;
-//CHECK: | `-VarDecl {{.*}} used f3l '_Float16' cinit
-//CHECK-NEXT: | `-ImplicitCastExpr {{.*}} '_Float16' <FloatingCast>
-//CHECK-NEXT: | `-FloatingLiteral {{.*}} 'double' 1.000977e+00
-
- C1 c1(f1l);
-//CHECK: | `-VarDecl{{.*}} used c1 'C1' callinit
-//CHECK-NEXT: | `-CXXConstructExpr {{.*}} 'C1' 'void (_Float16)
-//CHECK-NEXT: | `-ImplicitCastExpr {{.*}} '_Float16' <LValueToRValue>
-//CHECK-NEXT: | `-DeclRefExpr {{.*}} '_Float16' lvalue Var 0x{{.*}} 'f1l' '_Float16'
-
- S1<_Float16> s1 = { 132.f16 };
-//CHECK: | `-VarDecl {{.*}} used s1 'S1<_Float16>':'S1<_Float16>' cinit
-//CHECK-NEXT: | `-InitListExpr {{.*}} 'S1<_Float16>':'S1<_Float16>'
-//CHECK-NEXT: | `-FloatingLiteral {{.*}} '_Float16' 1.320000e+02
-
- _Float16 f4l = func1n(f1l) + func1f(f2l) + c1.func1c(f3l) + c1.func2c(f1l) +
- func1t(f1l) + s1.mem2 - f1n + f2n;
-//CHECK: | `-VarDecl {{.*}} used f4l '_Float16' cinit
-//CHECK-NEXT: | `-BinaryOperator {{.*}} '_Float16' '+'
-//CHECK-NEXT: | |-BinaryOperator {{.*}} '_Float16' '-'
-//CHECK-NEXT: | | |-BinaryOperator {{.*}} '_Float16' '+'
-//CHECK-NEXT: | | | |-BinaryOperator {{.*}} '_Float16' '+'
-//CHECK-NEXT: | | | | |-BinaryOperator {{.*}} '_Float16' '+'
-//CHECK-NEXT: | | | | | |-BinaryOperator {{.*}} '_Float16' '+'
-//CHECK-NEXT: | | | | | | |-BinaryOperator {{.*}} '_Float16' '+'
-//CHECK-NEXT: | | | | | | | |-CallExpr {{.*}} '_Float16'
-//CHECK-NEXT: | | | | | | | | |-ImplicitCastExpr {{.*}} 'const volatile _Float16 (*)(const _Float16 &)' <FunctionToPointerDecay>
-//CHECK-NEXT: | | | | | | | | | `-DeclRefExpr {{.*}} 'const volatile _Float16 (const _Float16 &)' lvalue Function {{.*}} 'func1n' 'const volatile _Float16 (const _Float16 &)'
-//CHECK-NEXT: | | | | | | | | `-ImplicitCastExpr {{.*}} 'const _Float16' lvalue <NoOp>
-//CHECK-NEXT: | | | | | | | | `-DeclRefExpr {{.*}} '_Float16' lvalue Var {{.*}} 'f1l' '_Float16'
-//CHECK-NEXT: | | | | | | | `-CallExpr {{.*}} '_Float16'
-//CHECK-NEXT: | | | | | | | |-ImplicitCastExpr {{.*}} '_Float16 (*)(_Float16)' <FunctionToPointerDecay>
-//CHECK-NEXT: | | | | | | | | `-DeclRefExpr {{.*}} '_Float16 (_Float16)' lvalue Function {{.*}} 'func1f' '_Float16 (_Float16)'
-//CHECK-NEXT: | | | | | | | `-ImplicitCastExpr {{.*}} '_Float16' <LValueToRValue>
-//CHECK-NEXT: | | | | | | | `-DeclRefExpr {{.*}} '_Float16' lvalue Var {{.*}} 'f2l' '_Float16'
-//CHECK-NEXT: | | | | | | `-CXXMemberCallExpr {{.*}} '_Float16'
-//CHECK-NEXT: | | | | | | |-MemberExpr {{.*}} '<bound member function type>' .func1c {{.*}}
-//CHECK-NEXT: | | | | | | | `-DeclRefExpr {{.*}} 'C1' lvalue Var {{.*}} 'c1' 'C1'
-//CHECK-NEXT: | | | | | | `-ImplicitCastExpr {{.*}} '_Float16' <LValueToRValue>
-//CHECK-NEXT: | | | | | | `-DeclRefExpr {{.*}} '_Float16' lvalue Var {{.*}} 'f3l' '_Float16'
-//CHECK-NEXT: | | | | | `-CallExpr {{.*}} '_Float16'
-//CHECK-NEXT: | | | | | |-ImplicitCastExpr {{.*}} '_Float16 (*)(_Float16)' <FunctionToPointerDecay>
-//CHECK-NEXT: | | | | | | `-MemberExpr {{.*}} '_Float16 (_Float16)' lvalue .func2c {{.*}}
-//CHECK-NEXT: | | | | | | `-DeclRefExpr {{.*}} 'C1' lvalue Var {{.*}} 'c1' 'C1'
-//CHECK-NEXT: | | | | | `-ImplicitCastExpr {{.*}} '_Float16' <LValueToRValue>
-//CHECK-NEXT: | | | | | `-DeclRefExpr {{.*}} '_Float16' lvalue Var {{.*}} 'f1l' '_Float16'
-//CHECK-NEXT: | | | | `-CallExpr {{.*}} '_Float16':'_Float16'
-//CHECK-NEXT: | | | | |-ImplicitCastExpr {{.*}} '_Float16 (*)(_Float16)' <FunctionToPointerDecay>
-//CHECK-NEXT: | | | | | `-DeclRefExpr {{.*}} '_Float16 (_Float16)' lvalue Function {{.*}} 'func1t' '_Float16 (_Float16)' (FunctionTemplate {{.*}} 'func1t')
-//CHECK-NEXT: | | | | `-ImplicitCastExpr {{.*}} '_Float16' <LValueToRValue>
-//CHECK-NEXT: | | | | `-DeclRefExpr {{.*}} '_Float16' lvalue Var {{.*}} 'f1l' '_Float16'
-//CHECK-NEXT: | | | `-ImplicitCastExpr {{.*}} '_Float16' <LValueToRValue>
-//CHECK-NEXT: | | | `-MemberExpr {{.*}} '_Float16' lvalue .mem2 {{.*}}
-//CHECK-NEXT: | | | `-DeclRefExpr {{.*}} 'S1<_Float16>':'S1<_Float16>' lvalue Var {{.*}} 's1' 'S1<_Float16>':'S1<_Float16>'
-//CHECK-NEXT: | | `-ImplicitCastExpr {{.*}} '_Float16' <LValueToRValue>
-//CHECK-NEXT: | | `-DeclRefExpr {{.*}} '_Float16' lvalue Var {{.*}} 'f1n' '_Float16'
-//CHECK-NEXT: | `-ImplicitCastExpr {{.*}} '_Float16' <LValueToRValue>
-//CHECK-NEXT: | `-DeclRefExpr {{.*}} '_Float16' lvalue Var {{.*}} 'f2n' '_Float16'
-
- auto f5l = -1.f16, *f6l = &f2l, f7l = func1t(f3l);
-//CHECK: | |-VarDecl {{.*}} f5l '_Float16':'_Float16' cinit
-//CHECK-NEXT: | | `-UnaryOperator {{.*}} '_Float16' prefix '-'
-//CHECK-NEXT: | | `-FloatingLiteral {{.*}} '_Float16' 1.000000e+00
-//CHECK-NEXT: | |-VarDecl {{.*}} f6l '_Float16 *' cinit
-//CHECK-NEXT: | | `-UnaryOperator {{.*}} '_Float16 *' prefix '&'
-//CHECK-NEXT: | | `-DeclRefExpr {{.*}} '_Float16' lvalue Var {{.*}} 'f2l' '_Float16'
-//CHECK-NEXT: | `-VarDecl {{.*}} f7l '_Float16':'_Float16' cinit
-//CHECK-NEXT: | `-CallExpr {{.*}} '_Float16':'_Float16'
-//CHECK-NEXT: | |-ImplicitCastExpr {{.*}} '_Float16 (*)(_Float16)' <FunctionToPointerDecay>
-//CHECK-NEXT: | | `-DeclRefExpr {{.*}} '_Float16 (_Float16)' lvalue Function {{.*}} 'func1t' '_Float16 (_Float16)' (FunctionTemplate {{.*}} 'func1t')
-//CHECK-NEXT: | `-ImplicitCastExpr {{.*}} '_Float16' <LValueToRValue>
-//CHECK-NEXT: | `-DeclRefExpr {{.*}} '_Float16' lvalue Var {{.*}} 'f3l' '_Float16'
-
- _Float16 f8l = f4l++;
-//CHECK: | `-VarDecl {{.*}} f8l '_Float16' cinit
-//CHECK-NEXT: | `-UnaryOperator {{.*}} '_Float16' postfix '++'
-//CHECK-NEXT: | `-DeclRefExpr {{.*}} '_Float16' lvalue Var {{.*}} 'f4l' '_Float16'
-
- _Float16 arr1l[] = { -1.f16, -0.f16, -11.f16 };
-//CHECK: `-VarDecl {{.*}} arr1l '_Float16[3]' cinit
-//CHECK-NEXT: `-InitListExpr {{.*}} '_Float16[3]'
-//CHECK-NEXT: |-UnaryOperator {{.*}} '_Float16' prefix '-'
-//CHECK-NEXT: | `-FloatingLiteral {{.*}} '_Float16' 1.000000e+00
-//CHECK-NEXT: |-UnaryOperator {{.*}} '_Float16' prefix '-'
-//CHECK-NEXT: | `-FloatingLiteral {{.*}} '_Float16' 0.000000e+00
-//CHECK-NEXT: `-UnaryOperator {{.*}} '_Float16' prefix '-'
-//CHECK-NEXT: `-FloatingLiteral {{.*}} '_Float16' 1.100000e+01
-
- float cvtf = f2n;
-//CHECK: `-VarDecl {{.*}} cvtf 'float' cinit
-//CHECK-NEXT: `-ImplicitCastExpr {{.*}} 'float' <FloatingCast>
-//CHECK-NEXT: `-ImplicitCastExpr {{.*}} '_Float16' <LValueToRValue>
-//CHECK-NEXT: `-DeclRefExpr {{.*}} '_Float16' lvalue Var {{.*}} 'f2n' '_Float16'
-
- double cvtd = f2n;
-//CHECK: `-VarDecl {{.*}} cvtd 'double' cinit
-//CHECK-NEXT: `-ImplicitCastExpr {{.*}} 'double' <FloatingCast>
-//CHECK-NEXT: `-ImplicitCastExpr {{.*}} '_Float16' <LValueToRValue>
-//CHECK-NEXT: `-DeclRefExpr {{.*}} '_Float16' lvalue Var {{.*}} 'f2n' '_Float16'
-
- long double cvtld = f2n;
-//CHECK: `-VarDecl {{.*}} cvtld 'long double' cinit
-//CHECK-NEXT: `-ImplicitCastExpr {{.*}} 'long double' <FloatingCast>
-//CHECK-NEXT: `-ImplicitCastExpr {{.*}} '_Float16' <LValueToRValue>
-//CHECK-NEXT: `-DeclRefExpr {{.*}} '_Float16' lvalue Var {{.*}} 'f2n' '_Float16'
-
- _Float16 f2h = 42.0f;
-//CHECK: `-VarDecl {{.*}} f2h '_Float16' cinit
-//CHECK-NEXT: `-ImplicitCastExpr {{.*}} '_Float16' <FloatingCast>
-//CHECK-NEXT: `-FloatingLiteral {{.*}} 'float' 4.200000e+01
-
- _Float16 d2h = 42.0;
-//CHECK: `-VarDecl {{.*}} d2h '_Float16' cinit
-//CHECK-NEXT: `-ImplicitCastExpr {{.*}} '_Float16' <FloatingCast>
-//CHECK-NEXT: `-FloatingLiteral {{.*}} 'double' 4.200000e+01
-
- _Float16 ld2h = 42.0l;
-//CHECK: `-VarDecl {{.*}} ld2h '_Float16' cinit
-//CHECK-NEXT: `-ImplicitCastExpr {{.*}} '_Float16' <FloatingCast>
-//CHECK-NEXT: `-FloatingLiteral {{.*}} 'long double' 4.200000e+01
-}
+// Tests without serialization:
+// RUN: %clang_cc1 -std=c++11 -ast-dump -triple aarch64-linux-gnu %s \
+// RUN: | FileCheck %s --strict-whitespace
+//
+// RUN: %clang_cc1 -std=c++11 -ast-dump -triple aarch64-linux-gnu -fnative-half-type %s \
+// RUN: | FileCheck %s --check-prefix=CHECK-NATIVE --strict-whitespace
+//
+// Tests with serialization:
+// RUN: %clang_cc1 -std=c++11 -triple aarch64-linux-gnu -emit-pch -o %t %s
+// RUN: %clang_cc1 -x c++ -std=c++11 -triple aarch64-linux-gnu -include-pch %t -ast-dump-all /dev/null \
+// RUN: | sed -e "s/ <undeserialized declarations>//" -e "s/ imported//" \
+// RUN: | FileCheck %s --strict-whitespace
+//
+// RUN: %clang_cc1 -std=c++11 -triple aarch64-linux-gnu -fnative-half-type -emit-pch -o %t %s
+// RUN: %clang_cc1 -x c++ -std=c++11 -triple aarch64-linux-gnu -fnative-half-type -include-pch %t -ast-dump-all /dev/null \
+// RUN: | sed -e "s/ <undeserialized declarations>//" -e "s/ imported//" \
+// RUN: | FileCheck %s --check-prefix=CHECK-NATIVE --strict-whitespace
+
+/* Various contexts where type _Float16 can appear. */
+
+/* Namespace */
+namespace {
+ _Float16 f1n;
+ _Float16 f2n = 33.f16;
+ _Float16 arr1n[10];
+ _Float16 arr2n[] = { 1.2, 3.0, 3.e4 };
+ const volatile _Float16 func1n(const _Float16 &arg) {
+ return arg + f2n + arr1n[4] - arr2n[1];
+ }
+}
+
+//CHECK: |-NamespaceDecl
+//CHECK-NEXT: | |-VarDecl {{.*}} f1n '_Float16'
+//CHECK-NEXT: | |-VarDecl {{.*}} f2n '_Float16' cinit
+//CHECK-NEXT: | | `-FloatingLiteral {{.*}} '_Float16' 3.300000e+01
+//CHECK-NEXT: | |-VarDecl {{.*}} arr1n '_Float16[10]'
+//CHECK-NEXT: | |-VarDecl {{.*}} arr2n '_Float16[3]' cinit
+//CHECK-NEXT: | | `-InitListExpr {{.*}} '_Float16[3]'
+//CHECK-NEXT: | | |-ImplicitCastExpr {{.*}} '_Float16' <FloatingCast>
+//CHECK-NEXT: | | | `-FloatingLiteral {{.*}} 'double' 1.200000e+00
+//CHECK-NEXT: | | |-ImplicitCastExpr {{.*}} '_Float16' <FloatingCast>
+//CHECK-NEXT: | | | `-FloatingLiteral {{.*}} 'double' 3.000000e+00
+//CHECK-NEXT: | | `-ImplicitCastExpr {{.*}} '_Float16' <FloatingCast>
+//CHECK-NEXT: | | `-FloatingLiteral {{.*}} 'double' 3.000000e+04
+//CHECK-NEXT: | `-FunctionDecl {{.*}} func1n 'const volatile _Float16 (const _Float16 &)'
+
+/* File */
+_Float16 f1f;
+_Float16 f2f = 32.4;
+_Float16 arr1f[10];
+_Float16 arr2f[] = { -1.2, -3.0, -3.e4 };
+_Float16 func1f(_Float16 arg);
+
+//CHECK: |-VarDecl {{.*}} f1f '_Float16'
+//CHECK-NEXT: |-VarDecl {{.*}} f2f '_Float16' cinit
+//CHECK-NEXT: | `-ImplicitCastExpr {{.*}} '_Float16' <FloatingCast>
+//CHECK-NEXT: | `-FloatingLiteral {{.*}} 'double' 3.240000e+01
+//CHECK-NEXT: |-VarDecl {{.*}} arr1f '_Float16[10]'
+//CHECK-NEXT: |-VarDecl {{.*}} arr2f '_Float16[3]' cinit
+//CHECK-NEXT: | `-InitListExpr {{.*}} '_Float16[3]'
+//CHECK-NEXT: | |-ImplicitCastExpr {{.*}} '_Float16' <FloatingCast>
+//CHECK-NEXT: | | `-UnaryOperator {{.*}} 'double' prefix '-'
+//CHECK-NEXT: | | `-FloatingLiteral {{.*}} 'double' 1.200000e+00
+//CHECK-NEXT: | |-ImplicitCastExpr {{.*}} '_Float16' <FloatingCast>
+//CHECK-NEXT: | | `-UnaryOperator {{.*}} 'double' prefix '-'
+//CHECK-NEXT: | | `-FloatingLiteral {{.*}} 'double' 3.000000e+00
+//CHECK-NEXT: | `-ImplicitCastExpr {{.*}} '_Float16' <FloatingCast>
+//CHECK-NEXT: | `-UnaryOperator {{.*}} 'double' prefix '-'
+//CHECK-NEXT: | `-FloatingLiteral {{.*}} 'double' 3.000000e+04
+//CHECK-NEXT: |-FunctionDecl {{.*}} func1f '_Float16 (_Float16)'
+//CHECK-NEXT: | `-ParmVarDecl {{.*}} arg '_Float16'
+
+
+// Mixing __fp16 and Float16 types:
+// The _Float16 type is first converted to __fp16 type and then the operation
+// is completed as if both operands were of __fp16 type.
+
+__fp16 B = -0.1;
+auto C = -1.0f16 + B;
+
+// When we do *not* have native half types, we expect __fp16 to be promoted to
+// float, and consequently also _Float16 promotions to float:
+
+//CHECK: -VarDecl {{.*}} used B '__fp16' cinit
+//CHECK-NEXT: | `-ImplicitCastExpr {{.*}} '__fp16' <FloatingCast>
+//CHECK-NEXT: | `-UnaryOperator {{.*}} 'double' prefix '-'
+//CHECK-NEXT: | `-FloatingLiteral {{.*}} 'double' 1.000000e-01
+//CHECK-NEXT: |-VarDecl {{.*}} C 'float':'float' cinit
+//CHECK-NEXT: | `-BinaryOperator {{.*}} 'float' '+'
+//CHECK-NEXT: | |-ImplicitCastExpr {{.*}} 'float' <FloatingCast>
+//CHECK-NEXT: | | `-UnaryOperator {{.*}} '_Float16' prefix '-'
+//CHECK-NEXT: | | `-FloatingLiteral {{.*}} '_Float16' 1.000000e+00
+//CHECK-NEXT: | `-ImplicitCastExpr {{.*}} 'float' <FloatingCast>
+//CHECK-NEXT: | `-ImplicitCastExpr {{.*}} '__fp16' <LValueToRValue>
+//CHECK-NEXT: | `-DeclRefExpr {{.*}} '__fp16' lvalue Var 0x{{.*}} 'B' '__fp16'
+
+// When do have native half types, we expect to see promotions to fp16:
+
+//CHECK-NATIVE: |-VarDecl {{.*}} used B '__fp16' cinit
+//CHECK-NATIVE: | `-ImplicitCastExpr {{.*}} '__fp16' <FloatingCast>
+//CHECK-NATIVE: | `-UnaryOperator {{.*}} 'double' prefix '-'
+//CHECK-NATIVE: | `-FloatingLiteral {{.*}} 'double' 1.000000e-01
+//CHECK-NATIVE: |-VarDecl {{.*}} C '__fp16':'__fp16' cinit
+//CHECK-NATIVE: | `-BinaryOperator {{.*}} '__fp16' '+'
+//CHECK-NATIVE: | |-ImplicitCastExpr {{.*}} '__fp16' <FloatingCast>
+//CHECK-NATIVE: | | `-UnaryOperator {{.*}} '_Float16' prefix '-'
+//CHECK-NATIVE: | | `-FloatingLiteral {{.*}} '_Float16' 1.000000e+00
+//CHECK-NATIVE: | `-ImplicitCastExpr {{.*}} '__fp16' <LValueToRValue>
+//CHECK-NATIVE: | `-DeclRefExpr {{.*}} '__fp16' lvalue Var 0x{{.*}} 'B' '__fp16'
+
+
+/* Class */
+
+class C1 {
+ _Float16 f1c;
+ static const _Float16 f2c;
+ volatile _Float16 f3c;
+public:
+ C1(_Float16 arg) : f1c(arg), f3c(arg) { }
+ _Float16 func1c(_Float16 arg ) {
+ return f1c + arg;
+ }
+ static _Float16 func2c(_Float16 arg) {
+ return arg * C1::f2c;
+ }
+};
+
+//CHECK: |-CXXRecordDecl {{.*}} referenced class C1 definition
+//CHECK: | |-CXXRecordDecl {{.*}} implicit referenced class C1
+//CHECK-NEXT: | |-FieldDecl {{.*}} referenced f1c '_Float16'
+//CHECK-NEXT: | |-VarDecl {{.*}} used f2c 'const _Float16' static
+//CHECK-NEXT: | |-FieldDecl {{.*}} f3c 'volatile _Float16'
+//CHECK-NEXT: | |-AccessSpecDecl
+//CHECK-NEXT: | |-CXXConstructorDecl {{.*}} used C1 'void (_Float16)
+//CHECK-NEXT: | | |-ParmVarDecl {{.*}} used arg '_Float16'
+//CHECK-NEXT: | | |-CXXCtorInitializer Field {{.*}} 'f1c' '_Float16'
+//CHECK-NEXT: | | | `-ImplicitCastExpr {{.*}} '_Float16' <LValueToRValue>
+//CHECK-NEXT: | | | `-DeclRefExpr {{.*}} '_Float16' lvalue ParmVar 0x{{.*}} 'arg' '_Float16'
+//CHECK-NEXT: | | |-CXXCtorInitializer Field {{.*}} 'f3c' 'volatile _Float16'
+//CHECK-NEXT: | | | `-ImplicitCastExpr {{.*}} '_Float16' <LValueToRValue>
+//CHECK-NEXT: | | | `-DeclRefExpr {{.*}} '_Float16' lvalue ParmVar 0x{{.*}} 'arg' '_Float16'
+//CHECK-NEXT: | | `-CompoundStmt
+//CHECK-NEXT: | |-CXXMethodDecl {{.*}} used func1c '_Float16 (_Float16)
+//CHECK-NEXT: | | |-ParmVarDecl {{.*}} used arg '_Float16'
+//CHECK-NEXT: | | `-CompoundStmt
+//CHECK-NEXT: | | `-ReturnStmt
+//CHECK-NEXT: | | `-BinaryOperator {{.*}} '_Float16' '+'
+//CHECK-NEXT: | | |-ImplicitCastExpr {{.*}} '_Float16' <LValueToRValue>
+//CHECK-NEXT: | | | `-MemberExpr {{.*}} '_Float16' lvalue ->f1c 0x{{.*}}
+//CHECK-NEXT: | | | `-CXXThisExpr {{.*}} 'C1 *' implicit this
+//CHECK-NEXT: | | `-ImplicitCastExpr {{.*}} '_Float16' <LValueToRValue>
+//CHECK-NEXT: | | `-DeclRefExpr {{.*}} '_Float16' lvalue ParmVar 0x{{.*}} 'arg' '_Float16'
+//CHECK-NEXT: | |-CXXMethodDecl {{.*}} used func2c '_Float16 (_Float16)' static
+//CHECK-NEXT: | | |-ParmVarDecl {{.*}} used arg '_Float16'
+//CHECK-NEXT: | | `-CompoundStmt
+//CHECK-NEXT: | | `-ReturnStmt
+//CHECK-NEXT: | | `-BinaryOperator {{.*}} '_Float16' '*'
+//CHECK-NEXT: | | |-ImplicitCastExpr {{.*}} '_Float16' <LValueToRValue>
+//CHECK-NEXT: | | | `-DeclRefExpr {{.*}} '_Float16' lvalue ParmVar 0x{{.*}} 'arg' '_Float16'
+//CHECK-NEXT: | | `-ImplicitCastExpr {{.*}} '_Float16' <LValueToRValue>
+//CHECK-NEXT: | | `-DeclRefExpr {{.*}} 'const _Float16' lvalue Var 0x{{.*}} 'f2c' 'const _Float16'
+
+
+/* Template */
+
+template <class C> C func1t(C arg) {
+ return arg * 2.f16;
+}
+
+//CHECK: |-FunctionTemplateDecl {{.*}} func1t
+//CHECK-NEXT: | |-TemplateTypeParmDecl {{.*}} C
+//CHECK-NEXT: | |-FunctionDecl {{.*}} func1t 'C (C)'
+//CHECK-NEXT: | | |-ParmVarDecl {{.*}} referenced arg 'C'
+//CHECK-NEXT: | | `-CompoundStmt
+//CHECK-NEXT: | | `-ReturnStmt
+//CHECK-NEXT: | | `-BinaryOperator {{.*}} '<dependent type>' '*'
+//CHECK-NEXT: | | |-DeclRefExpr {{.*}} 'C' lvalue ParmVar {{.*}} 'arg' 'C'
+//CHECK-NEXT: | | `-FloatingLiteral {{.*}} '_Float16' 2.000000e+00
+//CHECK-NEXT: | `-FunctionDecl {{.*}} used func1t '_Float16 (_Float16)'
+//CHECK-NEXT: | |-TemplateArgument type '_Float16'
+//CHECK: | |-ParmVarDecl {{.*}} used arg '_Float16':'_Float16'
+//CHECK-NEXT: | `-CompoundStmt
+//CHECK-NEXT: | `-ReturnStmt
+//CHECK-NEXT: | `-BinaryOperator {{.*}} '_Float16' '*'
+//CHECK-NEXT: | |-ImplicitCastExpr {{.*}} '_Float16':'_Float16' <LValueToRValue>
+//CHECK-NEXT: | | `-DeclRefExpr {{.*}} '_Float16':'_Float16' lvalue ParmVar {{.*}} 'arg' '_Float16':'_Float16'
+//CHECK-NEXT: | `-FloatingLiteral {{.*}} '_Float16' 2.000000e+00
+
+
+template <class C> struct S1 {
+ C mem1;
+};
+
+//CHECK: |-ClassTemplateDecl {{.*}} S1
+//CHECK-NEXT: | |-TemplateTypeParmDecl {{.*}} referenced class depth 0 index 0 C
+//CHECK-NEXT: | |-CXXRecordDecl {{.*}} struct S1 definition
+//CHECK: | | |-CXXRecordDecl {{.*}} implicit struct S1
+//CHECK-NEXT: | | `-FieldDecl {{.*}} mem1 'C'
+//CHECK-NEXT: | `-ClassTemplateSpecialization {{.*}} 'S1'
+
+template <> struct S1<_Float16> {
+ _Float16 mem2;
+};
+
+
+/* Local */
+
+extern int printf (const char *__restrict __format, ...);
+
+int main(void) {
+ _Float16 f1l = 1e3f16;
+//CHECK: | `-VarDecl {{.*}} used f1l '_Float16' cinit
+//CHECK-NEXT: | `-FloatingLiteral {{.*}} '_Float16' 1.000000e+03
+
+ _Float16 f2l = -0.f16;
+//CHECK: | `-VarDecl {{.*}} used f2l '_Float16' cinit
+//CHECK-NEXT: | `-UnaryOperator {{.*}} '_Float16' prefix '-'
+//CHECK-NEXT: | `-FloatingLiteral {{.*}} '_Float16' 0.000000e+00
+
+ _Float16 f3l = 1.000976562;
+//CHECK: | `-VarDecl {{.*}} used f3l '_Float16' cinit
+//CHECK-NEXT: | `-ImplicitCastExpr {{.*}} '_Float16' <FloatingCast>
+//CHECK-NEXT: | `-FloatingLiteral {{.*}} 'double' 1.000977e+00
+
+ C1 c1(f1l);
+//CHECK: | `-VarDecl{{.*}} used c1 'C1' callinit
+//CHECK-NEXT: | `-CXXConstructExpr {{.*}} 'C1' 'void (_Float16)
+//CHECK-NEXT: | `-ImplicitCastExpr {{.*}} '_Float16' <LValueToRValue>
+//CHECK-NEXT: | `-DeclRefExpr {{.*}} '_Float16' lvalue Var 0x{{.*}} 'f1l' '_Float16'
+
+ S1<_Float16> s1 = { 132.f16 };
+//CHECK: | `-VarDecl {{.*}} used s1 'S1<_Float16>':'S1<_Float16>' cinit
+//CHECK-NEXT: | `-InitListExpr {{.*}} 'S1<_Float16>':'S1<_Float16>'
+//CHECK-NEXT: | `-FloatingLiteral {{.*}} '_Float16' 1.320000e+02
+
+ _Float16 f4l = func1n(f1l) + func1f(f2l) + c1.func1c(f3l) + c1.func2c(f1l) +
+ func1t(f1l) + s1.mem2 - f1n + f2n;
+//CHECK: | `-VarDecl {{.*}} used f4l '_Float16' cinit
+//CHECK-NEXT: | `-BinaryOperator {{.*}} '_Float16' '+'
+//CHECK-NEXT: | |-BinaryOperator {{.*}} '_Float16' '-'
+//CHECK-NEXT: | | |-BinaryOperator {{.*}} '_Float16' '+'
+//CHECK-NEXT: | | | |-BinaryOperator {{.*}} '_Float16' '+'
+//CHECK-NEXT: | | | | |-BinaryOperator {{.*}} '_Float16' '+'
+//CHECK-NEXT: | | | | | |-BinaryOperator {{.*}} '_Float16' '+'
+//CHECK-NEXT: | | | | | | |-BinaryOperator {{.*}} '_Float16' '+'
+//CHECK-NEXT: | | | | | | | |-CallExpr {{.*}} '_Float16'
+//CHECK-NEXT: | | | | | | | | |-ImplicitCastExpr {{.*}} 'const volatile _Float16 (*)(const _Float16 &)' <FunctionToPointerDecay>
+//CHECK-NEXT: | | | | | | | | | `-DeclRefExpr {{.*}} 'const volatile _Float16 (const _Float16 &)' lvalue Function {{.*}} 'func1n' 'const volatile _Float16 (const _Float16 &)'
+//CHECK-NEXT: | | | | | | | | `-ImplicitCastExpr {{.*}} 'const _Float16' lvalue <NoOp>
+//CHECK-NEXT: | | | | | | | | `-DeclRefExpr {{.*}} '_Float16' lvalue Var {{.*}} 'f1l' '_Float16'
+//CHECK-NEXT: | | | | | | | `-CallExpr {{.*}} '_Float16'
+//CHECK-NEXT: | | | | | | | |-ImplicitCastExpr {{.*}} '_Float16 (*)(_Float16)' <FunctionToPointerDecay>
+//CHECK-NEXT: | | | | | | | | `-DeclRefExpr {{.*}} '_Float16 (_Float16)' lvalue Function {{.*}} 'func1f' '_Float16 (_Float16)'
+//CHECK-NEXT: | | | | | | | `-ImplicitCastExpr {{.*}} '_Float16' <LValueToRValue>
+//CHECK-NEXT: | | | | | | | `-DeclRefExpr {{.*}} '_Float16' lvalue Var {{.*}} 'f2l' '_Float16'
+//CHECK-NEXT: | | | | | | `-CXXMemberCallExpr {{.*}} '_Float16'
+//CHECK-NEXT: | | | | | | |-MemberExpr {{.*}} '<bound member function type>' .func1c {{.*}}
+//CHECK-NEXT: | | | | | | | `-DeclRefExpr {{.*}} 'C1' lvalue Var {{.*}} 'c1' 'C1'
+//CHECK-NEXT: | | | | | | `-ImplicitCastExpr {{.*}} '_Float16' <LValueToRValue>
+//CHECK-NEXT: | | | | | | `-DeclRefExpr {{.*}} '_Float16' lvalue Var {{.*}} 'f3l' '_Float16'
+//CHECK-NEXT: | | | | | `-CallExpr {{.*}} '_Float16'
+//CHECK-NEXT: | | | | | |-ImplicitCastExpr {{.*}} '_Float16 (*)(_Float16)' <FunctionToPointerDecay>
+//CHECK-NEXT: | | | | | | `-MemberExpr {{.*}} '_Float16 (_Float16)' lvalue .func2c {{.*}}
+//CHECK-NEXT: | | | | | | `-DeclRefExpr {{.*}} 'C1' lvalue Var {{.*}} 'c1' 'C1'
+//CHECK-NEXT: | | | | | `-ImplicitCastExpr {{.*}} '_Float16' <LValueToRValue>
+//CHECK-NEXT: | | | | | `-DeclRefExpr {{.*}} '_Float16' lvalue Var {{.*}} 'f1l' '_Float16'
+//CHECK-NEXT: | | | | `-CallExpr {{.*}} '_Float16':'_Float16'
+//CHECK-NEXT: | | | | |-ImplicitCastExpr {{.*}} '_Float16 (*)(_Float16)' <FunctionToPointerDecay>
+//CHECK-NEXT: | | | | | `-DeclRefExpr {{.*}} '_Float16 (_Float16)' lvalue Function {{.*}} 'func1t' '_Float16 (_Float16)' (FunctionTemplate {{.*}} 'func1t')
+//CHECK-NEXT: | | | | `-ImplicitCastExpr {{.*}} '_Float16' <LValueToRValue>
+//CHECK-NEXT: | | | | `-DeclRefExpr {{.*}} '_Float16' lvalue Var {{.*}} 'f1l' '_Float16'
+//CHECK-NEXT: | | | `-ImplicitCastExpr {{.*}} '_Float16' <LValueToRValue>
+//CHECK-NEXT: | | | `-MemberExpr {{.*}} '_Float16' lvalue .mem2 {{.*}}
+//CHECK-NEXT: | | | `-DeclRefExpr {{.*}} 'S1<_Float16>':'S1<_Float16>' lvalue Var {{.*}} 's1' 'S1<_Float16>':'S1<_Float16>'
+//CHECK-NEXT: | | `-ImplicitCastExpr {{.*}} '_Float16' <LValueToRValue>
+//CHECK-NEXT: | | `-DeclRefExpr {{.*}} '_Float16' lvalue Var {{.*}} 'f1n' '_Float16'
+//CHECK-NEXT: | `-ImplicitCastExpr {{.*}} '_Float16' <LValueToRValue>
+//CHECK-NEXT: | `-DeclRefExpr {{.*}} '_Float16' lvalue Var {{.*}} 'f2n' '_Float16'
+
+ auto f5l = -1.f16, *f6l = &f2l, f7l = func1t(f3l);
+//CHECK: | |-VarDecl {{.*}} f5l '_Float16':'_Float16' cinit
+//CHECK-NEXT: | | `-UnaryOperator {{.*}} '_Float16' prefix '-'
+//CHECK-NEXT: | | `-FloatingLiteral {{.*}} '_Float16' 1.000000e+00
+//CHECK-NEXT: | |-VarDecl {{.*}} f6l '_Float16 *' cinit
+//CHECK-NEXT: | | `-UnaryOperator {{.*}} '_Float16 *' prefix '&'
+//CHECK-NEXT: | | `-DeclRefExpr {{.*}} '_Float16' lvalue Var {{.*}} 'f2l' '_Float16'
+//CHECK-NEXT: | `-VarDecl {{.*}} f7l '_Float16':'_Float16' cinit
+//CHECK-NEXT: | `-CallExpr {{.*}} '_Float16':'_Float16'
+//CHECK-NEXT: | |-ImplicitCastExpr {{.*}} '_Float16 (*)(_Float16)' <FunctionToPointerDecay>
+//CHECK-NEXT: | | `-DeclRefExpr {{.*}} '_Float16 (_Float16)' lvalue Function {{.*}} 'func1t' '_Float16 (_Float16)' (FunctionTemplate {{.*}} 'func1t')
+//CHECK-NEXT: | `-ImplicitCastExpr {{.*}} '_Float16' <LValueToRValue>
+//CHECK-NEXT: | `-DeclRefExpr {{.*}} '_Float16' lvalue Var {{.*}} 'f3l' '_Float16'
+
+ _Float16 f8l = f4l++;
+//CHECK: | `-VarDecl {{.*}} f8l '_Float16' cinit
+//CHECK-NEXT: | `-UnaryOperator {{.*}} '_Float16' postfix '++'
+//CHECK-NEXT: | `-DeclRefExpr {{.*}} '_Float16' lvalue Var {{.*}} 'f4l' '_Float16'
+
+ _Float16 arr1l[] = { -1.f16, -0.f16, -11.f16 };
+//CHECK: `-VarDecl {{.*}} arr1l '_Float16[3]' cinit
+//CHECK-NEXT: `-InitListExpr {{.*}} '_Float16[3]'
+//CHECK-NEXT: |-UnaryOperator {{.*}} '_Float16' prefix '-'
+//CHECK-NEXT: | `-FloatingLiteral {{.*}} '_Float16' 1.000000e+00
+//CHECK-NEXT: |-UnaryOperator {{.*}} '_Float16' prefix '-'
+//CHECK-NEXT: | `-FloatingLiteral {{.*}} '_Float16' 0.000000e+00
+//CHECK-NEXT: `-UnaryOperator {{.*}} '_Float16' prefix '-'
+//CHECK-NEXT: `-FloatingLiteral {{.*}} '_Float16' 1.100000e+01
+
+ float cvtf = f2n;
+//CHECK: `-VarDecl {{.*}} cvtf 'float' cinit
+//CHECK-NEXT: `-ImplicitCastExpr {{.*}} 'float' <FloatingCast>
+//CHECK-NEXT: `-ImplicitCastExpr {{.*}} '_Float16' <LValueToRValue>
+//CHECK-NEXT: `-DeclRefExpr {{.*}} '_Float16' lvalue Var {{.*}} 'f2n' '_Float16'
+
+ double cvtd = f2n;
+//CHECK: `-VarDecl {{.*}} cvtd 'double' cinit
+//CHECK-NEXT: `-ImplicitCastExpr {{.*}} 'double' <FloatingCast>
+//CHECK-NEXT: `-ImplicitCastExpr {{.*}} '_Float16' <LValueToRValue>
+//CHECK-NEXT: `-DeclRefExpr {{.*}} '_Float16' lvalue Var {{.*}} 'f2n' '_Float16'
+
+ long double cvtld = f2n;
+//CHECK: `-VarDecl {{.*}} cvtld 'long double' cinit
+//CHECK-NEXT: `-ImplicitCastExpr {{.*}} 'long double' <FloatingCast>
+//CHECK-NEXT: `-ImplicitCastExpr {{.*}} '_Float16' <LValueToRValue>
+//CHECK-NEXT: `-DeclRefExpr {{.*}} '_Float16' lvalue Var {{.*}} 'f2n' '_Float16'
+
+ _Float16 f2h = 42.0f;
+//CHECK: `-VarDecl {{.*}} f2h '_Float16' cinit
+//CHECK-NEXT: `-ImplicitCastExpr {{.*}} '_Float16' <FloatingCast>
+//CHECK-NEXT: `-FloatingLiteral {{.*}} 'float' 4.200000e+01
+
+ _Float16 d2h = 42.0;
+//CHECK: `-VarDecl {{.*}} d2h '_Float16' cinit
+//CHECK-NEXT: `-ImplicitCastExpr {{.*}} '_Float16' <FloatingCast>
+//CHECK-NEXT: `-FloatingLiteral {{.*}} 'double' 4.200000e+01
+
+ _Float16 ld2h = 42.0l;
+//CHECK: `-VarDecl {{.*}} ld2h '_Float16' cinit
+//CHECK-NEXT: `-ImplicitCastExpr {{.*}} '_Float16' <FloatingCast>
+//CHECK-NEXT: `-FloatingLiteral {{.*}} 'long double' 4.200000e+01
+}
diff --git a/clang/test/AST/sourceranges.cpp b/clang/test/AST/sourceranges.cpp
index afb9492b2c366..a5dd067ee56d6 100644
--- a/clang/test/AST/sourceranges.cpp
+++ b/clang/test/AST/sourceranges.cpp
@@ -1,210 +1,210 @@
-// RUN: %clang_cc1 -triple i686-mingw32 -ast-dump %s | FileCheck %s
-// RUN: %clang_cc1 -triple i686-mingw32 -std=c++1z -ast-dump %s | FileCheck %s -check-prefix=CHECK-1Z
-
-template<class T>
-class P {
- public:
- P(T* t) {}
-};
-
-namespace foo {
-class A { public: A(int = 0) {} };
-enum B {};
-typedef int C;
-}
-
-// CHECK: VarDecl {{0x[0-9a-fA-F]+}} <line:[[@LINE+1]]:1, col:36> col:15 ImplicitConstrArray 'foo::A[2]'
-static foo::A ImplicitConstrArray[2];
-
-int main() {
- // CHECK: CXXNewExpr {{0x[0-9a-fA-F]+}} <col:19, col:28> 'foo::A *'
- P<foo::A> p14 = new foo::A;
- // CHECK: CXXNewExpr {{0x[0-9a-fA-F]+}} <col:19, col:28> 'foo::B *'
- P<foo::B> p24 = new foo::B;
- // CHECK: CXXNewExpr {{0x[0-9a-fA-F]+}} <col:19, col:28> 'foo::C *'
- P<foo::C> pr4 = new foo::C;
-}
-
-foo::A getName() {
- // CHECK: CXXConstructExpr {{0x[0-9a-fA-F]+}} <col:10, col:17> 'foo::A'
- return foo::A();
-}
-
-void destruct(foo::A *a1, foo::A *a2, P<int> *p1) {
- // CHECK: MemberExpr {{0x[0-9a-fA-F]+}} <col:3, col:8> '<bound member function type>' ->~A
- a1->~A();
- // CHECK: MemberExpr {{0x[0-9a-fA-F]+}} <col:3, col:16> '<bound member function type>' ->~A
- a2->foo::A::~A();
- // CHECK: MemberExpr {{0x[0-9a-fA-F]+}} <col:3, col:13> '<bound member function type>' ->~P
- p1->~P<int>();
-}
-
-struct D {
- D(int);
- ~D();
-};
-
-void construct() {
- using namespace foo;
- A a = A(12);
- // CHECK: CXXConstructExpr {{0x[0-9a-fA-F]+}} <col:9, col:13> 'foo::A' 'void (int){{( __attribute__\(\(thiscall\)\))?}}'
- D d = D(12);
- // CHECK: CXXConstructExpr {{0x[0-9a-fA-F]+}} <col:9, col:13> 'D' 'void (int){{( __attribute__\(\(thiscall\)\))?}}'
-}
-
-namespace PR38987 {
-struct A { A(); };
-template <class T> void f() { T{}; }
-template void f<A>();
-// CHECK: CXXTemporaryObjectExpr {{.*}} <col:31, col:33> 'PR38987::A':'PR38987::A'
-}
-
-void abort() __attribute__((noreturn));
-
-namespace std {
-typedef decltype(sizeof(int)) size_t;
-
-template <typename E> struct initializer_list {
- const E *p;
- size_t n;
- initializer_list(const E *p, size_t n) : p(p), n(n) {}
-};
-
-template <typename F, typename S> struct pair {
- F f;
- S s;
- pair(const F &f, const S &s) : f(f), s(s) {}
-};
-
-struct string {
- const char *str;
- string() { abort(); }
- string(const char *S) : str(S) {}
- ~string() { abort(); }
-};
-
-template<typename K, typename V>
-struct map {
- using T = pair<K, V>;
- map(initializer_list<T> i, const string &s = string()) {}
- ~map() { abort(); }
-};
-
-}; // namespace std
-
-// CHECK: NamespaceDecl {{.*}} attributed_decl
-namespace attributed_decl {
- void f() {
- // CHECK: DeclStmt {{.*}} <line:[[@LINE+1]]:5, col:28>
- [[maybe_unused]] int i1;
- // CHECK: DeclStmt {{.*}} <line:[[@LINE+1]]:5, col:35>
- __attribute__((unused)) int i2;
- // CHECK: DeclStmt {{.*}} <line:[[@LINE+1]]:5, col:35>
- int __attribute__((unused)) i3;
- // CHECK: DeclStmt {{.*}} <<built-in>:{{.*}}, {{.*}}:[[@LINE+1]]:40>
- __declspec(dllexport) extern int i4;
- // CHECK: DeclStmt {{.*}} <line:[[@LINE+1]]:5, col:40>
- extern int __declspec(dllexport) i5;
- }
-}
-
-// CHECK-1Z: NamespaceDecl {{.*}} attributed_case
-namespace attributed_case {
-void f(int n) {
- switch (n) {
- case 0:
- n--;
- // CHECK: AttributedStmt {{.*}} <line:[[@LINE+2]]:5, line:[[@LINE+4]]:35>
- // CHECK: FallThroughAttr {{.*}} <line:[[@LINE+1]]:20>
- __attribute__((fallthrough))
- // CHECK: FallThroughAttr {{.*}} <line:[[@LINE+1]]:22>
- __attribute__((fallthrough));
- case 1:
- n++;
- break;
- }
-}
-} // namespace attributed_case
-
-// CHECK: NamespaceDecl {{.*}} attributed_stmt
-namespace attributed_stmt {
- // In DO_PRAGMA and _Pragma cases, `LoopHintAttr` comes from <scratch space>
- // file.
-
- #define DO_PRAGMA(x) _Pragma (#x)
-
- void f() {
- // CHECK: AttributedStmt {{.*}} <line:[[@LINE-3]]:24, line:[[@LINE+2]]:33>
- DO_PRAGMA (unroll(2))
- for (int i = 0; i < 10; ++i);
-
- // CHECK: AttributedStmt {{.*}} <line:[[@LINE+2]]:5, line:[[@LINE+3]]:33>
- // CHECK: LoopHintAttr {{.*}} <line:[[@LINE+1]]:13, col:22>
- #pragma unroll(2)
- for (int i = 0; i < 10; ++i);
-
- // CHECK: AttributedStmt {{.*}} <line:[[@LINE+2]]:5, line:[[@LINE+5]]:33>
- // CHECK: LoopHintAttr {{.*}} <line:[[@LINE+1]]:19, col:41>
- #pragma clang loop vectorize(enable)
- // CHECK: LoopHintAttr {{.*}} <line:[[@LINE+1]]:19, col:42>
- #pragma clang loop interleave(enable)
- for (int i = 0; i < 10; ++i);
-
- // CHECK: AttributedStmt {{.*}} <line:[[@LINE+1]]:5, line:[[@LINE+2]]:33>
- _Pragma("unroll(2)")
- for (int i = 0; i < 10; ++i);
- }
-}
-
-#if __cplusplus >= 201703L
-// CHECK-1Z: FunctionDecl {{.*}} construct_with_init_list
-std::map<int, int> construct_with_init_list() {
- // CHECK-1Z-NEXT: CompoundStmt
- // CHECK-1Z-NEXT: ReturnStmt {{.*}} <line:[[@LINE+5]]:3, col:35
- // CHECK-1Z-NEXT: ExprWithCleanups {{.*}} <col:10, col:35
- // CHECK-1Z-NEXT: CXXBindTemporaryExpr {{.*}} <col:10, col:35
- // CHECK-1Z-NEXT: CXXTemporaryObjectExpr {{.*}} <col:10, col:35
- // CHECK-1Z-NEXT: CXXStdInitializerListExpr {{.*}} <col:28, col:35
- return std::map<int, int>{{0, 0}};
-}
-
-// CHECK-1Z: NamespaceDecl {{.*}} in_class_init
-namespace in_class_init {
- struct A {};
-
- // CHECK-1Z: CXXRecordDecl {{.*}} struct B definition
- struct B {
- // CHECK-1Z: FieldDecl {{.*}} a 'in_class_init::A'
- // CHECK-1Z-NEXT: InitListExpr {{.*}} <col:11, col:12
- A a = {};
- };
-}
-
-// CHECK-1Z: NamespaceDecl {{.*}} delegating_constructor_init
-namespace delegating_constructor_init {
- struct A {};
-
- struct B : A {
- A a;
- B(A a) : a(a) {}
- };
-
- // CHECK-1Z: CXXRecordDecl {{.*}} struct C definition
- struct C : B {
- // CHECK-1Z: CXXConstructorDecl {{.*}} C
- // CHECK-1Z-NEXT: CXXCtorInitializer 'delegating_constructor_init::B'
- // CHECK-1Z-NEXT: CXXConstructExpr {{.*}} <col:11, col:15
- // CHECK-1Z-NEXT: InitListExpr {{.*}} <col:13, col:14
- C() : B({}) {};
- };
-}
-
-// CHECK-1Z: NamespaceDecl {{.*}} new_init
-namespace new_init {
- void A() {
- // CHECK-1Z: CXXNewExpr {{.*}} <line:[[@LINE+2]]:5, col:14
- // CHECK-1Z-NEXT: InitListExpr {{.*}} <col:12, col:14
- new int{0};
- }
-}
-#endif
+// RUN: %clang_cc1 -triple i686-mingw32 -ast-dump %s | FileCheck %s
+// RUN: %clang_cc1 -triple i686-mingw32 -std=c++1z -ast-dump %s | FileCheck %s -check-prefix=CHECK-1Z
+
+template<class T>
+class P {
+ public:
+ P(T* t) {}
+};
+
+namespace foo {
+class A { public: A(int = 0) {} };
+enum B {};
+typedef int C;
+}
+
+// CHECK: VarDecl {{0x[0-9a-fA-F]+}} <line:[[@LINE+1]]:1, col:36> col:15 ImplicitConstrArray 'foo::A[2]'
+static foo::A ImplicitConstrArray[2];
+
+int main() {
+ // CHECK: CXXNewExpr {{0x[0-9a-fA-F]+}} <col:19, col:28> 'foo::A *'
+ P<foo::A> p14 = new foo::A;
+ // CHECK: CXXNewExpr {{0x[0-9a-fA-F]+}} <col:19, col:28> 'foo::B *'
+ P<foo::B> p24 = new foo::B;
+ // CHECK: CXXNewExpr {{0x[0-9a-fA-F]+}} <col:19, col:28> 'foo::C *'
+ P<foo::C> pr4 = new foo::C;
+}
+
+foo::A getName() {
+ // CHECK: CXXConstructExpr {{0x[0-9a-fA-F]+}} <col:10, col:17> 'foo::A'
+ return foo::A();
+}
+
+void destruct(foo::A *a1, foo::A *a2, P<int> *p1) {
+ // CHECK: MemberExpr {{0x[0-9a-fA-F]+}} <col:3, col:8> '<bound member function type>' ->~A
+ a1->~A();
+ // CHECK: MemberExpr {{0x[0-9a-fA-F]+}} <col:3, col:16> '<bound member function type>' ->~A
+ a2->foo::A::~A();
+ // CHECK: MemberExpr {{0x[0-9a-fA-F]+}} <col:3, col:13> '<bound member function type>' ->~P
+ p1->~P<int>();
+}
+
+struct D {
+ D(int);
+ ~D();
+};
+
+void construct() {
+ using namespace foo;
+ A a = A(12);
+ // CHECK: CXXConstructExpr {{0x[0-9a-fA-F]+}} <col:9, col:13> 'foo::A' 'void (int){{( __attribute__\(\(thiscall\)\))?}}'
+ D d = D(12);
+ // CHECK: CXXConstructExpr {{0x[0-9a-fA-F]+}} <col:9, col:13> 'D' 'void (int){{( __attribute__\(\(thiscall\)\))?}}'
+}
+
+namespace PR38987 {
+struct A { A(); };
+template <class T> void f() { T{}; }
+template void f<A>();
+// CHECK: CXXTemporaryObjectExpr {{.*}} <col:31, col:33> 'PR38987::A':'PR38987::A'
+}
+
+void abort() __attribute__((noreturn));
+
+namespace std {
+typedef decltype(sizeof(int)) size_t;
+
+template <typename E> struct initializer_list {
+ const E *p;
+ size_t n;
+ initializer_list(const E *p, size_t n) : p(p), n(n) {}
+};
+
+template <typename F, typename S> struct pair {
+ F f;
+ S s;
+ pair(const F &f, const S &s) : f(f), s(s) {}
+};
+
+struct string {
+ const char *str;
+ string() { abort(); }
+ string(const char *S) : str(S) {}
+ ~string() { abort(); }
+};
+
+template<typename K, typename V>
+struct map {
+ using T = pair<K, V>;
+ map(initializer_list<T> i, const string &s = string()) {}
+ ~map() { abort(); }
+};
+
+}; // namespace std
+
+// CHECK: NamespaceDecl {{.*}} attributed_decl
+namespace attributed_decl {
+ void f() {
+ // CHECK: DeclStmt {{.*}} <line:[[@LINE+1]]:5, col:28>
+ [[maybe_unused]] int i1;
+ // CHECK: DeclStmt {{.*}} <line:[[@LINE+1]]:5, col:35>
+ __attribute__((unused)) int i2;
+ // CHECK: DeclStmt {{.*}} <line:[[@LINE+1]]:5, col:35>
+ int __attribute__((unused)) i3;
+ // CHECK: DeclStmt {{.*}} <<built-in>:{{.*}}, {{.*}}:[[@LINE+1]]:40>
+ __declspec(dllexport) extern int i4;
+ // CHECK: DeclStmt {{.*}} <line:[[@LINE+1]]:5, col:40>
+ extern int __declspec(dllexport) i5;
+ }
+}
+
+// CHECK-1Z: NamespaceDecl {{.*}} attributed_case
+namespace attributed_case {
+void f(int n) {
+ switch (n) {
+ case 0:
+ n--;
+ // CHECK: AttributedStmt {{.*}} <line:[[@LINE+2]]:5, line:[[@LINE+4]]:35>
+ // CHECK: FallThroughAttr {{.*}} <line:[[@LINE+1]]:20>
+ __attribute__((fallthrough))
+ // CHECK: FallThroughAttr {{.*}} <line:[[@LINE+1]]:22>
+ __attribute__((fallthrough));
+ case 1:
+ n++;
+ break;
+ }
+}
+} // namespace attributed_case
+
+// CHECK: NamespaceDecl {{.*}} attributed_stmt
+namespace attributed_stmt {
+ // In DO_PRAGMA and _Pragma cases, `LoopHintAttr` comes from <scratch space>
+ // file.
+
+ #define DO_PRAGMA(x) _Pragma (#x)
+
+ void f() {
+ // CHECK: AttributedStmt {{.*}} <line:[[@LINE-3]]:24, line:[[@LINE+2]]:33>
+ DO_PRAGMA (unroll(2))
+ for (int i = 0; i < 10; ++i);
+
+ // CHECK: AttributedStmt {{.*}} <line:[[@LINE+2]]:5, line:[[@LINE+3]]:33>
+ // CHECK: LoopHintAttr {{.*}} <line:[[@LINE+1]]:13, col:22>
+ #pragma unroll(2)
+ for (int i = 0; i < 10; ++i);
+
+ // CHECK: AttributedStmt {{.*}} <line:[[@LINE+2]]:5, line:[[@LINE+5]]:33>
+ // CHECK: LoopHintAttr {{.*}} <line:[[@LINE+1]]:19, col:41>
+ #pragma clang loop vectorize(enable)
+ // CHECK: LoopHintAttr {{.*}} <line:[[@LINE+1]]:19, col:42>
+ #pragma clang loop interleave(enable)
+ for (int i = 0; i < 10; ++i);
+
+ // CHECK: AttributedStmt {{.*}} <line:[[@LINE+1]]:5, line:[[@LINE+2]]:33>
+ _Pragma("unroll(2)")
+ for (int i = 0; i < 10; ++i);
+ }
+}
+
+#if __cplusplus >= 201703L
+// CHECK-1Z: FunctionDecl {{.*}} construct_with_init_list
+std::map<int, int> construct_with_init_list() {
+ // CHECK-1Z-NEXT: CompoundStmt
+ // CHECK-1Z-NEXT: ReturnStmt {{.*}} <line:[[@LINE+5]]:3, col:35
+ // CHECK-1Z-NEXT: ExprWithCleanups {{.*}} <col:10, col:35
+ // CHECK-1Z-NEXT: CXXBindTemporaryExpr {{.*}} <col:10, col:35
+ // CHECK-1Z-NEXT: CXXTemporaryObjectExpr {{.*}} <col:10, col:35
+ // CHECK-1Z-NEXT: CXXStdInitializerListExpr {{.*}} <col:28, col:35
+ return std::map<int, int>{{0, 0}};
+}
+
+// CHECK-1Z: NamespaceDecl {{.*}} in_class_init
+namespace in_class_init {
+ struct A {};
+
+ // CHECK-1Z: CXXRecordDecl {{.*}} struct B definition
+ struct B {
+ // CHECK-1Z: FieldDecl {{.*}} a 'in_class_init::A'
+ // CHECK-1Z-NEXT: InitListExpr {{.*}} <col:11, col:12
+ A a = {};
+ };
+}
+
+// CHECK-1Z: NamespaceDecl {{.*}} delegating_constructor_init
+namespace delegating_constructor_init {
+ struct A {};
+
+ struct B : A {
+ A a;
+ B(A a) : a(a) {}
+ };
+
+ // CHECK-1Z: CXXRecordDecl {{.*}} struct C definition
+ struct C : B {
+ // CHECK-1Z: CXXConstructorDecl {{.*}} C
+ // CHECK-1Z-NEXT: CXXCtorInitializer 'delegating_constructor_init::B'
+ // CHECK-1Z-NEXT: CXXConstructExpr {{.*}} <col:11, col:15
+ // CHECK-1Z-NEXT: InitListExpr {{.*}} <col:13, col:14
+ C() : B({}) {};
+ };
+}
+
+// CHECK-1Z: NamespaceDecl {{.*}} new_init
+namespace new_init {
+ void A() {
+ // CHECK-1Z: CXXNewExpr {{.*}} <line:[[@LINE+2]]:5, col:14
+ // CHECK-1Z-NEXT: InitListExpr {{.*}} <col:12, col:14
+ new int{0};
+ }
+}
+#endif
More information about the cfe-commits
mailing list