[lld] r197720 - [cleanup] Random assortment of simple cleanups.

Joey Gouly joey.gouly at gmail.com
Thu Dec 19 13:08:23 PST 2013


Author: joey
Date: Thu Dec 19 15:08:23 2013
New Revision: 197720

URL: http://llvm.org/viewvc/llvm-project?rev=197720&view=rev
Log:
[cleanup] Random assortment of simple cleanups.
Pruning header includes and forward references and fixing comments.

Modified:
    lld/trunk/include/lld/Core/Atom.h
    lld/trunk/include/lld/Core/DefinedAtom.h
    lld/trunk/include/lld/Core/File.h
    lld/trunk/include/lld/Core/InputGraph.h
    lld/trunk/include/lld/Core/LinkingContext.h
    lld/trunk/include/lld/Core/Reference.h
    lld/trunk/include/lld/Core/SharedLibraryAtom.h
    lld/trunk/include/lld/Core/SharedLibraryFile.h
    lld/trunk/include/lld/Core/SymbolTable.h
    lld/trunk/include/lld/Core/UndefinedAtom.h
    lld/trunk/include/lld/Driver/GnuLdInputGraph.h
    lld/trunk/include/lld/Passes/LayoutPass.h
    lld/trunk/include/lld/Passes/RoundTripNativePass.h
    lld/trunk/include/lld/Passes/RoundTripYAMLPass.h
    lld/trunk/include/lld/ReaderWriter/AtomLayout.h
    lld/trunk/include/lld/ReaderWriter/FileArchive.h
    lld/trunk/include/lld/ReaderWriter/MachOLinkingContext.h
    lld/trunk/include/lld/ReaderWriter/PECOFFLinkingContext.h
    lld/trunk/include/lld/ReaderWriter/Writer.h

Modified: lld/trunk/include/lld/Core/Atom.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/include/lld/Core/Atom.h?rev=197720&r1=197719&r2=197720&view=diff
==============================================================================
--- lld/trunk/include/lld/Core/Atom.h (original)
+++ lld/trunk/include/lld/Core/Atom.h Thu Dec 19 15:08:23 2013
@@ -12,14 +12,6 @@
 
 #include "lld/Core/LLVM.h"
 
