[llvm] r303390 - [CodeView] Raise the source to ID map out of the TypeStreamMerger.
Zachary Turner via llvm-commits
llvm-commits at lists.llvm.org
Thu May 18 16:04:08 PDT 2017
Author: zturner
Date: Thu May 18 18:04:08 2017
New Revision: 303390
URL: http://llvm.org/viewvc/llvm-project?rev=303390&view=rev
Log:
[CodeView] Raise the source to ID map out of the TypeStreamMerger.
This map will be needed to rewrite symbol streams after re-writing
the corresponding type streams.
Modified:
llvm/trunk/include/llvm/DebugInfo/CodeView/TypeStreamMerger.h
llvm/trunk/lib/DebugInfo/CodeView/TypeStreamMerger.cpp
llvm/trunk/tools/llvm-pdbdump/llvm-pdbdump.cpp
llvm/trunk/tools/llvm-readobj/COFFDumper.cpp
Modified: llvm/trunk/include/llvm/DebugInfo/CodeView/TypeStreamMerger.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/CodeView/TypeStreamMerger.h?rev=303390&r1=303389&r2=303390&view=diff
==============================================================================
--- llvm/trunk/include/llvm/DebugInfo/CodeView/TypeStreamMerger.h (original)
+++ llvm/trunk/include/llvm/DebugInfo/CodeView/TypeStreamMerger.h Thu May 18 18:04:08 2017
@@ -12,17 +12,20 @@
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/SmallVector.h"
-#include "llvm/DebugInfo/CodeView/TypeTableBuilder.h"
+#include "llvm/DebugInfo/CodeView/TypeRecord.h"
#include "llvm/Support/Error.h"
namespace llvm {
namespace codeview {
+class TypeIndex;
class TypeServerHandler;
+class TypeTableBuilder;
/// Merges one type stream into another. Returns true on success.
Error mergeTypeStreams(TypeTableBuilder &DestIdStream,
TypeTableBuilder &DestTypeStream,
+ SmallVectorImpl<TypeIndex> &SourceToDest,
TypeServerHandler *Handler, const CVTypeArray &Types);
} // end namespace codeview
Modified: llvm/trunk/lib/DebugInfo/CodeView/TypeStreamMerger.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/CodeView/TypeStreamMerger.cpp?rev=303390&r1=303389&r2=303390&view=diff
==============================================================================
--- llvm/trunk/lib/DebugInfo/CodeView/TypeStreamMerger.cpp (original)
+++ llvm/trunk/lib/DebugInfo/CodeView/TypeStreamMerger.cpp Thu May 18 18:04:08 2017
@@ -58,9 +58,12 @@ namespace {
class TypeStreamMerger : public TypeVisitorCallbacks {
public:
TypeStreamMerger(TypeTableBuilder &DestIdStream,
- TypeTableBuilder &DestTypeStream, TypeServerHandler *Handler)
+ TypeTableBuilder &DestTypeStream,
+ SmallVectorImpl<TypeIndex> &SourceToDest,
+ TypeServerHandler *Handler)
: DestIdStream(DestIdStream), DestTypeStream(DestTypeStream),
- FieldListBuilder(DestTypeStream), Handler(Handler) {}
+ FieldListBuilder(DestTypeStream), Handler(Handler),
+ IndexMap(SourceToDest) {}
static const TypeIndex Untranslated;
@@ -141,7 +144,7 @@ private:
/// Map from source type index to destination type index. Indexed by source
/// type index minus 0x1000.
- SmallVector<TypeIndex, 0> IndexMap;
+ SmallVectorImpl<TypeIndex> &IndexMap;
};
} // end anonymous namespace
@@ -475,8 +478,9 @@ Error TypeStreamMerger::mergeStream(cons
Error llvm::codeview::mergeTypeStreams(TypeTableBuilder &DestIdStream,
TypeTableBuilder &DestTypeStream,
+ SmallVectorImpl<TypeIndex> &SourceToDest,
TypeServerHandler *Handler,
const CVTypeArray &Types) {
- return TypeStreamMerger(DestIdStream, DestTypeStream, Handler)
+ return TypeStreamMerger(DestIdStream, DestTypeStream, SourceToDest, Handler)
.mergeStream(Types);
}
Modified: llvm/trunk/tools/llvm-pdbdump/llvm-pdbdump.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-pdbdump/llvm-pdbdump.cpp?rev=303390&r1=303389&r2=303390&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-pdbdump/llvm-pdbdump.cpp (original)
+++ llvm/trunk/tools/llvm-pdbdump/llvm-pdbdump.cpp Thu May 18 18:04:08 2017
@@ -36,6 +36,7 @@
#include "llvm/DebugInfo/CodeView/ModuleDebugInlineeLinesFragment.h"
#include "llvm/DebugInfo/CodeView/ModuleDebugLineFragment.h"
#include "llvm/DebugInfo/CodeView/TypeStreamMerger.h"
+#include "llvm/DebugInfo/CodeView/TypeTableBuilder.h"
#include "llvm/DebugInfo/MSF/MSFBuilder.h"
#include "llvm/DebugInfo/PDB/GenericError.h"
#include "llvm/DebugInfo/PDB/IPDBEnumChildren.h"
@@ -851,15 +852,18 @@ static void mergePdbs() {
for (const auto &Path : opts::merge::InputFilenames) {
std::unique_ptr<IPDBSession> Session;
auto &File = loadPDB(Path, Session);
+ SmallVector<TypeIndex, 128> SourceToDest;
if (File.hasPDBTpiStream()) {
+ SourceToDest.clear();
auto &Tpi = ExitOnErr(File.getPDBTpiStream());
- ExitOnErr(codeview::mergeTypeStreams(MergedIpi, MergedTpi, nullptr,
- Tpi.typeArray()));
+ ExitOnErr(codeview::mergeTypeStreams(MergedIpi, MergedTpi, SourceToDest,
+ nullptr, Tpi.typeArray()));
}
if (File.hasPDBIpiStream()) {
+ SourceToDest.clear();
auto &Ipi = ExitOnErr(File.getPDBIpiStream());
- ExitOnErr(codeview::mergeTypeStreams(MergedIpi, MergedTpi, nullptr,
- Ipi.typeArray()));
+ ExitOnErr(codeview::mergeTypeStreams(MergedIpi, MergedTpi, SourceToDest,
+ nullptr, Ipi.typeArray()));
}
}
Modified: llvm/trunk/tools/llvm-readobj/COFFDumper.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-readobj/COFFDumper.cpp?rev=303390&r1=303389&r2=303390&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-readobj/COFFDumper.cpp (original)
+++ llvm/trunk/tools/llvm-readobj/COFFDumper.cpp Thu May 18 18:04:08 2017
@@ -1072,8 +1072,9 @@ void COFFDumper::mergeCodeViewTypes(Type
W.flush();
error(object_error::parse_failed);
}
-
- if (auto EC = mergeTypeStreams(CVIDs, CVTypes, nullptr, Types))
+ SmallVector<TypeIndex, 128> SourceToDest;
+ if (auto EC =
+ mergeTypeStreams(CVIDs, CVTypes, SourceToDest, nullptr, Types))
return error(std::move(EC));
}
}
More information about the llvm-commits
mailing list