diff options
author | Rui Ueyama <ruiu@google.com> | 2016-09-15 22:24:51 +0000 |
---|---|---|
committer | Rui Ueyama <ruiu@google.com> | 2016-09-15 22:24:51 +0000 |
commit | 1d99ab3925273c21a060c40f8f0520f106311bc2 (patch) | |
tree | 21d0a41adc9894c64d4c56e018611f10887498c8 | |
parent | 819867191f95b7e83cbd42cd1c6a6a5d36c71bd4 (diff) | |
download | bcm5719-llvm-1d99ab3925273c21a060c40f8f0520f106311bc2.tar.gz bcm5719-llvm-1d99ab3925273c21a060c40f8f0520f106311bc2.zip |
Create PDB.h and move code to remove unnecessary #includes.
llvm-svn: 281670
-rw-r--r-- | lld/COFF/Driver.cpp | 3 | ||||
-rw-r--r-- | lld/COFF/Driver.h | 2 | ||||
-rw-r--r-- | lld/COFF/InputFiles.cpp | 5 | ||||
-rw-r--r-- | lld/COFF/InputFiles.h | 4 | ||||
-rw-r--r-- | lld/COFF/PDB.cpp | 6 | ||||
-rw-r--r-- | lld/COFF/PDB.h | 21 |
6 files changed, 33 insertions, 8 deletions
diff --git a/lld/COFF/Driver.cpp b/lld/COFF/Driver.cpp index d4081488871..4c7c4d8747f 100644 --- a/lld/COFF/Driver.cpp +++ b/lld/COFF/Driver.cpp @@ -7,10 +7,11 @@ // //===----------------------------------------------------------------------===// -#include "Config.h" #include "Driver.h" +#include "Config.h" #include "Error.h" #include "InputFiles.h" +#include "PDB.h" #include "SymbolTable.h" #include "Symbols.h" #include "Writer.h" diff --git a/lld/COFF/Driver.h b/lld/COFF/Driver.h index 0afde184f08..db4201d9c84 100644 --- a/lld/COFF/Driver.h +++ b/lld/COFF/Driver.h @@ -164,8 +164,6 @@ void checkFailIfMismatch(StringRef Arg); std::unique_ptr<MemoryBuffer> convertResToCOFF(const std::vector<MemoryBufferRef> &MBs); -void createPDB(StringRef Path); - // Create enum with OPT_xxx values for each option in Options.td enum { OPT_INVALID = 0, diff --git a/lld/COFF/InputFiles.cpp b/lld/COFF/InputFiles.cpp index 92d14c15713..52dec2eec71 100644 --- a/lld/COFF/InputFiles.cpp +++ b/lld/COFF/InputFiles.cpp @@ -32,6 +32,7 @@ #include <system_error> #include <utility> +using namespace llvm; using namespace llvm::COFF; using namespace llvm::object; using namespace llvm::support::endian; @@ -62,6 +63,8 @@ std::string InputFile::getShortName() { return StringRef(Res).lower(); } +ArchiveFile::ArchiveFile(MemoryBufferRef M) : InputFile(ArchiveKind, M) {} + void ArchiveFile::parse() { // Parse a MemoryBufferRef as an archive file. File = check(Archive::create(MB), getShortName()); @@ -106,6 +109,8 @@ MemoryBufferRef ArchiveFile::getMember(const Archive::Symbol *Sym) { return MB; } +MutableArrayRef<Lazy> ArchiveFile::getLazySymbols() { return LazySymbols; } + void ObjectFile::parse() { // Parse a memory buffer as a COFF file. std::unique_ptr<Binary> Bin = diff --git a/lld/COFF/InputFiles.h b/lld/COFF/InputFiles.h index 0ec01b5075f..801bd051e8b 100644 --- a/lld/COFF/InputFiles.h +++ b/lld/COFF/InputFiles.h @@ -91,7 +91,7 @@ private: // .lib or .a file. class ArchiveFile : public InputFile { public: - explicit ArchiveFile(MemoryBufferRef M) : InputFile(ArchiveKind, M) {} + explicit ArchiveFile(MemoryBufferRef M); static bool classof(const InputFile *F) { return F->kind() == ArchiveKind; } void parse() override; @@ -100,7 +100,7 @@ public: // (So that we don't instantiate same members more than once.) MemoryBufferRef getMember(const Archive::Symbol *Sym); - llvm::MutableArrayRef<Lazy> getLazySymbols() { return LazySymbols; } + llvm::MutableArrayRef<Lazy> getLazySymbols(); // All symbols returned by ArchiveFiles are of Lazy type. std::vector<SymbolBody *> &getSymbols() override { diff --git a/lld/COFF/PDB.cpp b/lld/COFF/PDB.cpp index d4792ae5312..9445dcb6938 100644 --- a/lld/COFF/PDB.cpp +++ b/lld/COFF/PDB.cpp @@ -7,21 +7,21 @@ // //===----------------------------------------------------------------------===// -#include "Driver.h" +#include "PDB.h" #include "Error.h" -#include "Symbols.h" #include "llvm/DebugInfo/MSF/MSFCommon.h" #include "llvm/Support/Endian.h" #include "llvm/Support/FileOutputBuffer.h" #include <memory> +using namespace lld; using namespace llvm; using namespace llvm::support; using namespace llvm::support::endian; const int BlockSize = 4096; -void lld::coff::createPDB(StringRef Path) { +void coff::createPDB(StringRef Path) { // Create a file. size_t FileSize = BlockSize * 3; ErrorOr<std::unique_ptr<FileOutputBuffer>> BufferOrErr = diff --git a/lld/COFF/PDB.h b/lld/COFF/PDB.h new file mode 100644 index 00000000000..97f69355e6d --- /dev/null +++ b/lld/COFF/PDB.h @@ -0,0 +1,21 @@ +//===- PDB.h ----------------------------------------------------*- C++ -*-===// +// +// The LLVM Linker +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#ifndef LLD_COFF_PDB_H +#define LLD_COFF_PDB_H + +#include "llvm/ADT/StringRef.h" + +namespace lld { +namespace coff { +void createPDB(llvm::StringRef Path); +} +} + +#endif |