diff options
author | Zachary Turner <zturner@google.com> | 2016-04-11 20:39:17 +0000 |
---|---|---|
committer | Zachary Turner <zturner@google.com> | 2016-04-11 20:39:17 +0000 |
commit | 4d5535a70a73c70b376ff2ab2b6fc53f4bafc762 (patch) | |
tree | fe9ea9a1c1881f6c7bd6c22f230000107b9db0b2 | |
parent | 0ffdf65eaa05209655601a1059232da6605162a3 (diff) | |
download | bcm5719-llvm-4d5535a70a73c70b376ff2ab2b6fc53f4bafc762.tar.gz bcm5719-llvm-4d5535a70a73c70b376ff2ab2b6fc53f4bafc762.zip |
Fix some display bugs in llvm-pdbdump.
We were incorrectly reporting all non-64 bit integers as int64s.
This is most evident when trying to print the "short" type, but
in theory could happen with chars too (although usually chars use
a different builtin type).
Additionally, we were using the wrong check when deciding whether
to print an enum definition as a global enum. We were checking
whether or not the enum was "nested", and if so saving it until
we print the class definition that it was nested in. But this is
not correct in rare situations where the enum is nested, but the
class that it's nested in does not have type information in the PDB.
So instead we check if there is a class definition for the parent
in the PDB. If so we save it for later, otherwise we print it.
llvm-svn: 265993
-rw-r--r-- | llvm/test/DebugInfo/PDB/DIA/pdbdump-symbol-format.test | 6 | ||||
-rw-r--r-- | llvm/tools/llvm-pdbdump/BuiltinDumper.cpp | 26 | ||||
-rw-r--r-- | llvm/tools/llvm-pdbdump/TypeDumper.cpp | 2 |
3 files changed, 26 insertions, 8 deletions
diff --git a/llvm/test/DebugInfo/PDB/DIA/pdbdump-symbol-format.test b/llvm/test/DebugInfo/PDB/DIA/pdbdump-symbol-format.test index 23935108c36..3761f789f59 100644 --- a/llvm/test/DebugInfo/PDB/DIA/pdbdump-symbol-format.test +++ b/llvm/test/DebugInfo/PDB/DIA/pdbdump-symbol-format.test @@ -9,7 +9,7 @@ ; The format is func [0x<rva_start>+<prologue_length> - 0x<rva_end>-<epilogue_length>] ; SYM_FORMAT: ---SYMBOLS--- ; SYM_FORMAT: symbolformat-fpo.obj -; SYM_FORMAT-DAG: func [{{.*}}] (FPO) unsigned __cdecl fpo_func(unsigned n) +; SYM_FORMAT-DAG: func [{{.*}}] (FPO) unsigned int __cdecl fpo_func(unsigned int n) ; SYM_FORMAT: symbolformat.obj ; SYM_FORMAT-DAG: func [{{.*}}] (EBP) int __cdecl _purecall() ; SYM_FORMAT-DAG: func [{{.*}}] (EBP) int __cdecl main(int argc, char** argv) @@ -44,7 +44,7 @@ ; TYPES_2: data +0x09 char m_char ; TYPES_2: data +0x0a wchar_t m_wchar_t ; TYPES_2: data +0x0c int m_int -; TYPES_2: data +0x10 unsigned m_unsigned +; TYPES_2: data +0x10 unsigned int m_unsigned ; TYPES_2: data +0x14 long m_long ; TYPES_2: data +0x18 unsigned long m_unsigned_long ; TYPES_2: data +0x20 __int64 m_int64 @@ -55,6 +55,6 @@ ; TYPES_2: } ; GLOBALS: ---GLOBALS--- -; GLOBALS-DAG: func [{{.*}}] (FPO) unsigned __cdecl fpo_func(unsigned n) +; GLOBALS-DAG: func [{{.*}}] (FPO) unsigned int __cdecl fpo_func(unsigned int n) ; GLOBALS-DAG: data [{{.*}}] static void* g_global_pointer ; GLOBALS-DAG: data [{{.*}}] static int g_global_int diff --git a/llvm/tools/llvm-pdbdump/BuiltinDumper.cpp b/llvm/tools/llvm-pdbdump/BuiltinDumper.cpp index 43270540f45..413a3fcba71 100644 --- a/llvm/tools/llvm-pdbdump/BuiltinDumper.cpp +++ b/llvm/tools/llvm-pdbdump/BuiltinDumper.cpp @@ -30,13 +30,31 @@ StringRef BuiltinDumper::getTypeName(const PDBSymbolTypeBuiltin &Symbol) { return "float"; return "double"; case PDB_BuiltinType::UInt: - if (Symbol.getLength() == 8) + switch (Symbol.getLength()) { + case 8: return "unsigned __int64"; - return "unsigned"; + case 4: + return "unsigned int"; + case 2: + return "unsigned short"; + case 1: + return "unsigned char"; + default: + return "unsigned"; + } case PDB_BuiltinType::Int: - if (Symbol.getLength() == 4) + switch (Symbol.getLength()) { + case 8: + return "__int64"; + case 4: + return "int"; + case 2: + return "short"; + case 1: + return "char"; + default: return "int"; - return "__int64"; + } case PDB_BuiltinType::Char: return "char"; case PDB_BuiltinType::WCharT: diff --git a/llvm/tools/llvm-pdbdump/TypeDumper.cpp b/llvm/tools/llvm-pdbdump/TypeDumper.cpp index 88c0bd65697..39bdde93c6a 100644 --- a/llvm/tools/llvm-pdbdump/TypeDumper.cpp +++ b/llvm/tools/llvm-pdbdump/TypeDumper.cpp @@ -62,7 +62,7 @@ void TypeDumper::dump(const PDBSymbolTypeEnum &Symbol) { if (Printer.IsTypeExcluded(Symbol.getName())) return; // Dump member enums when dumping their class definition. - if (Symbol.isNested()) + if (nullptr != Symbol.getClassParent()) return; Printer.NewLine(); |