[lld] de3fb1e - [COFF] Avoid CodeView include in header
Reid Kleckner via llvm-commits
llvm-commits at lists.llvm.org
Thu Nov 14 14:30:14 PST 2019
Author: Reid Kleckner
Date: 2019-11-14T14:27:48-08:00
New Revision: de3fb1ec055d2edf65f4f476eb2e47a1cbe3565a
URL: https://github.com/llvm/llvm-project/commit/de3fb1ec055d2edf65f4f476eb2e47a1cbe3565a
DIFF: https://github.com/llvm/llvm-project/commit/de3fb1ec055d2edf65f4f476eb2e47a1cbe3565a.diff
LOG: [COFF] Avoid CodeView include in header
Most LLD/COFF files don't care about CodeView. Avoid using CodeView
types in InputFiles.h.
Added:
Modified:
lld/COFF/InputFiles.cpp
lld/COFF/InputFiles.h
lld/COFF/PDB.cpp
Removed:
################################################################################
diff --git a/lld/COFF/InputFiles.cpp b/lld/COFF/InputFiles.cpp
index 2d8292fc141e..ff59f4cee3ec 100644
--- a/lld/COFF/InputFiles.cpp
+++ b/lld/COFF/InputFiles.cpp
@@ -767,7 +767,8 @@ void ObjFile::initializeDependencies() {
if (firstType == types.end())
return;
- debugTypes.emplace(types);
+ // Remember the .debug$T or .debug$P section.
+ debugTypes = data;
if (isPCH) {
debugTypesObj = makePrecompSource(this);
diff --git a/lld/COFF/InputFiles.h b/lld/COFF/InputFiles.h
index 1df383ec7c16..805d9121d8bc 100644
--- a/lld/COFF/InputFiles.h
+++ b/lld/COFF/InputFiles.h
@@ -15,7 +15,6 @@
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/DenseSet.h"
#include "llvm/BinaryFormat/Magic.h"
-#include "llvm/DebugInfo/CodeView/TypeRecord.h"
#include "llvm/Object/Archive.h"
#include "llvm/Object/COFF.h"
#include "llvm/Support/StringSaver.h"
@@ -204,8 +203,8 @@ class ObjFile : public InputFile {
// If the OBJ has a .debug$T stream, this tells how it will be handled.
TpiSource *debugTypesObj = nullptr;
- // The .debug$T stream if there's one.
- llvm::Optional<llvm::codeview::CVTypeArray> debugTypes;
+ // The .debug$P or .debug$T section data if present. Empty otherwise.
+ ArrayRef<uint8_t> debugTypes;
llvm::Optional<std::pair<StringRef, uint32_t>>
getVariableLocation(StringRef var);
diff --git a/lld/COFF/PDB.cpp b/lld/COFF/PDB.cpp
index ea99583b1d80..6ba4d3940948 100644
--- a/lld/COFF/PDB.cpp
+++ b/lld/COFF/PDB.cpp
@@ -369,8 +369,10 @@ PDBLinker::mergeDebugT(ObjFile *file, CVIndexMap *objectIndexMap) {
// don't merge any type information.
return maybeMergeTypeServerPDB(file);
}
-
- CVTypeArray &types = *file->debugTypes;
+
+ CVTypeArray types;
+ BinaryStreamReader reader(file->debugTypes, support::little);
+ cantFail(reader.readArray(types, reader.getLength()));
if (file->debugTypesObj->kind == TpiSource::UsingPCH) {
// This object was compiled with /Yu, so process the corresponding
More information about the llvm-commits
mailing list