-
Notifications
You must be signed in to change notification settings - Fork 15k
Open
Labels
Description
clang-cl and cl produce different names for simple types used in template arguments. They produce the same simple type names for the member. I'm not sure if this is a Clang or LLVM issue. I'm guessing this is an issue with LLVM, because it's the one turning long long into __int64 (DebugInfo/CodeView/TypeIndex.cpp).
Reproduction
// main.cpp
template <typename T> class Foo {
T bar;
};
int main() { Foo<long long> f; }Compile with clang-cl and cl:
> clang-cl main.cpp /Zi -o clang-output
> cl main.cpp /Zi -o msvc-outputCheck names in PDB:
> llvm-pdbutil pretty clang-output.pdb -classes --include-types=Foo
Summary for F:\Dev\cpp-test\clang-output.pdb
Size: 7008256 bytes
Guid: {F75AB9BC-7C91-462D-866C-06174965CC9F}
Age: 1
Attributes: HasPrivateSymbols
---TYPES---
Classes: (Showing 911 items)
class Foo<long long> [sizeof = 8] {
data +0x00 [sizeof=8] __int64 bar
}
> llvm-pdbutil pretty msvc-output.pdb -classes --include-types=Foo
Summary for F:\Dev\cpp-test\msvc-output.pdb
Size: 7008256 bytes
Guid: {AA4A4274-D8EE-49E0-9121-A2A5FF45EE17}
Age: 1
Attributes: HasPrivateSymbols
---TYPES---
Classes: (Showing 911 items)
class Foo<__int64> [sizeof = 8] {
data +0x00 [sizeof=8] __int64 bar
}Notice the different names for the type of the class - Foo<long long> (clang-cl) and Foo<__int64> (cl).
The relevant part of the generated IR:
!18 = distinct !DICompositeType(tag: DW_TAG_class_type, name: "Foo<long long>", file: !12, line: 1, size: 64, flags: DIFlagTypePassByValue, elements: !19, templateParams: !22, identifier: ".?AV?$Foo@_J@@")
!19 = !{!20}
!20 = !DIDerivedType(tag: DW_TAG_member, name: "bar", scope: !18, file: !12, line: 2, baseType: !21, size: 64)
!21 = !DIBasicType(name: "long long", size: 64, encoding: DW_ATE_signed)
!22 = !{!23}
!23 = !DITemplateTypeParameter(name: "T", type: !21)