-#include "llvm/Support/DataTypes.h"
-
-#include <cassert>
-
-namespace llvm {
-  class StringRef;
-}
-
 namespace lld {
 
 class File;

Modified: lld/trunk/include/lld/Core/DefinedAtom.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/include/lld/Core/DefinedAtom.h?rev=197720&r1=197719&r2=197720&view=diff
==============================================================================
--- lld/trunk/include/lld/Core/DefinedAtom.h (original)
+++ lld/trunk/include/lld/Core/DefinedAtom.h Thu Dec 19 15:08:23 2013
@@ -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.
 ///

Modified: lld/trunk/include/lld/Core/File.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/include/lld/Core/File.h?rev=197720&r1=197719&r2=197720&view=diff
==============================================================================
--- lld/trunk/include/lld/Core/File.h (original)
+++ lld/trunk/include/lld/Core/File.h Thu Dec 19 15:08:23 2013
@@ -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>

Modified: lld/trunk/include/lld/Core/InputGraph.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/include/lld/Core/InputGraph.h?rev=197720&r1=197719&r2=197720&view=diff
==============================================================================
--- lld/trunk/include/lld/Core/InputGraph.h (original)
+++ lld/trunk/include/lld/Core/InputGraph.h Thu Dec 19 15:08:23 2013
@@ -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

Modified: lld/trunk/include/lld/Core/LinkingContext.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/include/lld/Core/LinkingContext.h?rev=197720&r1=197719&r2=197720&view=diff
==============================================================================
--- lld/trunk/include/lld/Core/LinkingContext.h (original)
+++ lld/trunk/include/lld/Core/LinkingContext.h Thu Dec 19 15:08:23 2013
@@ -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

Modified: lld/trunk/include/lld/Core/Reference.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/include/lld/Core/Reference.h?rev=197720&r1=197719&r2=197720&view=diff
==============================================================================
--- lld/trunk/include/lld/Core/Reference.h (original)
+++ lld/trunk/include/lld/Core/Reference.h Thu Dec 19 15:08:23 2013
@@ -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 {

Modified: lld/trunk/include/lld/Core/SharedLibraryAtom.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/include/lld/Core/SharedLibraryAtom.h?rev=197720&r1=197719&r2=197720&view=diff
==============================================================================
--- lld/trunk/include/lld/Core/SharedLibraryAtom.h (original)
+++ lld/trunk/include/lld/Core/SharedLibraryAtom.h Thu Dec 19 15:08:23 2013
@@ -12,10 +12,6 @@
 
 #include "lld/Core/Atom.h"
 
-namespace llvm {
-  class StringRef;
-}
-
 namespace lld {
 
 /// A SharedLibraryAtom has no content.

Modified: lld/trunk/include/lld/Core/SharedLibraryFile.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/include/lld/Core/SharedLibraryFile.h?rev=197720&r1=197719&r2=197720&view=diff
==============================================================================
--- lld/trunk/include/lld/Core/SharedLibraryFile.h (original)
+++ lld/trunk/include/lld/Core/SharedLibraryFile.h Thu Dec 19 15:08:23 2013
@@ -11,7 +11,6 @@
 #define LLD_CORE_SHARED_LIBRARY_FILE_H
 
 #include "lld/Core/File.h"
-#include "lld/Core/SharedLibraryAtom.h"
 
 namespace lld {
 

Modified: lld/trunk/include/lld/Core/SymbolTable.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/include/lld/Core/SymbolTable.h?rev=197720&r1=197719&r2=197720&view=diff
==============================================================================
--- lld/trunk/include/lld/Core/SymbolTable.h (original)
+++ lld/trunk/include/lld/Core/SymbolTable.h Thu Dec 19 15:08:23 2013
@@ -14,7 +14,6 @@
 
 #include "llvm/ADT/DenseSet.h"
 #include "llvm/ADT/StringExtras.h"
-#include "llvm/ADT/StringRef.h"
 
 #include <cstring>
 #include <map>

Modified: lld/trunk/include/lld/Core/UndefinedAtom.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/include/lld/Core/UndefinedAtom.h?rev=197720&r1=197719&r2=197720&view=diff
==============================================================================
--- lld/trunk/include/lld/Core/UndefinedAtom.h (original)
+++ lld/trunk/include/lld/Core/UndefinedAtom.h Thu Dec 19 15:08:23 2013
@@ -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,

Modified: lld/trunk/include/lld/Driver/GnuLdInputGraph.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/include/lld/Driver/GnuLdInputGraph.h?rev=197720&r1=197719&r2=197720&view=diff
==============================================================================
--- lld/trunk/include/lld/Driver/GnuLdInputGraph.h (original)
+++ lld/trunk/include/lld/Driver/GnuLdInputGraph.h Thu Dec 19 15:08:23 2013
@@ -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) {

Modified: lld/trunk/include/lld/Passes/LayoutPass.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/include/lld/Passes/LayoutPass.h?rev=197720&r1=197719&r2=197720&view=diff
==============================================================================
--- lld/trunk/include/lld/Passes/LayoutPass.h (original)
+++ lld/trunk/include/lld/Passes/LayoutPass.h Thu Dec 19 15:08:23 2013
@@ -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

Modified: lld/trunk/include/lld/Passes/RoundTripNativePass.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/include/lld/Passes/RoundTripNativePass.h?rev=197720&r1=197719&r2=197720&view=diff
==============================================================================
--- lld/trunk/include/lld/Passes/RoundTripNativePass.h (original)
+++ lld/trunk/include/lld/Passes/RoundTripNativePass.h Thu Dec 19 15:08:23 2013
@@ -14,7 +14,6 @@
 #include "lld/Core/LinkingContext.h"
 #include "lld/Core/Pass.h"
 
-#include <map>
 #include <vector>
 
 namespace lld {

Modified: lld/trunk/include/lld/Passes/RoundTripYAMLPass.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/include/lld/Passes/RoundTripYAMLPass.h?rev=197720&r1=197719&r2=197720&view=diff
==============================================================================
--- lld/trunk/include/lld/Passes/RoundTripYAMLPass.h (original)
+++ lld/trunk/include/lld/Passes/RoundTripYAMLPass.h Thu Dec 19 15:08:23 2013
@@ -14,7 +14,6 @@
 #include "lld/Core/LinkingContext.h"
 #include "lld/Core/Pass.h"
 
-#include <map>
 #include <vector>
 
 namespace lld {

Modified: lld/trunk/include/lld/ReaderWriter/AtomLayout.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/include/lld/ReaderWriter/AtomLayout.h?rev=197720&r1=197719&r2=197720&view=diff
==============================================================================
--- lld/trunk/include/lld/ReaderWriter/AtomLayout.h (original)
+++ lld/trunk/include/lld/ReaderWriter/AtomLayout.h Thu Dec 19 15:08:23 2013
@@ -10,8 +10,6 @@
 #ifndef LLD_READER_WRITER_ATOM_LAYOUT_H
 #define LLD_READER_WRITER_ATOM_LAYOUT_H
 
-#include <cstdint>
-
 namespace lld {
 class Atom;
 

Modified: lld/trunk/include/lld/ReaderWriter/FileArchive.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/include/lld/ReaderWriter/FileArchive.h?rev=197720&r1=197719&r2=197720&view=diff
==============================================================================
--- lld/trunk/include/lld/ReaderWriter/FileArchive.h (original)
+++ lld/trunk/include/lld/ReaderWriter/FileArchive.h Thu Dec 19 15:08:23 2013
@@ -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;
 };

Modified: lld/trunk/include/lld/ReaderWriter/MachOLinkingContext.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/include/lld/ReaderWriter/MachOLinkingContext.h?rev=197720&r1=197719&r2=197720&view=diff
==============================================================================
--- lld/trunk/include/lld/ReaderWriter/MachOLinkingContext.h (original)
+++ lld/trunk/include/lld/ReaderWriter/MachOLinkingContext.h Thu Dec 19 15:08:23 2013
@@ -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

Modified: lld/trunk/include/lld/ReaderWriter/PECOFFLinkingContext.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/include/lld/ReaderWriter/PECOFFLinkingContext.h?rev=197720&r1=197719&r2=197720&view=diff
==============================================================================
--- lld/trunk/include/lld/ReaderWriter/PECOFFLinkingContext.h (original)
+++ lld/trunk/include/lld/ReaderWriter/PECOFFLinkingContext.h Thu Dec 19 15:08:23 2013
@@ -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;
 

Modified: lld/trunk/include/lld/ReaderWriter/Writer.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/include/lld/ReaderWriter/Writer.h?rev=197720&r1=197719&r2=197720&view=diff
==============================================================================
--- lld/trunk/include/lld/ReaderWriter/Writer.h (original)
+++ lld/trunk/include/lld/ReaderWriter/Writer.h Thu Dec 19 15:08:23 2013
@@ -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
 





More information about the llvm-commits mailing list