Create PDB.h and move code to remove unnecessary #includes.

llvm-svn: 281670
This commit is contained in:
Rui Ueyama 2016-09-15 22:24:51 +00:00
parent 819867191f
commit 1d99ab3925
6 changed files with 33 additions and 8 deletions

View File

@ -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"

View File

@ -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,

View File

@ -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 =

View File

@ -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 {

View File

@ -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 =

21
lld/COFF/PDB.h Normal file
View File

@ -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