summaryrefslogtreecommitdiff
path: root/tools/llvm-pdbutil
diff options
context:
space:
mode:
authorReid Kleckner <rnk@google.com>2017-07-17 23:59:44 +0000
committerReid Kleckner <rnk@google.com>2017-07-17 23:59:44 +0000
commit5c238d611ecefce692dbcb1b22d1352f991bba97 (patch)
treeb536bcbee7c075ba3d507e7cf925d8fac1e85751 /tools/llvm-pdbutil
parente5574553c87289d826180fefe582afc414e01393 (diff)
[codeview] Fix YAML for LF_TYPESERVER2 by hoisting PDB_UniqueId
Summary: We were treating the GUIDs in TypeServer2Record as strings, and the non-ASCII bytes in the GUID would not round-trip through YAML. We already had the PDB_UniqueId type portably represent a Windows GUID, but we need to hoist that up to the DebugInfo/CodeView library so that we can use it in the TypeServer2Record as well as in PDB parsing code. Reviewers: inglorion, amccarth Subscribers: llvm-commits, hiraditya Differential Revision: https://reviews.llvm.org/D35495 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@308234 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/llvm-pdbutil')
-rw-r--r--tools/llvm-pdbutil/MinimalTypeDumper.cpp3
-rw-r--r--tools/llvm-pdbutil/PdbYaml.cpp35
-rw-r--r--tools/llvm-pdbutil/PdbYaml.h2
3 files changed, 2 insertions, 38 deletions
diff --git a/tools/llvm-pdbutil/MinimalTypeDumper.cpp b/tools/llvm-pdbutil/MinimalTypeDumper.cpp
index 9621320ea99..fc54a72be23 100644
--- a/tools/llvm-pdbutil/MinimalTypeDumper.cpp
+++ b/tools/llvm-pdbutil/MinimalTypeDumper.cpp
@@ -395,8 +395,7 @@ Error MinimalTypeDumpVisitor::visitKnownRecord(CVType &CVR,
Error MinimalTypeDumpVisitor::visitKnownRecord(CVType &CVR,
TypeServer2Record &TS) {
- P.formatLine("name = {0}, age = {1}, guid = {2}", TS.Name, TS.Age,
- fmt_guid(TS.Guid));
+ P.formatLine("name = {0}, age = {1}, guid = {2}", TS.Name, TS.Age, TS.Guid);
return Error::success();
}
diff --git a/tools/llvm-pdbutil/PdbYaml.cpp b/tools/llvm-pdbutil/PdbYaml.cpp
index 315ae2e6711..9c3beb566d2 100644
--- a/tools/llvm-pdbutil/PdbYaml.cpp
+++ b/tools/llvm-pdbutil/PdbYaml.cpp
@@ -38,41 +38,6 @@ LLVM_YAML_IS_FLOW_SEQUENCE_VECTOR(llvm::pdb::PdbRaw_FeatureSig)
namespace llvm {
namespace yaml {
-template <> struct ScalarTraits<llvm::pdb::PDB_UniqueId> {
- static void output(const llvm::pdb::PDB_UniqueId &S, void *,
- llvm::raw_ostream &OS) {
- OS << S;
- }
-
- static StringRef input(StringRef Scalar, void *Ctx,
- llvm::pdb::PDB_UniqueId &S) {
- if (Scalar.size() != 38)
- return "GUID strings are 38 characters long";
- if (Scalar[0] != '{' || Scalar[37] != '}')
- return "GUID is not enclosed in {}";
- if (Scalar[9] != '-' || Scalar[14] != '-' || Scalar[19] != '-' ||
- Scalar[24] != '-')
- return "GUID sections are not properly delineated with dashes";
-
- uint8_t *OutBuffer = S.Guid;
- for (auto Iter = Scalar.begin(); Iter != Scalar.end();) {
- if (*Iter == '-' || *Iter == '{' || *Iter == '}') {
- ++Iter;
- continue;
- }
- uint8_t Value = (llvm::hexDigitValue(*Iter) << 4);
- ++Iter;
- Value |= llvm::hexDigitValue(*Iter);
- ++Iter;
- *OutBuffer++ = Value;
- }
-
- return "";
- }
-
- static bool mustQuote(StringRef Scalar) { return needsQuotes(Scalar); }
-};
-
template <> struct ScalarEnumerationTraits<llvm::pdb::PDB_Machine> {
static void enumeration(IO &io, llvm::pdb::PDB_Machine &Value) {
io.enumCase(Value, "Invalid", PDB_Machine::Invalid);
diff --git a/tools/llvm-pdbutil/PdbYaml.h b/tools/llvm-pdbutil/PdbYaml.h
index 62ed608916f..91e054490a5 100644
--- a/tools/llvm-pdbutil/PdbYaml.h
+++ b/tools/llvm-pdbutil/PdbYaml.h
@@ -57,7 +57,7 @@ struct PdbInfoStream {
PdbRaw_ImplVer Version = PdbImplVC70;
uint32_t Signature = 0;
uint32_t Age = 1;
- PDB_UniqueId Guid;
+ codeview::GUID Guid;
std::vector<PdbRaw_FeatureSig> Features;
std::vector<NamedStreamMapping> NamedStreams;
};