Index: include/lld/Common/LLVM.h =================================================================== --- include/lld/Common/LLVM.h +++ include/lld/Common/LLVM.h @@ -44,6 +44,20 @@ class raw_ostream; // TODO: DenseMap, ... + + namespace object { + class WasmObjectFile; + struct WasmSection; + struct WasmSegment; + class WasmSymbol; + } + namespace wasm { + struct WasmFunction; + struct WasmGlobal; + struct WasmGlobalType; + struct WasmRelocation; + struct WasmSignature; + } } namespace lld { @@ -69,6 +83,16 @@ using llvm::Expected; using llvm::raw_ostream; + + using llvm::object::WasmObjectFile; + using llvm::object::WasmSection; + using llvm::object::WasmSegment; + using llvm::object::WasmSymbol; + using llvm::wasm::WasmFunction; + using llvm::wasm::WasmGlobal; + using llvm::wasm::WasmGlobalType; + using llvm::wasm::WasmRelocation; + using llvm::wasm::WasmSignature; } // end namespace lld. namespace std { Index: wasm/Driver.cpp =================================================================== --- wasm/Driver.cpp +++ wasm/Driver.cpp @@ -31,6 +31,7 @@ #define DEBUG_TYPE "lld" using namespace llvm; +using namespace llvm::object; using namespace llvm::sys; using namespace llvm::wasm; Index: wasm/InputChunks.h =================================================================== --- wasm/InputChunks.h +++ wasm/InputChunks.h @@ -24,18 +24,9 @@ #include "Config.h" #include "InputFiles.h" #include "lld/Common/ErrorHandler.h" +#include "lld/Common/LLVM.h" #include "llvm/Object/Wasm.h" -using llvm::object::WasmSection; -using llvm::object::WasmSegment; -using llvm::wasm::WasmFunction; -using llvm::wasm::WasmRelocation; -using llvm::wasm::WasmSignature; - -namespace llvm { -class raw_ostream; -} - namespace lld { namespace wasm { Index: wasm/InputFiles.h =================================================================== --- wasm/InputFiles.h +++ wasm/InputFiles.h @@ -20,18 +20,6 @@ #include "llvm/Support/MemoryBuffer.h" #include -using llvm::object::Archive; -using llvm::object::WasmObjectFile; -using llvm::object::WasmSection; -using llvm::object::WasmSymbol; -using llvm::wasm::WasmRelocation; - -namespace llvm { -namespace lto { -class InputFile; -} -} // namespace llvm - namespace lld { namespace wasm { @@ -81,12 +69,12 @@ explicit ArchiveFile(MemoryBufferRef M) : InputFile(ArchiveKind, M) {} static bool classof(const InputFile *F) { return F->kind() == ArchiveKind; } - void addMember(const Archive::Symbol *Sym); + void addMember(const llvm::object::Archive::Symbol *Sym); void parse() override; private: - std::unique_ptr File; + std::unique_ptr File; llvm::DenseSet Seen; }; Index: wasm/InputGlobal.h =================================================================== --- wasm/InputGlobal.h +++ wasm/InputGlobal.h @@ -16,8 +16,6 @@ #include "lld/Common/ErrorHandler.h" #include "llvm/Object/Wasm.h" -using llvm::wasm::WasmGlobal; - namespace lld { namespace wasm { Index: wasm/OutputSections.h =================================================================== --- wasm/OutputSections.h +++ wasm/OutputSections.h @@ -13,11 +13,9 @@ #include "InputChunks.h" #include "WriterUtils.h" #include "lld/Common/ErrorHandler.h" +#include "lld/Common/LLVM.h" #include "llvm/ADT/DenseMap.h" -using llvm::raw_ostream; -using llvm::raw_string_ostream; - namespace lld { namespace wasm { @@ -82,7 +80,7 @@ std::string Body; protected: - raw_string_ostream BodyOutputStream; + llvm::raw_string_ostream BodyOutputStream; }; class CodeSection : public OutputSection { Index: wasm/SymbolTable.h =================================================================== --- wasm/SymbolTable.h +++ wasm/SymbolTable.h @@ -13,12 +13,9 @@ #include "InputFiles.h" #include "LTO.h" #include "Symbols.h" +#include "lld/Common/LLVM.h" #include "llvm/ADT/CachedHashString.h" #include "llvm/ADT/DenseSet.h" -#include "llvm/Support/raw_ostream.h" - -using llvm::wasm::WasmGlobalType; -using llvm::wasm::WasmSignature; namespace lld { namespace wasm { @@ -66,7 +63,7 @@ Symbol *addUndefinedGlobal(StringRef Name, uint32_t Flags, InputFile *File, const WasmGlobalType *Type); - void addLazy(ArchiveFile *F, const Archive::Symbol *Sym); + void addLazy(ArchiveFile *F, const llvm::object::Archive::Symbol *Sym); bool addComdat(StringRef Name); Index: wasm/SymbolTable.cpp =================================================================== --- wasm/SymbolTable.cpp +++ wasm/SymbolTable.cpp @@ -20,6 +20,7 @@ using namespace llvm; using namespace llvm::wasm; +using namespace llvm::object; using namespace lld; using namespace lld::wasm; Index: wasm/Symbols.h =================================================================== --- wasm/Symbols.h +++ wasm/Symbols.h @@ -15,14 +15,11 @@ #include "llvm/Object/Archive.h" #include "llvm/Object/Wasm.h" -using llvm::object::Archive; -using llvm::wasm::WasmGlobalType; -using llvm::wasm::WasmSignature; -using llvm::wasm::WasmSymbolType; - namespace lld { namespace wasm { +using llvm::wasm::WasmSymbolType; + class InputFile; class InputChunk; class InputSegment; @@ -272,14 +269,15 @@ class LazySymbol : public Symbol { public: - LazySymbol(StringRef Name, InputFile *File, const Archive::Symbol &Sym) + LazySymbol(StringRef Name, InputFile *File, + const llvm::object::Archive::Symbol &Sym) : Symbol(Name, LazyKind, 0, File), ArchiveSymbol(Sym) {} static bool classof(const Symbol *S) { return S->kind() == LazyKind; } void fetch(); private: - Archive::Symbol ArchiveSymbol; + llvm::object::Archive::Symbol ArchiveSymbol; }; // linker-generated symbols Index: wasm/WriterUtils.h =================================================================== --- wasm/WriterUtils.h +++ wasm/WriterUtils.h @@ -13,9 +13,6 @@ #include "lld/Common/LLVM.h" #include "llvm/ADT/Twine.h" #include "llvm/Object/Wasm.h" -#include "llvm/Support/raw_ostream.h" - -using llvm::raw_ostream; namespace lld { namespace wasm {