summaryrefslogtreecommitdiffstats
path: root/llvm/tools/llvm-pdbdump/FunctionDumper.cpp
diff options
context:
space:
mode:
authorZachary Turner <zturner@google.com>2015-02-26 23:49:23 +0000
committerZachary Turner <zturner@google.com>2015-02-26 23:49:23 +0000
commitd270d22f3547aa4e7bf4f3c41c9828c6b981de70 (patch)
tree08909bf70a59d5e3dfc1d84cc1d01572a319a2e6 /llvm/tools/llvm-pdbdump/FunctionDumper.cpp
parent53a93c6c399b7e514f9500283be59022e20034a7 (diff)
downloadbcm5719-llvm-d270d22f3547aa4e7bf4f3c41c9828c6b981de70.tar.gz
bcm5719-llvm-d270d22f3547aa4e7bf4f3c41c9828c6b981de70.zip
[llvm-pdbdump] Fix dumping of function pointers and basic types.
Function pointers were not correctly handled by the dumper, and they would print as "* name". They now print as "int (__cdecl *name)(int arg1, int arg2)" as they should. Also, doubles were being printed as floats. This fixes that bug as well, and adds tests for all builtin types. as well as a test for function pointers. llvm-svn: 230703
Diffstat (limited to 'llvm/tools/llvm-pdbdump/FunctionDumper.cpp')
-rw-r--r--llvm/tools/llvm-pdbdump/FunctionDumper.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/llvm/tools/llvm-pdbdump/FunctionDumper.cpp b/llvm/tools/llvm-pdbdump/FunctionDumper.cpp
index e65983034a6..1a1defed042 100644
--- a/llvm/tools/llvm-pdbdump/FunctionDumper.cpp
+++ b/llvm/tools/llvm-pdbdump/FunctionDumper.cpp
@@ -8,6 +8,7 @@
//===----------------------------------------------------------------------===//
#include "FunctionDumper.h"
+#include "BuiltinDumper.h"
#include "llvm-pdbdump.h"
#include "llvm/DebugInfo/PDB/IPDBSession.h"
@@ -16,7 +17,6 @@
#include "llvm/DebugInfo/PDB/PDBSymbolFuncDebugEnd.h"
#include "llvm/DebugInfo/PDB/PDBSymbolFuncDebugStart.h"
#include "llvm/DebugInfo/PDB/PDBSymbolTypeArray.h"
-#include "llvm/DebugInfo/PDB/PDBSymbolTypeBuiltin.h"
#include "llvm/DebugInfo/PDB/PDBSymbolTypeEnum.h"
#include "llvm/DebugInfo/PDB/PDBSymbolTypeFunctionArg.h"
#include "llvm/DebugInfo/PDB/PDBSymbolTypeFunctionSig.h"
@@ -45,7 +45,8 @@ void dumpClassParentWithScopeOperator(const T &Symbol, llvm::raw_ostream &OS,
FunctionDumper::FunctionDumper() : PDBSymDumper(true) {}
void FunctionDumper::start(const PDBSymbolTypeFunctionSig &Symbol,
- PointerType Pointer, raw_ostream &OS) {
+ const char *Name, PointerType Pointer,
+ raw_ostream &OS) {
auto ReturnType = Symbol.getReturnType();
ReturnType->dump(OS, 0, *this);
OS << " ";
@@ -70,13 +71,14 @@ void FunctionDumper::start(const PDBSymbolTypeFunctionSig &Symbol,
OS << "(";
if (ShouldDumpCallingConvention)
OS << CC << " ";
- OS << Symbol.getCallingConvention() << " ";
if (ClassParent)
OS << ClassParent->getName() << "::";
if (Pointer == PointerType::Reference)
OS << "&";
else
OS << "*";
+ if (Name)
+ OS << Name;
OS << ")";
}
@@ -185,10 +187,8 @@ void FunctionDumper::dump(const PDBSymbolTypeArray &Symbol, raw_ostream &OS,
void FunctionDumper::dump(const PDBSymbolTypeBuiltin &Symbol, raw_ostream &OS,
int Indent) {
- PDB_BuiltinType Type = Symbol.getBuiltinType();
- OS << Type;
- if (Type == PDB_BuiltinType::UInt || Type == PDB_BuiltinType::Int)
- OS << (8 * Symbol.getLength()) << "_t";
+ BuiltinDumper Dumper;
+ Dumper.start(Symbol, OS);
}
void FunctionDumper::dump(const PDBSymbolTypeEnum &Symbol, raw_ostream &OS,
@@ -226,7 +226,7 @@ void FunctionDumper::dump(const PDBSymbolTypePointer &Symbol, raw_ostream &OS,
FunctionDumper NestedDumper;
PointerType Pointer =
Symbol.isReference() ? PointerType::Reference : PointerType::Pointer;
- NestedDumper.start(*FuncSig, Pointer, OS);
+ NestedDumper.start(*FuncSig, nullptr, Pointer, OS);
} else {
if (Symbol.isConstType())
OS << "const ";
OpenPOWER on IntegriCloud