[lld] r197018 - [PECOFF] Remove code which is no longer needed because of r197016.
Rui Ueyama
ruiu at google.com
Wed Dec 11 00:40:40 PST 2013
Author: ruiu
Date: Wed Dec 11 02:40:40 2013
New Revision: 197018
URL: http://llvm.org/viewvc/llvm-project?rev=197018&view=rev
Log:
[PECOFF] Remove code which is no longer needed because of r197016.
Modified:
lld/trunk/lib/ReaderWriter/PECOFF/IdataPass.cpp
lld/trunk/lib/ReaderWriter/PECOFF/IdataPass.h
Modified: lld/trunk/lib/ReaderWriter/PECOFF/IdataPass.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/PECOFF/IdataPass.cpp?rev=197018&r1=197017&r2=197018&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/PECOFF/IdataPass.cpp (original)
+++ lld/trunk/lib/ReaderWriter/PECOFF/IdataPass.cpp Wed Dec 11 02:40:40 2013
@@ -38,9 +38,6 @@ static void addDir32NBReloc(COFFBaseDefi
}
namespace idata {
-class DLLNameAtom;
-class HintNameAtom;
-class ImportTableEntryAtom;
IdataAtom::IdataAtom(Context &context, std::vector<uint8_t> data)
: COFFLinkerInternalAtom(context.dummyFile,
@@ -49,16 +46,12 @@ IdataAtom::IdataAtom(Context &context, s
}
DLLNameAtom::DLLNameAtom(Context &context, StringRef name)
- : IdataAtom(context, stringRefToVector(name)) {
- context.dllNameAtoms.push_back(this);
-}
+ : IdataAtom(context, stringRefToVector(name)) {}
HintNameAtom::HintNameAtom(Context &context, uint16_t hint,
StringRef importName)
: IdataAtom(context, assembleRawContent(hint, importName)),
- _importName(importName) {
- context.hintNameAtoms.push_back(this);
-}
+ _importName(importName) {}
std::vector<uint8_t> HintNameAtom::assembleRawContent(uint16_t hint,
StringRef importName) {
@@ -115,7 +108,8 @@ std::vector<ImportTableEntryAtom *> Impo
} else {
// Import by name
entry = new (_alloc) ImportTableEntryAtom(context, 0, sectionName);
- HintNameAtom *hintName = createHintNameAtom(context, atom);
+ HintNameAtom *hintName =
+ new (_alloc) HintNameAtom(context, atom->hint(), atom->importName());
addDir32NBReloc(entry, hintName);
}
ret.push_back(entry);
@@ -127,11 +121,6 @@ std::vector<ImportTableEntryAtom *> Impo
return ret;
}
-HintNameAtom *ImportDirectoryAtom::createHintNameAtom(
- Context &context, const COFFSharedLibraryAtom *atom) const {
- return new (_alloc) HintNameAtom(context, atom->hint(), atom->importName());
-}
-
} // namespace idata
void IdataPass::perform(std::unique_ptr<MutableFile> &file) {
@@ -144,14 +133,13 @@ void IdataPass::perform(std::unique_ptr<
for (auto i : sharedAtoms) {
StringRef loadName = i.first;
std::vector<COFFSharedLibraryAtom *> &atoms = i.second;
- createImportDirectory(context, loadName, atoms);
+ new (_alloc) idata::ImportDirectoryAtom(context, loadName, atoms);
}
// All atoms, including those of tyep NullImportDirectoryAtom, are added to
// context.file in the IdataAtom's constructor.
new (_alloc) idata::NullImportDirectoryAtom(context);
- connectAtoms(context);
replaceSharedLibraryAtoms(context);
}
@@ -169,25 +157,6 @@ IdataPass::groupByLoadName(MutableFile &
return ret;
}
-void IdataPass::createImportDirectory(
- idata::Context &context, StringRef loadName,
- std::vector<COFFSharedLibraryAtom *> &dllAtoms) {
- new (_alloc) idata::ImportDirectoryAtom(context, loadName, dllAtoms);
-}
-
-template <typename T, typename U>
-void IdataPass::appendAtoms(std::vector<T *> &vec1,
- const std::vector<U *> &vec2) {
- vec1.insert(vec1.end(), vec2.begin(), vec2.end());
-}
-
-void IdataPass::connectAtoms(idata::Context &context) {
- std::vector<COFFBaseDefinedAtom *> atoms;
- appendAtoms(atoms, context.dllNameAtoms);
- appendAtoms(atoms, context.hintNameAtoms);
- coff::connectAtomsWithLayoutEdge(atoms);
-}
-
/// Transforms a reference to a COFFSharedLibraryAtom to a real reference.
void IdataPass::replaceSharedLibraryAtoms(idata::Context &context) {
for (const DefinedAtom *atom : context.file.defined()) {
Modified: lld/trunk/lib/ReaderWriter/PECOFF/IdataPass.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/PECOFF/IdataPass.h?rev=197018&r1=197017&r2=197018&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/PECOFF/IdataPass.h (original)
+++ lld/trunk/lib/ReaderWriter/PECOFF/IdataPass.h Wed Dec 11 02:40:40 2013
@@ -49,19 +49,8 @@ class ImportTableEntryAtom;
// A state object of this pass.
struct Context {
Context(MutableFile &f, IdataPassFile &g) : file(f), dummyFile(g) {}
-
MutableFile &file;
IdataPassFile &dummyFile;
-
- // The object to accumulate idata atoms. Idata atoms need to be grouped by
- // type and be continuous in the output file. To force such layout, we
- // accumulate all atoms created in the pass in the following vectors, and add
- // layout edges when finishing the pass.
- std::vector<COFFBaseDefinedAtom *> importDirectories;
- std::vector<HintNameAtom *> hintNameAtoms;
- std::vector<DLLNameAtom *> dllNameAtoms;
-
- std::map<StringRef, COFFBaseDefinedAtom *> sharedToDefinedAtom;
};
/// The root class of all idata atoms.
@@ -126,7 +115,6 @@ public:
const std::vector<COFFSharedLibraryAtom *> &sharedAtoms)
: IdataAtom(context, std::vector<uint8_t>(20, 0)) {
addRelocations(context, loadName, sharedAtoms);
- context.importDirectories.push_back(this);
}
virtual StringRef customSectionName() const { return ".idata.d"; }
@@ -138,8 +126,6 @@ private:
std::vector<ImportTableEntryAtom *> createImportTableAtoms(
Context &context, const std::vector<COFFSharedLibraryAtom *> &sharedAtoms,
bool shouldAddReference, StringRef sectionName) const;
- HintNameAtom *createHintNameAtom(Context &context,
- const COFFSharedLibraryAtom *atom) const;
mutable llvm::BumpPtrAllocator _alloc;
};
@@ -148,9 +134,7 @@ private:
class NullImportDirectoryAtom : public IdataAtom {
public:
explicit NullImportDirectoryAtom(Context &context)
- : IdataAtom(context, std::vector<uint8_t>(20, 0)) {
- context.importDirectories.push_back(this);
- }
+ : IdataAtom(context, std::vector<uint8_t>(20, 0)) {}
virtual StringRef customSectionName() const { return ".idata.d"; }
};
@@ -182,13 +166,6 @@ private:
std::map<StringRef, std::vector<COFFSharedLibraryAtom *> >
groupByLoadName(MutableFile &file);
- void createImportDirectory(idata::Context &context, StringRef loadName,
- std::vector<COFFSharedLibraryAtom *> &dllAtoms);
-
- template <typename T, typename U>
- void appendAtoms(std::vector<T *> &vec1, const std::vector<U *> &vec2);
-
- void connectAtoms(idata::Context &context);
void replaceSharedLibraryAtoms(idata::Context &context);
// A dummy file with which all the atoms created in the pass will be
More information about the llvm-commits
mailing list