[lld] r208365 - [PECOFF] Split LocallyImportedSymbolFile into two classes.
Rui Ueyama
ruiu at google.com
Thu May 8 15:30:44 PDT 2014
Author: ruiu
Date: Thu May 8 17:30:43 2014
New Revision: 208365
URL: http://llvm.org/viewvc/llvm-project?rev=208365&view=rev
Log:
[PECOFF] Split LocallyImportedSymbolFile into two classes.
I have a plan to use VirtualArchiveFile in this file in the near future.
This change should improve the readability by itself, too.
Modified:
lld/trunk/lib/ReaderWriter/PECOFF/LinkerGeneratedSymbolFile.h
Modified: lld/trunk/lib/ReaderWriter/PECOFF/LinkerGeneratedSymbolFile.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/PECOFF/LinkerGeneratedSymbolFile.h?rev=208365&r1=208364&r2=208365&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/PECOFF/LinkerGeneratedSymbolFile.h (original)
+++ lld/trunk/lib/ReaderWriter/PECOFF/LinkerGeneratedSymbolFile.h Thu May 8 17:30:43 2014
@@ -53,6 +53,39 @@ private:
ImpPointerAtom _defined;
};
+class VirtualArchiveLibraryFile : public ArchiveLibraryFile {
+public:
+ VirtualArchiveLibraryFile(StringRef filename)
+ : ArchiveLibraryFile(filename) {}
+
+ const atom_collection<DefinedAtom> &defined() const override {
+ return _definedAtoms;
+ }
+
+ const atom_collection<UndefinedAtom> &undefined() const override {
+ return _undefinedAtoms;
+ }
+
+ const atom_collection<SharedLibraryAtom> &sharedLibrary() const override {
+ return _sharedLibraryAtoms;
+ }
+
+ const atom_collection<AbsoluteAtom> &absolute() const override {
+ return _absoluteAtoms;
+ }
+
+ error_code
+ parseAllMembers(std::vector<std::unique_ptr<File>> &result) const override {
+ return error_code::success();
+ }
+
+private:
+ atom_collection_vector<DefinedAtom> _definedAtoms;
+ atom_collection_vector<UndefinedAtom> _undefinedAtoms;
+ atom_collection_vector<SharedLibraryAtom> _sharedLibraryAtoms;
+ atom_collection_vector<AbsoluteAtom> _absoluteAtoms;
+};
+
} // anonymous namespace
// A virtual file containing absolute symbol __ImageBase. __ImageBase (or
@@ -89,11 +122,11 @@ private:
// }
//
// This odd feature is for the compatibility with MSVC link.exe.
-class LocallyImportedSymbolFile : public ArchiveLibraryFile {
+class LocallyImportedSymbolFile : public VirtualArchiveLibraryFile {
public:
LocallyImportedSymbolFile(const PECOFFLinkingContext &ctx)
- : ArchiveLibraryFile("__imp_"), _prefix(ctx.decorateSymbol("_imp_")),
- _ordinal(0) {}
+ : VirtualArchiveLibraryFile("__imp_"),
+ _prefix(ctx.decorateSymbol("_imp_")), _ordinal(0) {}
const File *find(StringRef sym, bool dataSymbolOnly) const override {
if (!sym.startswith(_prefix))
@@ -102,36 +135,10 @@ public:
return new (_alloc) ImpSymbolFile(sym, undef, _ordinal++);
}
- const atom_collection<DefinedAtom> &defined() const override {
- return _definedAtoms;
- }
-
- const atom_collection<UndefinedAtom> &undefined() const override {
- return _undefinedAtoms;
- }
-
- const atom_collection<SharedLibraryAtom> &sharedLibrary() const override {
- return _sharedLibraryAtoms;
- }
-
- const atom_collection<AbsoluteAtom> &absolute() const override {
- return _absoluteAtoms;
- }
-
- error_code
- parseAllMembers(std::vector<std::unique_ptr<File>> &result) const override {
- return error_code::success();
- }
-
private:
std::string _prefix;
mutable uint64_t _ordinal;
mutable llvm::BumpPtrAllocator _alloc;
-
- atom_collection_vector<DefinedAtom> _definedAtoms;
- atom_collection_vector<UndefinedAtom> _undefinedAtoms;
- atom_collection_vector<SharedLibraryAtom> _sharedLibraryAtoms;
- atom_collection_vector<AbsoluteAtom> _absoluteAtoms;
};
} // end namespace pecoff
More information about the llvm-commits
mailing list