[PATCH] D52799: [llvm-pdbutil] Pretty print PDBSymbolUsingNamespace symbols
Aaron Smith via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Oct 2 13:42:03 PDT 2018
asmith created this revision.
asmith added reviewers: rnk, zturner, llvm-commits.
Repository:
rL LLVM
https://reviews.llvm.org/D52799
Files:
test/tools/llvm-pdbdump/Inputs/UsingNamespaceTest.cpp
test/tools/llvm-pdbdump/Inputs/UsingNamespaceTest.pdb
test/tools/llvm-pdbdump/usingnamespace.test
tools/llvm-pdbutil/PrettyCompilandDumper.cpp
tools/llvm-pdbutil/PrettyCompilandDumper.h
Index: tools/llvm-pdbutil/PrettyCompilandDumper.h
===================================================================
--- tools/llvm-pdbutil/PrettyCompilandDumper.h
+++ tools/llvm-pdbutil/PrettyCompilandDumper.h
@@ -34,6 +34,7 @@
void dump(const PDBSymbolThunk &Symbol) override;
void dump(const PDBSymbolTypeTypedef &Symbol) override;
void dump(const PDBSymbolUnknown &Symbol) override;
+ void dump(const PDBSymbolUsingNamespace &Symbol) override;
private:
LinePrinter &Printer;
Index: tools/llvm-pdbutil/PrettyCompilandDumper.cpp
===================================================================
--- tools/llvm-pdbutil/PrettyCompilandDumper.cpp
+++ tools/llvm-pdbutil/PrettyCompilandDumper.cpp
@@ -28,6 +28,7 @@
#include "llvm/DebugInfo/PDB/PDBSymbolThunk.h"
#include "llvm/DebugInfo/PDB/PDBSymbolTypeFunctionSig.h"
#include "llvm/DebugInfo/PDB/PDBSymbolUnknown.h"
+#include "llvm/DebugInfo/PDB/PDBSymbolUsingNamespace.h"
#include "llvm/Support/Format.h"
#include "llvm/Support/Path.h"
#include "llvm/Support/raw_ostream.h"
@@ -216,3 +217,14 @@
Printer.NewLine();
Printer << "unknown (" << Symbol.getSymTag() << ")";
}
+
+void CompilandDumper::dump(const PDBSymbolUsingNamespace &Symbol) {
+ if (Printer.IsSymbolExcluded(Symbol.getName()))
+ return;
+
+ Printer.NewLine();
+ Printer << "usingnamespace ";
+ std::string Name = Symbol.getName();
+ if (!Name.empty())
+ WithColor(Printer, PDB_ColorItem::Identifier).get() << Name;
+}
Index: test/tools/llvm-pdbdump/usingnamespace.test
===================================================================
--- /dev/null
+++ test/tools/llvm-pdbdump/usingnamespace.test
@@ -0,0 +1,6 @@
+; RUN: llvm-pdbutil pretty -module-syms %p/Inputs/UsingNamespaceTest.pdb > %t
+; RUN: FileCheck -input-file=%t %s
+
+; CHECK: ---SYMBOLS---
+; CHECK-NEXT: {{.*}}UsingNamespaceTest.obj
+; CHECK-DAG: usingnamespace NS
Index: test/tools/llvm-pdbdump/Inputs/UsingNamespaceTest.cpp
===================================================================
--- /dev/null
+++ test/tools/llvm-pdbdump/Inputs/UsingNamespaceTest.cpp
@@ -0,0 +1,11 @@
+// Compile with "cl /c /Zi /GR- UsingNamespaceTest.cpp"
+// Link with "link UsingNamespaceTest.obj /debug /nodefaultlib /entry:main"
+
+namespace NS {
+ int foo() { return 1; }
+}
+
+using namespace NS;
+int main(int argc, char **argv) {
+ return foo();
+}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D52799.168015.patch
Type: text/x-patch
Size: 2367 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181002/885468c3/attachment.bin>
More information about the llvm-commits
mailing list