llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
28.87k stars 11.92k forks source link

[DWARF] Template instance name not consistent with CodeView. #45867

Open CarlosAlbertoEnciso opened 4 years ago

CarlosAlbertoEnciso commented 4 years ago
Bugzilla Link 46522
Version trunk
OS All
CC @dwblaikie,@gregbedwell,@JDevlieghere,@jmorse,@walkerkd,@OCHyams,@pogo59,@rnk

Extended Description

For the given test:

//----------------------------------------------------------

template<class U,class V> struct S { };

S<int, char> SS;

//----------------------------------------------------------

The name generated for the template instance, is not consistent between clang (DWARF) and clang (CodeView), making search or compare difficult.

Clang (DWARF): 'S<int, char>' <-- Added space Clang (CodeView): 'S<int,char>'

GCC (DWARF): 'S<int, char>' MSVC (CodeView): 'S<int,char>'

Clang (DWARF) adds a space between arguments. Clang (CodeView) does not add any spaces.

CarlosAlbertoEnciso commented 4 years ago

This is the output from llvm-diva (Sony's tool under development).

llvm-diva --print=scopes,symbols,types test.o --attribute=level,format

DWARF Logical View: (Clang)

Logical View: [000] {File} 'test.o' -> elf64-x86-64 [001] {CompileUnit} 'test.cpp' [002] {Producer} 'clang version 11.0.0' [002] 2 {Struct} 'S<int, char>' [002] 5 {Variable} extern 'SS' -> 'S<int, char>'

DWARF Logical View: (GCC)

Logical View: [000] {File} 'test.o' -> elf32-littlearm [001] {CompileUnit} 'test.cpp' [002] {Producer} 'GNU C++14 9.2.1 20191025' [002] 2 {Struct} 'S<int, char>' [002] 5 {Variable} extern 'SS' -> 'S<int, char>'

CodeView Logical View: (Clang)

Logical View: [000] {File} 'test.o' -> COFF-x86-64 [001] {CompileUnit} 'test.cpp' [002] {Producer} 'clang version 11.0.0' [002] 2 {Struct} 'S<int,char>' [002] {Variable} extern 'SS' -> 'S<int,char>'

CodeView Logical View: (MSVC)

Logical View: [000] {File} 'test.o' -> COFF-i386 [001] {CompileUnit} 'test.cpp' [002] {Producer} 'Microsoft (R) Optimizing Compiler' [002] 5 {Struct} 'S<int,char>' [002] {Variable} extern 'SS' -> 'S<int,char>'