Skip to content

Commit 711a644

Browse files
committed
[clang][DebugInfo] Emit DW_AT_type of preferred name if available
With this patch, whenever we emit a `DW_AT_type` for some declaration and the type is a template class with a `clang::PreferredNameAttr`, we will emit the typedef that the attribute refers to instead. I.e., ``` 0x123 DW_TAG_variable DW_AT_name "var" DW_AT_type (0x123 "basic_string<char>") 0x124 DW_TAG_structure_type DW_AT_name "basic_string<char>" ``` ...becomes ``` 0x123 DW_TAG_variable DW_AT_name "var" DW_AT_type (0x124 "std::string") 0x124 DW_TAG_structure_type DW_AT_name "basic_string<char>" 0x125 DW_TAG_typedef DW_AT_name "std::string" DW_AT_type (0x124 "basic_string<char>") ``` We do this by returning the preferred name typedef `DIType` when we create a structure definition. In some cases, e.g., with `-gmodules`, we don't complete the structure definition immediately but do so later via `completeClassData`, which overwrites the `TypeCache`. In such cases we don't actually want to rewrite the cache with the preferred name. We handle this by returning both the definition and the preferred typedef from `CreateTypeDefinition` and let the callee decide what to do with it. Essentially we set up the types as: ``` TypeCache[Record] => DICompositeType ReplaceMap[Record] => DIDerivedType(baseType: DICompositeType) ``` For now we keep this behind LLDB tuning. **Testing** - Added clang unit-test - `check-llvm`, `check-clang` pass - Confirmed that this change correctly repoints `basic_string` references in some of my test programs. - Will add follow-up LLDB API tests Differential Revision: https://reviews.llvm.org/D145803
1 parent b04bc87 commit 711a644

File tree

12 files changed

+252
-14
lines changed

12 files changed

+252
-14
lines changed

clang/lib/CodeGen/CGDebugInfo.cpp

Lines changed: 32 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2556,7 +2556,11 @@ void CGDebugInfo::completeClass(const RecordDecl *RD) {
25562556
auto I = TypeCache.find(TyPtr);
25572557
if (I != TypeCache.end() && !cast<llvm::DIType>(I->second)->isForwardDecl())
25582558
return;
2559-
llvm::DIType *Res = CreateTypeDefinition(Ty->castAs<RecordType>());
2559+
2560+
// We want the canonical definition of the structure to not
2561+
// be the typedef. Since that would lead to circular typedef
2562+
// metadata.
2563+
auto [Res, PrefRes] = CreateTypeDefinition(Ty->castAs<RecordType>());
25602564
assert(!Res->isForwardDecl());
25612565
TypeCache[TyPtr].reset(Res);
25622566
}
@@ -2676,10 +2680,25 @@ llvm::DIType *CGDebugInfo::CreateType(const RecordType *Ty) {
26762680
return T;
26772681
}
26782682

2679-
return CreateTypeDefinition(Ty);
2683+
auto [Def, Pref] = CreateTypeDefinition(Ty);
2684+
2685+
return Pref ? Pref : Def;
26802686
}
26812687

