llvm-project/clang/test/AST/ast-dump-using.cpp
Wei Wang 2e52e13c1e
[clang] Make sure the same UsingType is searched and inserted (#79182)
When creating a new UsingType, the underlying type may change if it is a
declaration. This creates an inconsistency between the type searched and
type created. Update member and non-member Profile functions so that
they return the same ID.
2024-01-24 11:06:20 -08:00

25 lines
923 B
C++

// RUN: %clang_cc1 -triple x86_64-unknown-unknown -ast-dump %s | FileCheck -strict-whitespace %s
namespace a {
struct S;
}
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'
}