llvm-project/clang/test/AST/ast-dump-using.cpp
kadir çetinkaya 5cb2ebc08f
Reland "[clang] Preserve found-decl when constructing VarTemplateIds" (#82612)
Update include-cleaner tests. Now that we have proper found-decls set up
for VarTemplates, in case of instationtations we point to primary
templates and not specializations. To be changed in a follow-up patch.
2024-02-23 11:37:30 +01:00

32 lines
1.0 KiB
C++

// RUN: %clang_cc1 -triple x86_64-unknown-unknown -ast-dump %s | FileCheck -strict-whitespace %s
namespace a {
struct S;
template <typename T> T x = {};
}
namespace b {
using a::S;
// CHECK: UsingDecl {{.*}} a::S
// CHECK-NEXT: | `-NestedNameSpecifier Namespace {{.*}} 'a'
// CHECK-NEXT: UsingShadowDecl {{.*}} implicit CXXRecord {{.*}} 'S'
// CHECK-NEXT: `-RecordType {{.*}} 'a::S'
typedef S f; // to dump the introduced type
// CHECK: TypedefDecl
// CHECK-NEXT: `-ElaboratedType {{.*}} 'S' sugar
// CHECK-NEXT: `-UsingType [[TYPE_ADDR:.*]] 'a::S' sugar
// CHECK-NEXT: |-UsingShadow [[SHADOW_ADDR:.*]] 'S'
// CHECK-NEXT: `-RecordType {{.*}} 'a::S'
typedef S e; // check the same UsingType is reused.
// CHECK: TypedefDecl
// CHECK-NEXT: `-ElaboratedType {{.*}} 'S' sugar
// CHECK-NEXT: `-UsingType [[TYPE_ADDR]] 'a::S' sugar
// CHECK-NEXT: |-UsingShadow [[SHADOW_ADDR]] 'S'
// CHECK-NEXT: `-RecordType {{.*}} 'a::S'
using a::x;
void foo() {
x<int> = 3;
// CHECK: DeclRefExpr {{.*}} 'x' {{.*}} (UsingShadow {{.*}} 'x')
}
}