Please use GitHub pull requests for new patches. Avoid migrating existing patches. Phabricator shutdown timeline
Changeset View
Changeset View
Standalone View
Standalone View
lld/wasm/InputFiles.h
Show First 20 Lines • Show All 41 Lines • ▼ Show 20 Lines | |||||
class InputFile { | class InputFile { | ||||
public: | public: | ||||
enum Kind { | enum Kind { | ||||
ObjectKind, | ObjectKind, | ||||
SharedKind, | SharedKind, | ||||
ArchiveKind, | ArchiveKind, | ||||
BitcodeKind, | BitcodeKind, | ||||
StubKind, | |||||
}; | }; | ||||
virtual ~InputFile() {} | virtual ~InputFile() {} | ||||
// Returns the filename. | // Returns the filename. | ||||
StringRef getName() const { return mb.getBufferIdentifier(); } | StringRef getName() const { return mb.getBufferIdentifier(); } | ||||
Kind kind() const { return fileKind; } | Kind kind() const { return fileKind; } | ||||
▲ Show 20 Lines • Show All 120 Lines • ▼ Show 20 Lines | public: | ||||
void parse(); | void parse(); | ||||
std::unique_ptr<llvm::lto::InputFile> obj; | std::unique_ptr<llvm::lto::InputFile> obj; | ||||
// Set to true once LTO is complete in order prevent further bitcode objects | // Set to true once LTO is complete in order prevent further bitcode objects | ||||
// being added. | // being added. | ||||
static bool doneLTO; | static bool doneLTO; | ||||
}; | }; | ||||
// Stub libray (See docs/WebAssembly.rst) | |||||
class StubFile : public InputFile { | |||||
public: | |||||
explicit StubFile(MemoryBufferRef m) : InputFile(StubKind, m) {} | |||||
static bool classof(const InputFile *f) { return f->kind() == StubKind; } | |||||
void parse(); | |||||
llvm::DenseMap<StringRef, std::vector<StringRef>> symbolDependencies; | |||||
}; | |||||
inline bool isBitcode(MemoryBufferRef mb) { | inline bool isBitcode(MemoryBufferRef mb) { | ||||
return identify_magic(mb.getBuffer()) == llvm::file_magic::bitcode; | return identify_magic(mb.getBuffer()) == llvm::file_magic::bitcode; | ||||
} | } | ||||
// Will report a fatal() error if the input buffer is not a valid bitcode | // Will report a fatal() error if the input buffer is not a valid bitcode | ||||
// or wasm object file. | // or wasm object file. | ||||
InputFile *createObjectFile(MemoryBufferRef mb, StringRef archiveName = "", | InputFile *createObjectFile(MemoryBufferRef mb, StringRef archiveName = "", | ||||
uint64_t offsetInArchive = 0); | uint64_t offsetInArchive = 0); | ||||
Show All 11 Lines |