[cleanup] Random assortment of simple cleanups.

Pruning header includes and forward references and fixing comments.

llvm-svn: 197720
This commit is contained in:
Joey Gouly 2013-12-19 21:08:23 +00:00
parent 694b265d1f
commit b46cf50205
19 changed files with 26 additions and 63 deletions

View File

@ -12,14 +12,6 @@
#include "lld/Core/LLVM.h"
#include "llvm/Support/DataTypes.h"
#include <cassert>
namespace llvm {
class StringRef;
}
namespace lld {
class File;

View File

@ -11,16 +11,11 @@
#define LLD_CORE_DEFINED_ATOM_H
#include "lld/Core/Atom.h"
#include "lld/Core/Reference.h"
namespace llvm {
template <typename T>
class ArrayRef;
class StringRef;
}
#include "lld/Core/LLVM.h"
namespace lld {
class File;
class Reference;
/// \brief The fundamental unit of linking.
///

View File

@ -17,7 +17,6 @@
#include "lld/Core/LinkingContext.h"
#include "lld/Core/UndefinedAtom.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/Support/ErrorHandling.h"
#include <vector>

View File

@ -17,7 +17,6 @@
#define LLD_CORE_INPUT_GRAPH_H
#include "lld/Core/File.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/Option/ArgList.h"
#include "llvm/Support/ErrorOr.h"
@ -75,8 +74,8 @@ public:
/// \brief Do postprocessing of the InputGraph if there is a need for the
/// to provide additional information to the user, also rearranges
/// InputElements by their ordinals. If an user wants to place an input file
/// at the desired position, the user can do that
/// InputElements by their ordinals. If a user wants to place an input file
/// at the desired position, the user can do that.
virtual void doPostProcess();
range<InputElementIterT> inputElements() {
@ -210,7 +209,7 @@ class ControlNode : public InputElement {
public:
/// A control node could be of several types supported by InputGraph
/// Future kinds of Control node could be added
enum class ControlKind : uint8_t{
enum class ControlKind : uint8_t {
Simple, // Represents a simple control node
Group // Represents a type associated with ControlNodes
};
@ -225,7 +224,7 @@ public:
virtual ~ControlNode() {}
/// \brief Return the kind of control node
virtual ControlNode::ControlKind controlKind() { return _controlKind; }
virtual ControlKind controlKind() { return _controlKind; }
/// \brief Process control start/exit
virtual bool processControlEnter() { return true; }
@ -298,7 +297,7 @@ public:
return make_range(_files.begin(), _files.end());
}
/// \brief number of files.
/// \brief number of files.
size_t numFiles() const { return _files.size(); }
/// \brief add a file to the list of files

View File

@ -24,10 +24,6 @@
#include <string>
#include <vector>
namespace llvm {
class Triple;
}
namespace lld {
class PassManager;
class File;
@ -40,14 +36,11 @@ class SharedLibraryFile;
///
/// The base class LinkingContext contains the options needed by core linking.
/// Subclasses of LinkingContext have additional options needed by specific
/// Readers
/// and Writers. For example, ELFLinkingContext has methods that supplies
/// options
/// to the ELF Reader and Writer.
/// Readers and Writers. For example, ELFLinkingContext has methods that
/// supplies options to the ELF Reader and Writer.
class LinkingContext {
public:
/// \brief The types of output file that the linker
/// creates.
/// \brief The types of output file that the linker creates.
enum class OutputFileType : uint8_t {
Default, // The default output type for this target
YAML, // The output type is set to YAML
@ -82,6 +75,7 @@ public:
/// reference). Only Atoms with scope scopeLinkageUnit or scopeGlobal can
/// be kept live using this method.
const std::vector<StringRef> &deadStripRoots() const {
assert(_deadStrip && "only applicable when deadstripping enabled");
return _deadStripRoots;
}
@ -226,14 +220,14 @@ public:
/// This method adds undefined symbols specified by the -u option to the to
/// the list of undefined symbols known to the linker. This option essentially
/// forces an undefined symbol to be create. You may also need to call
/// forces an undefined symbol to be created. You may also need to call
/// addDeadStripRoot() for the symbol if your platform supports dead
/// stripping, so that the symbol will not be removed from the output.
void addInitialUndefinedSymbol(StringRef symbolName) {
_initialUndefinedSymbols.push_back(symbolName);
}
/// Iterators for symbols that appear on the command line
/// Iterators for symbols that appear on the command line.
typedef std::vector<StringRef> StringRefVector;
typedef StringRefVector::iterator StringRefVectorIter;
typedef StringRefVector::const_iterator StringRefVectorConstIter;
@ -280,7 +274,7 @@ public:
return true;
}
/// Returns the output file that that the linker needs to create
/// Returns the output file type that that the linker needs to create.
OutputFileType outputFileType() const { return _outputFileType; }
/// Returns the YAML reader.
@ -289,7 +283,7 @@ public:
/// Returns the LLD Native file format reader.
virtual Reader &getNativeReader() const { return *_nativeReader; }
/// Return the default reader for the target
/// Return the default reader for the target.
virtual Reader &getDefaultReader() const = 0;
/// This method is called by core linking to give the Writer a chance

View File

@ -10,7 +10,8 @@
#ifndef LLD_CORE_REFERENCES_H
#define LLD_CORE_REFERENCES_H
#include "llvm/Support/DataTypes.h"
#include "lld/Core/LLVM.h"
#include "llvm/ADT/StringSwitch.h"
namespace lld {

View File

@ -12,10 +12,6 @@
#include "lld/Core/Atom.h"
namespace llvm {
class StringRef;
}
namespace lld {
/// A SharedLibraryAtom has no content.

View File

@ -11,7 +11,6 @@
#define LLD_CORE_SHARED_LIBRARY_FILE_H
#include "lld/Core/File.h"
#include "lld/Core/SharedLibraryAtom.h"
namespace lld {

View File

@ -14,7 +14,6 @@
#include "llvm/ADT/DenseSet.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/ADT/StringRef.h"
#include <cstring>
#include <map>

View File

@ -15,7 +15,7 @@
namespace lld {
/// An UndefinedAtom has no content.
/// It exists as a place holder for a future atom.
/// It exists as a placeholder for a future atom.
class UndefinedAtom : public Atom {
public:
/// Whether this undefined symbol needs to be resolved,

View File

@ -101,7 +101,7 @@ private:
/// \brief Represents a ELF control node
class ELFGroup : public Group {
public:
ELFGroup(ELFLinkingContext &ctx, int64_t ordinal)
ELFGroup(const ELFLinkingContext &ctx, int64_t ordinal)
: Group(ordinal), _elfLinkingContext(ctx) {}
static inline bool classof(const InputElement *a) {

View File

@ -10,11 +10,8 @@
#ifndef LLD_PASSES_LAYOUT_PASS_H
#define LLD_PASSES_LAYOUT_PASS_H
#include "lld/Core/Atom.h"
#include "lld/Core/File.h"
#include "lld/Core/Pass.h"
#include "lld/Core/range.h"
#include "lld/Core/Reference.h"
#include "llvm/ADT/DenseMap.h"
@ -89,10 +86,8 @@ private:
void undecorate(MutableFile::DefinedAtomRange &atomRange,
std::vector<SortKey> &keys) const;
#ifndef NDEBUG
// Check if the follow-on graph is a correct structure. For debugging only.
void checkFollowonChain(MutableFile::DefinedAtomRange &range);
#endif
};
} // namespace lld

View File

@ -14,7 +14,6 @@
#include "lld/Core/LinkingContext.h"
#include "lld/Core/Pass.h"
#include <map>
#include <vector>
namespace lld {

View File

@ -14,7 +14,6 @@
#include "lld/Core/LinkingContext.h"
#include "lld/Core/Pass.h"
#include <map>
#include <vector>
namespace lld {

View File

@ -10,8 +10,6 @@
#ifndef LLD_READER_WRITER_ATOM_LAYOUT_H
#define LLD_READER_WRITER_ATOM_LAYOUT_H
#include <cstdint>
namespace lld {
class Atom;

View File

@ -49,7 +49,7 @@ private:
atom_collection_vector<UndefinedAtom> _undefinedAtoms;
atom_collection_vector<SharedLibraryAtom> _sharedLibraryAtoms;
atom_collection_vector<AbsoluteAtom> _absoluteAtoms;
bool _isWholeArchive;
const bool _isWholeArchive;
std::unordered_map<StringRef, llvm::object::Archive::child_iterator>
_symbolMemberMap;
};

View File

@ -165,8 +165,6 @@ private:
mutable std::unique_ptr<mach_o::KindHandler> _kindHandler;
mutable std::unique_ptr<Reader> _machoReader;
mutable std::unique_ptr<Writer> _writer;
};
} // end namespace lld

View File

@ -10,10 +10,6 @@
#ifndef LLD_READER_WRITER_PECOFF_LINKING_CONTEXT_H
#define LLD_READER_WRITER_PECOFF_LINKING_CONTEXT_H
#include <map>
#include <set>
#include <vector>
#include "lld/Core/LinkingContext.h"
#include "lld/ReaderWriter/Reader.h"
#include "lld/ReaderWriter/Writer.h"
@ -24,6 +20,10 @@
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/FileUtilities.h"
#include <map>
#include <set>
#include <vector>
using llvm::COFF::MachineTypes;
using llvm::COFF::WindowsSubsystem;

View File

@ -16,8 +16,8 @@
#include <vector>
namespace lld {
class ELFLinkingContext;
class File;
class ELFLinkingContext;
class MachOLinkingContext;
class PECOFFLinkingContext;
class LinkingContext;
@ -44,8 +44,8 @@ protected:
std::unique_ptr<Writer> createWriterELF(const ELFLinkingContext &);
std::unique_ptr<Writer> createWriterMachO(const MachOLinkingContext &);
std::unique_ptr<Writer> createWriterNative(const LinkingContext &);
std::unique_ptr<Writer> createWriterPECOFF(const PECOFFLinkingContext &);
std::unique_ptr<Writer> createWriterNative(const LinkingContext &);
std::unique_ptr<Writer> createWriterYAML(const LinkingContext &);
} // end namespace lld