summaryrefslogtreecommitdiffstats
path: root/llvm/lib/ObjectYAML/CodeViewYAMLSymbols.cpp
diff options
context:
space:
mode:
authorZachary Turner <zturner@google.com>2017-06-05 21:40:33 +0000
committerZachary Turner <zturner@google.com>2017-06-05 21:40:33 +0000
commit349c18f8377aa46af024e0ba7d312304ad2ac28a (patch)
tree1bbd719c419cb69fa87cd037de57ab206216741e /llvm/lib/ObjectYAML/CodeViewYAMLSymbols.cpp
parent5b0bf2ff0d80998804871ab151ec2f00ff2dee8b (diff)
downloadbcm5719-llvm-349c18f8377aa46af024e0ba7d312304ad2ac28a.tar.gz
bcm5719-llvm-349c18f8377aa46af024e0ba7d312304ad2ac28a.zip
[CodeView] Handle Cross Module Imports and Exports.
While it's not entirely clear why a compiler or linker might put this information into an object or PDB file, one has been spotted in the wild which was causing llvm-pdbdump to crash. This patch adds support for reading-writing these sections. Since I don't know how to get one of the native tools to generate this kind of debug info, the only test here is one in which we feed YAML into the tool to produce a PDB and then spit out YAML from the resulting PDB and make sure that it matches. llvm-svn: 304738
Diffstat (limited to 'llvm/lib/ObjectYAML/CodeViewYAMLSymbols.cpp')
-rw-r--r--llvm/lib/ObjectYAML/CodeViewYAMLSymbols.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/llvm/lib/ObjectYAML/CodeViewYAMLSymbols.cpp b/llvm/lib/ObjectYAML/CodeViewYAMLSymbols.cpp
index bd97af3a932..fa3f1e0b60a 100644
--- a/llvm/lib/ObjectYAML/CodeViewYAMLSymbols.cpp
+++ b/llvm/lib/ObjectYAML/CodeViewYAMLSymbols.cpp
@@ -47,6 +47,18 @@ LLVM_YAML_DECLARE_ENUM_TRAITS(RegisterId)
LLVM_YAML_DECLARE_ENUM_TRAITS(TrampolineType)
LLVM_YAML_DECLARE_ENUM_TRAITS(ThunkOrdinal)
+LLVM_YAML_STRONG_TYPEDEF(llvm::StringRef, TypeName)
+
+LLVM_YAML_DECLARE_SCALAR_TRAITS(TypeName, true)
+
+StringRef ScalarTraits<TypeName>::input(StringRef S, void *V, TypeName &T) {
+ return ScalarTraits<StringRef>::input(S, V, T.value);
+}
+void ScalarTraits<TypeName>::output(const TypeName &T, void *V,
+ llvm::raw_ostream &R) {
+ ScalarTraits<StringRef>::output(T.value, V, R);
+}
+
void ScalarEnumerationTraits<SymbolKind>::enumeration(IO &io,
SymbolKind &Value) {
auto SymbolNames = getSymbolTypeNames();
@@ -264,6 +276,7 @@ template <> void SymbolRecordImpl<InlineSiteSym>::map(IO &IO) {
template <> void SymbolRecordImpl<LocalSym>::map(IO &IO) {
IO.mapRequired("Type", Symbol.Type);
IO.mapRequired("Flags", Symbol.Flags);
+
IO.mapRequired("VarName", Symbol.Name);
}
OpenPOWER on IntegriCloud