[lld] r197132 - [PECOFF] Rename IdataPassFile and move it to Atoms.h.
Rui Ueyama
ruiu at google.com
Wed Dec 11 22:58:00 PST 2013
Author: ruiu
Date: Thu Dec 12 00:58:00 2013
New Revision: 197132
URL: http://llvm.org/viewvc/llvm-project?rev=197132&view=rev
Log:
[PECOFF] Rename IdataPassFile and move it to Atoms.h.
I'm planning to create a new pass for the DLL export table, and I want to use
the class both from IdataPass and the new pass, EdataPass. So move the class to
a common place.
Modified:
lld/trunk/lib/ReaderWriter/PECOFF/Atoms.h
lld/trunk/lib/ReaderWriter/PECOFF/IdataPass.h
Modified: lld/trunk/lib/ReaderWriter/PECOFF/Atoms.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/PECOFF/Atoms.h?rev=197132&r1=197131&r2=197132&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/PECOFF/Atoms.h (original)
+++ lld/trunk/lib/ReaderWriter/PECOFF/Atoms.h Thu Dec 12 00:58:00 2013
@@ -11,6 +11,7 @@
#define LLD_READER_WRITER_PE_COFF_ATOMS_H
#include "lld/Core/File.h"
+#include "lld/ReaderWriter/Simple.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/Object/COFF.h"
@@ -296,6 +297,22 @@ private:
const DefinedAtom *_importTableEntry;
};
+// An instance of this class represents "input file" for atoms created in a
+// pass. Atoms need to be associated to an input file even if it's not read from
+// a file, so we use this class for that.
+class VirtualFile : public SimpleFile {
+public:
+ VirtualFile(const LinkingContext &ctx)
+ : SimpleFile(ctx, "<virtual-file>"), _nextOrdinal(0) {
+ setOrdinal(ctx.getNextOrdinalAndIncrement());
+ }
+
+ uint64_t getNextOrdinal() { return _nextOrdinal++; }
+
+private:
+ uint64_t _nextOrdinal;
+};
+
//===----------------------------------------------------------------------===//
//
// Utility functions to handle layout edges.
Modified: lld/trunk/lib/ReaderWriter/PECOFF/IdataPass.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/PECOFF/IdataPass.h?rev=197132&r1=197131&r2=197132&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/PECOFF/IdataPass.h (original)
+++ lld/trunk/lib/ReaderWriter/PECOFF/IdataPass.h Thu Dec 12 00:58:00 2013
@@ -43,14 +43,13 @@ namespace idata {
class DLLNameAtom;
class HintNameAtom;
-class IdataPassFile;
class ImportTableEntryAtom;
// A state object of this pass.
struct Context {
- Context(MutableFile &f, IdataPassFile &g) : file(f), dummyFile(g) {}
+Context(MutableFile &f, coff::VirtualFile &g) : file(f), dummyFile(g) {}
MutableFile &file;
- IdataPassFile &dummyFile;
+ coff::VirtualFile &dummyFile;
};
/// The root class of all idata atoms.
@@ -141,21 +140,6 @@ public:
virtual StringRef customSectionName() const { return ".idata.d"; }
};
-// An instance of this class represents "input file" for atoms created in this
-// pass. Only one instance of this class is created as a field of IdataPass.
-class IdataPassFile : public SimpleFile {
-public:
- IdataPassFile(const LinkingContext &ctx)
- : SimpleFile(ctx, "<idata-pass-file>"), _nextOrdinal(0) {
- setOrdinal(ctx.getNextOrdinalAndIncrement());
- }
-
- uint64_t getNextOrdinal() { return _nextOrdinal++; }
-
-private:
- uint64_t _nextOrdinal;
-};
-
} // namespace idata
class IdataPass : public lld::Pass {
@@ -173,7 +157,7 @@ private:
// A dummy file with which all the atoms created in the pass will be
// associated. Atoms need to be associated to an input file even if it's not
// read from a file, so we use this object.
- idata::IdataPassFile _dummyFile;
+ coff::VirtualFile _dummyFile;
llvm::BumpPtrAllocator _alloc;
};
More information about the llvm-commits
mailing list