2682-
llvm::DIType *CGDebugInfo::CreateTypeDefinition(const RecordType *Ty) {
2688+
llvm::DIType *CGDebugInfo::GetPreferredNameType(const CXXRecordDecl *RD,
2689+
llvm::DIFile *Unit) {
2690+
if (!RD)
2691+
return nullptr;
2692+
2693+
auto const *PNA = RD->getAttr<PreferredNameAttr>();
2694+
if (!PNA)
2695+
return nullptr;
2696+
2697+
return getOrCreateType(PNA->getTypedefType(), Unit);
2698+
}
2699+
2700+
std::pair<llvm::DIType *, llvm::DIType *>
2701+
CGDebugInfo::CreateTypeDefinition(const RecordType *Ty) {
26832702
RecordDecl *RD = Ty->getDecl();
26842703

26852704
// Get overall information about the record type for the debug info.
@@ -2695,7 +2714,7 @@ llvm::DIType *CGDebugInfo::CreateTypeDefinition(const RecordType *Ty) {
26952714

26962715
const RecordDecl *D = RD->getDefinition();
26972716
if (!D || !D->isCompleteDefinition())
2698-
return FwdDecl;
2717+
return {FwdDecl, nullptr};
26992718

27002719
if (const auto *CXXDecl = dyn_cast<CXXRecordDecl>(RD))
27012720
CollectContainingType(CXXDecl, FwdDecl);
@@ -2734,7 +2753,12 @@ llvm::DIType *CGDebugInfo::CreateTypeDefinition(const RecordType *Ty) {
27342753
llvm::MDNode::replaceWithPermanent(llvm::TempDICompositeType(FwdDecl));
27352754

27362755
RegionMap[Ty->getDecl()].reset(FwdDecl);
2737-
return FwdDecl;
2756+
2757+
if (CGM.getCodeGenOpts().getDebuggerTuning() == llvm::DebuggerKind::LLDB)
2758+
if (auto *PrefDI = GetPreferredNameType(CXXDecl, DefUnit))
2759+
return {FwdDecl, PrefDI};
2760+
2761+
return {FwdDecl, nullptr};
27382762
}
27392763

27402764
llvm::DIType *CGDebugInfo::CreateType(const ObjCObjectType *Ty,
@@ -3763,7 +3787,7 @@ llvm::DICompositeType *CGDebugInfo::CreateLimitedType(const RecordType *Ty) {
37633787
void CGDebugInfo::CollectContainingType(const CXXRecordDecl *RD,
37643788
llvm::DICompositeType *RealDecl) {
37653789
// A class's primary base or the class itself contains the vtable.
3766-
llvm::DICompositeType *ContainingType = nullptr;
3790+
llvm::DIType *ContainingType = nullptr;
37673791
const ASTRecordLayout &RL = CGM.getContext().getASTRecordLayout(RD);
37683792
if (const CXXRecordDecl *PBase = RL.getPrimaryBase()) {
37693793
// Seek non-virtual primary base root.
@@ -3775,9 +3799,8 @@ void CGDebugInfo::CollectContainingType(const CXXRecordDecl *RD,
37753799
else
37763800
break;
37773801
}
3778-
ContainingType = cast<llvm::DICompositeType>(
3779-
getOrCreateType(QualType(PBase->getTypeForDecl(), 0),
3780-
getOrCreateFile(RD->getLocation())));
3802+
ContainingType = getOrCreateType(QualType(PBase->getTypeForDecl(), 0),
3803+
getOrCreateFile(RD->getLocation()));
37813804
} else if (RD->isDynamicClass())
37823805
ContainingType = RealDecl;
37833806

clang/lib/CodeGen/CGDebugInfo.h

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,15 @@ class CGDebugInfo {
192192
llvm::DIType *CreateType(const FunctionType *Ty, llvm::DIFile *F);
193193
/// Get structure or union type.
194194
llvm::DIType *CreateType(const RecordType *Tyg);
195-
llvm::DIType *CreateTypeDefinition(const RecordType *Ty);
195+
196+
/// Create definition for the specified 'Ty'.
197+
///
198+
/// \returns A pair of 'llvm::DIType's. The first is the definition
199+
/// of the 'Ty'. The second is the type specified by the preferred_name
200+
/// attribute on 'Ty', which can be a nullptr if no such attribute
201+
/// exists.
202+
std::pair<llvm::DIType *, llvm::DIType *>
203+
CreateTypeDefinition(const RecordType *Ty);
196204
llvm::DICompositeType *CreateLimitedType(const RecordType *Ty);
197205
void CollectContainingType(const CXXRecordDecl *RD,
198206
llvm::DICompositeType *CT);
@@ -276,6 +284,12 @@ class CGDebugInfo {
276284
llvm::DenseSet<CanonicalDeclPtr<const CXXRecordDecl>> &SeenTypes,
277285
llvm::DINode::DIFlags StartingFlags);
278286

287+
/// Helper function that returns the llvm::DIType that the
288+
/// PreferredNameAttr attribute on \ref RD refers to. If no such
289+
/// attribute exists, returns nullptr.
290+
llvm::DIType *GetPreferredNameType(const CXXRecordDecl *RD,
291+
llvm::DIFile *Unit);
292+
279293
struct TemplateArgs {
280294
const TemplateParameterList *TList;
281295
llvm::ArrayRef<TemplateArgument> Args;
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
// RUN: %clang_cc1 -triple x86_64-unk-unk -o - -emit-llvm -debug-info-kind=standalone -debugger-tuning=lldb %s | FileCheck %s --check-prefixes=COMMON,LLDB
2+
// RUN: %clang_cc1 -triple x86_64-unk-unk -o - -emit-llvm -debug-info-kind=standalone -debugger-tuning=gdb %s | FileCheck %s --check-prefixes=COMMON,GDB
3+
4+
template <typename T>
5+
struct Foo;
6+
7+
typedef Foo<int> BarIntBase;
8+
typedef BarIntBase BarIntTmp;
9+
typedef BarIntTmp BarInt;
10+
11+
template <typename T>
12+
using BarBase = Foo<T>;
13+
14+
template <typename T>
15+
using BarTmp = BarBase<T>;
16+
17+
template <typename T>
18+
using Bar = BarTmp<T>;
19+
20+
template <typename T>
21+
struct [[clang::preferred_name(BarInt),
22+
clang::preferred_name(Bar<char>)]] Foo{
23+
};
24+
25+
int main() {
26+
Foo<int> varInt;
27+
28+
// COMMON: !DILocalVariable(name: "varInt", scope: ![[#]], file: ![[#]], line: [[#]], type: ![[BAR_INT_TY:[0-9]+]])
29+
// LLDB: ![[BAR_INT_TY]] = !DIDerivedType(tag: DW_TAG_typedef, name: "BarInt", file: ![[#]], line: [[#]], baseType: ![[BAR_INT_TMP:[0-9]+]])
30+
// LLDB: ![[BAR_INT_TMP]] = !DIDerivedType(tag: DW_TAG_typedef, name: "BarIntTmp", file: ![[#]], line: [[#]], baseType: ![[BAR_INT_BASE:[0-9]+]])
31+
// LLDB: ![[BAR_INT_BASE]] = !DIDerivedType(tag: DW_TAG_typedef, name: "BarIntBase", file: ![[#]], line: [[#]], baseType: ![[FOO_INT:[0-9]+]])
32+
// LLDB: ![[FOO_INT]] = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "Foo<int>", file: ![[#]], line: [[#]], size: [[#]]
33+
// GDB: ![[BAR_INT_TY]] = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "Foo<int>", file: ![[#]], line: [[#]], size: [[#]]
34+
35+
Foo<char> varChar;
36+
37+
// COMMON: !DILocalVariable(name: "varChar", scope: ![[#]], file: ![[#]], line: [[#]], type: ![[BAR_CHAR_TY:[0-9]+]])
38+
// LLDB: ![[BAR_CHAR_TY]] = !DIDerivedType(tag: DW_TAG_typedef, name: "Bar<char>", file: ![[#]], line: [[#]], baseType: ![[BAR_CHAR_TMP:[0-9]+]])
39+
// LLDB: ![[BAR_CHAR_TMP]] = !DIDerivedType(tag: DW_TAG_typedef, name: "BarTmp<char>", file: ![[#]], line: [[#]], baseType: ![[BAR_CHAR_BASE:[0-9]+]])
40+
// LLDB: ![[BAR_CHAR_BASE]] = !DIDerivedType(tag: DW_TAG_typedef, name: "BarBase<char>", file: ![[#]], line: [[#]], baseType: ![[FOO_CHAR:[0-9]+]])
41+
// LLDB: ![[FOO_CHAR]] = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "Foo<char>"
42+
// GDB: ![[BAR_CHAR_TY]] = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "Foo<char>"
43+
44+
Foo<Foo<int>> varFooInt;
45+
46+
// COMMON: !DILocalVariable(name: "varFooInt", scope: ![[#]], file: ![[#]], line: [[#]], type: ![[FOO_BAR_INT_TY:[0-9]+]])
47+
// COMMON: ![[FOO_BAR_INT_TY]] = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "Foo<Foo<int> >"
48+
// COMMON-SAME: templateParams: ![[PARAM:[0-9]+]]
49+
// COMMON: ![[PARAM]] = !{![[TEMPL_TYPE_PARAM:[0-9]+]]}
50+
// GDB: ![[TEMPL_TYPE_PARAM]] = !DITemplateTypeParameter(name: "T", type: ![[BAR_INT_TY]])
51+
// LLDB: ![[TEMPL_TYPE_PARAM]] = !DITemplateTypeParameter(name: "T", type: ![[BAR_INT_TY]])
52+
53+
Foo<Foo<char>> varFooChar;
54+
55+
// COMMON: !DILocalVariable(name: "varFooChar", scope: ![[#]], file: ![[#]], line: [[#]], type: ![[FOO_BAR_CHAR_TY:[0-9]+]])
56+
// COMMON: ![[FOO_BAR_CHAR_TY]] = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "Foo<Foo<char> >"
57+
// COMMON-SAME: templateParams: ![[CHAR_PARAM:[0-9]+]]
58+
// COMMON: ![[CHAR_PARAM]] = !{![[CHAR_TEMPL_TYPE_PARAM:[0-9]+]]}
59+
// GDB: ![[CHAR_TEMPL_TYPE_PARAM]] = !DITemplateTypeParameter(name: "T", type: ![[BAR_CHAR_TY]])
60+
// LLDB: ![[CHAR_TEMPL_TYPE_PARAM]] = !DITemplateTypeParameter(name: "T", type: ![[BAR_CHAR_TY]])
61+
62+
return 0;
63+
}
64+
65+
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
// RUN: %clang_cc1 -triple x86_64-unk-unk -o - -emit-llvm -debug-info-kind=standalone -debugger-tuning=lldb %s | FileCheck %s --check-prefixes=COMMON,LLDB
2+
// RUN: %clang_cc1 -triple x86_64-unk-unk -o - -emit-llvm -debug-info-kind=standalone -debugger-tuning=gdb %s | FileCheck %s --check-prefixes=COMMON,GDB
3+
4+
template <typename T>
5+
struct Foo;
6+
7+
typedef Foo<int> BarInt;
8+
typedef Foo<double> BarDouble;
9+
10+
template <typename T>
11+
using Bar = Foo<T>;
12+
13+
template <typename T>
14+
struct [[clang::preferred_name(BarInt),
15+
clang::preferred_name(BarDouble),
16+
clang::preferred_name(Bar<short>),
17+
clang::preferred_name(Bar<char>)]] Foo{
18+
};
19+
20+
int main() {
21+
Foo<int> varInt;
22+
23+
// COMMON: !DILocalVariable(name: "varInt", scope: ![[#]], file: ![[#]], line: [[#]], type: ![[BAR_INT_TY:[0-9]+]])
24+
// LLDB: ![[BAR_INT_TY]] = !DIDerivedType(tag: DW_TAG_typedef, name: "BarInt", file: ![[#]], line: [[#]], baseType: ![[BAR_INT_BASE:[0-9]+]])
25+
// LLDB: ![[BAR_INT_BASE]] = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "Foo<int>", file: ![[#]], line: [[#]], size: [[#]]
26+
// GDB: ![[BAR_INT_TY]] = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "Foo<int>", file: ![[#]], line: [[#]], size: [[#]]
27+
28+
Foo<double> varDouble;
29+
30+
// COMMON: !DILocalVariable(name: "varDouble", scope: ![[#]], file: ![[#]], line: [[#]], type: ![[BAR_DOUBLE_TY:[0-9]+]])
31+
// LLDB: ![[BAR_DOUBLE_TY]] = !DIDerivedType(tag: DW_TAG_typedef, name: "BarDouble", file: ![[#]], line: [[#]], baseType: ![[BAR_DOUBLE_BASE:[0-9]+]])
32+
// LLDB: ![[BAR_DOUBLE_BASE]] = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "Foo<double>"
33+
// GDB: ![[BAR_DOUBLE_TY]] = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "Foo<double>"
34+
35+
Foo<short> varShort;
36+
37+
// COMMON: !DILocalVariable(name: "varShort", scope: ![[#]], file: ![[#]], line: [[#]], type: ![[BAR_SHORT_TY:[0-9]+]])
38+
// LLDB: ![[BAR_SHORT_TY]] = !DIDerivedType(tag: DW_TAG_typedef, name: "Bar<short>", file: ![[#]], line: [[#]], baseType: ![[BAR_SHORT_BASE:[0-9]+]])
39+
// LLDB: ![[BAR_SHORT_BASE]] = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "Foo<short>"
40+
// GDB: ![[BAR_SHORT_TY]] = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "Foo<short>"
41+
42+
Foo<char> varChar;
43+
44+
// COMMON: !DILocalVariable(name: "varChar", scope: ![[#]], file: ![[#]], line: [[#]], type: ![[BAR_CHAR_TY:[0-9]+]])
45+
// LLDB: ![[BAR_CHAR_TY]] = !DIDerivedType(tag: DW_TAG_typedef, name: "Bar<char>", file: ![[#]], line: [[#]], baseType: ![[BAR_CHAR_BASE:[0-9]+]])
46+
// LLDB: ![[BAR_CHAR_BASE]] = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "Foo<char>"
47+
// GDB: ![[BAR_CHAR_TY]] = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "Foo<char>"
48+
49+
Foo<Foo<int>> varFooInt;
50+
51+
// COMMON: !DILocalVariable(name: "varFooInt", scope: ![[#]], file: ![[#]], line: [[#]], type: ![[FOO_BAR_INT_TY:[0-9]+]])
52+
// COMMON: ![[FOO_BAR_INT_TY]] = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "Foo<Foo<int> >"
53+
// COMMON-SAME: templateParams: ![[PARAM:[0-9]+]]
54+
// COMMON: ![[PARAM]] = !{![[TEMPL_TYPE_PARAM:[0-9]+]]}
55+
// GDB: ![[TEMPL_TYPE_PARAM]] = !DITemplateTypeParameter(name: "T", type: ![[BAR_INT_TY]])
56+
// LLDB: ![[TEMPL_TYPE_PARAM]] = !DITemplateTypeParameter(name: "T", type: ![[BAR_INT_TY]])
57+
58+
BarInt barInt;
59+
60+
// LLDB: !DILocalVariable(name: "barInt", scope: ![[#]], file: ![[#]], line: [[#]], type: ![[BAR_INT_TY]])
61+
// GDB: !DILocalVariable(name: "barInt", scope: ![[#]], file: ![[#]], line: [[#]], type: ![[BAR_INT_TYPEDEF:[0-9]+]])
62+
// GDB: ![[BAR_INT_TYPEDEF]] = !DIDerivedType(tag: DW_TAG_typedef, name: "BarInt"
63+
64+
BarDouble barDouble;
65+
66+
// LLDB: !DILocalVariable(name: "barDouble", scope: ![[#]], file: ![[#]], line: [[#]], type: ![[BAR_DOUBLE_TY]])
67+
// GDB: !DILocalVariable(name: "barDouble", scope: ![[#]], file: ![[#]], line: [[#]], type: ![[BAR_DOUBLE_TYPEDEF:[0-9]+]])
68+
// GDB: ![[BAR_DOUBLE_TYPEDEF]] = !DIDerivedType(tag: DW_TAG_typedef, name: "BarDouble"
69+
70+
Bar<short> barShort;
71+
72+
// LLDB: !DILocalVariable(name: "barShort", scope: ![[#]], file: ![[#]], line: [[#]], type: ![[BAR_SHORT_TY_2:[0-9]+]])
73+
// GDB: !DILocalVariable(name: "barShort", scope: ![[#]], file: ![[#]], line: [[#]], type: ![[BAR_SHORT_TYPEDEF:[0-9]+]])
74+
// GDB: ![[BAR_SHORT_TYPEDEF]] = !DIDerivedType(tag: DW_TAG_typedef, name: "Bar<short>"
75+
76+
Bar<char> barChar;
77+
78+
// LLDB: ![[BAR_SHORT_TY_2]] = !DIDerivedType(tag: DW_TAG_typedef, name: "Bar<short>", file: ![[#]], line: [[#]], baseType: ![[BAR_SHORT_TY]])
79+
80+
// LLDB: !DILocalVariable(name: "barChar", scope: ![[#]], file: ![[#]], line: [[#]], type: ![[BAR_CHAR_TY_2:[0-9]+]])
81+
// GDB: !DILocalVariable(name: "barChar", scope: ![[#]], file: ![[#]], line: [[#]], type: ![[BAR_CHAR_TYPEDEF:[0-9]+]])
82+
// GDB: ![[BAR_CHAR_TYPEDEF]] = !DIDerivedType(tag: DW_TAG_typedef, name: "Bar<char>"
83+
84+
// LLDB: ![[BAR_CHAR_TY_2]] = !DIDerivedType(tag: DW_TAG_typedef, name: "Bar<char>", file: ![[#]], line: [[#]], baseType: ![[BAR_CHAR_TY]])
85+
86+
return 0;
87+
}
88+
89+
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
template<typename T> struct Foo;
2+
3+
template<typename T>
4+
using Bar = Foo<T>;
5+
6+
template<typename T> struct [[clang::preferred_name(Bar<T>)]] Foo {};
7+
8+
template <typename T> struct Baz { Foo<char> member; };
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
module PreferredNameModule {
2+
header "gmodules-preferred-name-alias.h"
3+
export *
4+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
template<typename T> struct Foo;
2+
3+
typedef Foo<char> Bar;
4+
5+
template<typename T> struct [[clang::preferred_name(Bar)]] Foo {};
6+
7+
template <typename T> struct Baz { Foo<char> member; };
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
module PreferredNameModule {
2+
header "gmodules-preferred-name-typedef.h"
3+
export *
4+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// RUN: rm -rf %t
2+
// RUN: %clang_cc1 -std=c++11 -dwarf-ext-refs -fmodule-format=obj \
3+
// RUN: -fmodule-map-file=%S/Inputs/gmodules-preferred-name-alias.modulemap \
4+
// RUN: -fmodules-cache-path=%t -debug-info-kind=standalone -debugger-tuning=lldb \
5+
// RUN: -fmodules -mllvm -debug-only=pchcontainer -x c++ \
6+
// RUN: -I %S/Inputs %s &> %t.ll
7+
// RUN: cat %t.ll | FileCheck %s
8+
9+
#include "gmodules-preferred-name-alias.h"
10+
11+
// CHECK: ![[#]] = !DIDerivedType(tag: DW_TAG_typedef, name: "Bar<char>", scope: ![[#]], file: ![[#]], line: [[#]], baseType: ![[PREF_BASE:[0-9]+]])
12+
// CHECK: ![[PREF_BASE]] = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "Foo<char>"
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// RUN: rm -rf %t
2+
// RUN: %clang_cc1 -std=c++11 -dwarf-ext-refs -fmodule-format=obj \
3+
// RUN: -fmodule-map-file=%S/Inputs/gmodules-preferred-name-typedef.modulemap \
4+
// RUN: -fmodules-cache-path=%t -debug-info-kind=standalone -debugger-tuning=lldb \
5+
// RUN: -fmodules -mllvm -debug-only=pchcontainer -x c++ \
6+
// RUN: -I %S/Inputs %s &> %t.ll
7+
// RUN: cat %t.ll | FileCheck %s
8+
9+
#include "gmodules-preferred-name-typedef.h"
10+
11+
// CHECK: ![[#]] = !DIDerivedType(tag: DW_TAG_typedef, name: "Bar", scope: ![[#]], file: ![[#]], line: [[#]], baseType: ![[PREF_BASE:[0-9]+]])
12+
// CHECK: ![[PREF_BASE]] = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "Foo<char>"

0 commit comments

Comments
 (0)