summaryrefslogtreecommitdiff
path: root/tools/llvm-pdbutil/DiffPrinter.h
diff options
context:
space:
mode:
authorZachary Turner <zturner@google.com>2017-07-10 16:52:15 +0000
committerZachary Turner <zturner@google.com>2017-07-10 16:52:15 +0000
commit80e0f20bdec8e1775c1c5d350d9825bde47a2100 (patch)
treeff8570f1569651907898832a831dce60836ef361 /tools/llvm-pdbutil/DiffPrinter.h
parent65eefa7f01381abcf94b13fd5df5dc0e657b7c51 (diff)
Fix pdb-diff test.
A test was checked in on Friday that worked by checking in an object file and PDB generated locally by MSVC, and then having the test run lld-link on the object file and diffing LLD's PDB against the checked in PDB. This failed because part of the diffing algorithm involves determining if two modules are the same, and if so drilling into the module and diffing individual fields of the module. The only thing we can use to make this determination though is the "name" of the module, which is a path to where the module (obj file) was read from on the machine where it was linked. This fails for obvious reasons when comparing a PDB generated on one machine to a PDB on another machine. The fix employed here is to add two command line options to the diff subcommand, which allow the user to specify a "binary root path". The bin root path, if specified, is stripped from the beginning of any embedded PDB paths. The test is updated to specify the user's local test output directory for the left PDB, and is hardcoded to the location where the original PDB was created for the right PDB. This way all the equivalence comparisons should succeed. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307555 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/llvm-pdbutil/DiffPrinter.h')
-rw-r--r--tools/llvm-pdbutil/DiffPrinter.h8
1 files changed, 4 insertions, 4 deletions
diff --git a/tools/llvm-pdbutil/DiffPrinter.h b/tools/llvm-pdbutil/DiffPrinter.h
index eeda92b072c..475747d8dc1 100644
--- a/tools/llvm-pdbutil/DiffPrinter.h
+++ b/tools/llvm-pdbutil/DiffPrinter.h
@@ -43,7 +43,7 @@ struct IdenticalDiffProvider {
return (Left == Right) ? DiffResult::IDENTICAL : DiffResult::DIFFERENT;
}
- template <typename T> std::string format(const T &Item) {
+ template <typename T> std::string format(const T &Item, bool Right) {
return formatv("{0}", Item).str();
}
};
@@ -54,7 +54,7 @@ struct EquivalentDiffProvider {
return (Left == Right) ? DiffResult::IDENTICAL : DiffResult::EQUIVALENT;
}
- template <typename T> std::string format(const T &Item) {
+ template <typename T> std::string format(const T &Item, bool Right) {
return formatv("{0}", Item).str();
}
};
@@ -71,8 +71,8 @@ public:
template <typename Provider = IdenticalDiffProvider, typename T, typename U>
void print(StringRef Property, const T &Left, const U &Right,
Provider P = Provider()) {
- std::string L = P.format(Left);
- std::string R = P.format(Right);
+ std::string L = P.format(Left, false);
+ std::string R = P.format(Right, true);
DiffResult Result = P.compare(Left, Right);
printExplicit(Property, Result, L, R);