summaryrefslogtreecommitdiff
path: root/tools/llvm-pdbutil/DiffPrinter.h
diff options
context:
space:
mode:
authorZachary Turner <zturner@google.com>2017-07-07 18:45:56 +0000
committerZachary Turner <zturner@google.com>2017-07-07 18:45:56 +0000
commitb85b70f834a5825ef903a7b2a3bb843860c839cd (patch)
tree2242b37b8bb96aefdfeb34b332033fe0f0e25dfd /tools/llvm-pdbutil/DiffPrinter.h
parent3324d0bf04207405bda200718d3236e370ae79cb (diff)
Fix some differences between lld and MSVC generated PDBs.
A couple of things were different about our generated PDBs. 1) We were outputting the wrong Version on the PDB Stream. The version we were setting was newer than what MSVC is setting. It's not clear what the implications are, but we change LLD to use PdbImplVC70, as MSVC does. 2) For the optional debug stream indices in the DBI Stream, we were outputting 0 to mean "the stream is not present". MSVC outputs uint16_t(-1), which is the "correct" way to specify that a stream is not present. So we fix that as well. 3) We were setting the PDB Stream signature to 0. This is supposed to be the result of calling time(nullptr). Although this leads to non-deterministic builds, a better way to solve that is by having a command line option explicitly for generating a reproducible build, and have the default behavior of lld-link match the default behavior of link. To test this, I'm making use of the new and improved `pdb diff` sub command. To make it suitable for writing tests against, I had to modify the diff subcommand slightly to print less verbose output. Previously it would always print | <column> | <value1> | <value2> | which is quite verbose, and the values are fragile. All we really want to know is "did we produce the same value as link?" So I added command line options to print a single character representing the result status (different, identical, equivalent), and another to hide the value display. Note that just inspecting the diff output used to write the test, you can see some things that are obviously wrong. That is just reflective of the fact that this is the state of affairs today, not that we're asserting that this is "correct". We can use this as a starting point to discover differences, fix them, and update the test. Differential Revision: https://reviews.llvm.org/D35086 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307422 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/llvm-pdbutil/DiffPrinter.h')
-rw-r--r--tools/llvm-pdbutil/DiffPrinter.h13
1 files changed, 8 insertions, 5 deletions
diff --git a/tools/llvm-pdbutil/DiffPrinter.h b/tools/llvm-pdbutil/DiffPrinter.h
index 8a4527c6274..1235befa1c2 100644
--- a/tools/llvm-pdbutil/DiffPrinter.h
+++ b/tools/llvm-pdbutil/DiffPrinter.h
@@ -51,7 +51,8 @@ struct EquivalentDiffProvider {
class DiffPrinter {
public:
DiffPrinter(uint32_t Indent, StringRef Header, uint32_t PropertyWidth,
- uint32_t FieldWidth, raw_ostream &Stream);
+ uint32_t FieldWidth, bool Result, bool Values,
+ raw_ostream &Stream);
~DiffPrinter();
template <typename T, typename U> struct Identical {};
@@ -138,15 +139,17 @@ public:
void printFullRow(StringRef Text);
private:
- void printSame(StringRef Property, StringRef Value);
- void printDifferent(StringRef Property, StringRef Left, StringRef Right);
+ uint32_t tableWidth() const;
void printHeaderRow();
void printSeparatorRow();
void newLine(char InitialChar = '|');
- void printField(StringRef Value, DiffResult C, AlignStyle Style,
- uint32_t Width);
+ void printValue(StringRef Value, DiffResult C, AlignStyle Style,
+ uint32_t Width, bool Force);
+ void printResult(DiffResult Result);
+ bool PrintResult;
+ bool PrintValues;
uint32_t Indent;
uint32_t PropertyWidth;
uint32_t FieldWidth;