[llvm-commits] [lld] r153963 - in /lld/trunk: include/lld/Core/ lib/Core/ lib/Passes/ tools/lld-core/

Michael J. Spencer bigcheesegs at gmail.com
Tue Apr 3 11:39:40 PDT 2012


Author: mspencer
Date: Tue Apr  3 13:39:40 2012
New Revision: 153963

URL: http://llvm.org/viewvc/llvm-project?rev=153963&view=rev
Log:
Steal LLVM.h from Clang. This brings in very commonly used LLVM ADT/Support
types into the lld namespace.

Added:
    lld/trunk/include/lld/Core/LLVM.h
Modified:
    lld/trunk/include/lld/Core/AliasAtom.h
    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/InputFiles.h
    lld/trunk/include/lld/Core/NativeReader.h
    lld/trunk/include/lld/Core/NativeWriter.h
    lld/trunk/include/lld/Core/Platform.h
    lld/trunk/include/lld/Core/SharedLibraryAtom.h
    lld/trunk/include/lld/Core/SymbolTable.h
    lld/trunk/include/lld/Core/YamlReader.h
    lld/trunk/include/lld/Core/YamlWriter.h
    lld/trunk/lib/Core/File.cpp
    lld/trunk/lib/Core/NativeReader.cpp
    lld/trunk/lib/Core/NativeWriter.cpp
    lld/trunk/lib/Core/Resolver.cpp
    lld/trunk/lib/Core/SymbolTable.cpp
    lld/trunk/lib/Core/YamlReader.cpp
    lld/trunk/lib/Core/YamlWriter.cpp
    lld/trunk/lib/Passes/GOTPass.cpp
    lld/trunk/lib/Passes/StubsPass.cpp
    lld/trunk/tools/lld-core/lld-core.cpp

Modified: lld/trunk/include/lld/Core/AliasAtom.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/include/lld/Core/AliasAtom.h?rev=153963&r1=153962&r2=153963&view=diff
==============================================================================
--- lld/trunk/include/lld/Core/AliasAtom.h (original)
+++ lld/trunk/include/lld/Core/AliasAtom.h Tue Apr  3 13:39:40 2012
@@ -18,7 +18,7 @@
 
 class AliasAtom : public Atom {
 public:
-  AliasAtom(llvm::StringRef nm, const Atom &target,  Atom::Scope scope)
+  AliasAtom(StringRef nm, const Atom &target,  Atom::Scope scope)
     : Atom( target.definition()
           , Atom::combineNever
           , scope
@@ -38,16 +38,16 @@
     return _aliasOf.file();
   }
 
-  virtual bool translationUnitSource(llvm::StringRef &path) const {
+  virtual bool translationUnitSource(StringRef &path) const {
     return _aliasOf.translationUnitSource(path);
   }
 
-  virtual llvm::StringRef name() const {
+  virtual StringRef name() const {
     return _name;
   }
 
 private:
-  const llvm::StringRef _name;
+  const StringRef _name;
   const Atom &_aliasOf;
 };
 

Modified: lld/trunk/include/lld/Core/Atom.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/include/lld/Core/Atom.h?rev=153963&r1=153962&r2=153963&view=diff
==============================================================================
--- lld/trunk/include/lld/Core/Atom.h (original)
+++ lld/trunk/include/lld/Core/Atom.h Tue Apr  3 13:39:40 2012
@@ -10,6 +10,8 @@
 #ifndef LLD_CORE_ATOM_H_
 #define LLD_CORE_ATOM_H_
 
+#include "lld/Core/LLVM.h"
+
 #include "llvm/Support/DataTypes.h"
 
 #include <cassert>
@@ -43,9 +45,9 @@
   virtual const class File& file() const = 0;
 
   /// name - The name of the atom. For a function atom, it is the (mangled)
-  /// name of the function. 
-  virtual llvm::StringRef name() const = 0;
-  
+  /// name of the function.
+  virtual StringRef name() const = 0;
+
   /// definition - Whether this atom is a definition or represents an undefined
   /// symbol.
   Definition definition() const { return _definition; };

Modified: lld/trunk/include/lld/Core/DefinedAtom.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/include/lld/Core/DefinedAtom.h?rev=153963&r1=153962&r2=153963&view=diff
==============================================================================
--- lld/trunk/include/lld/Core/DefinedAtom.h (original)
+++ lld/trunk/include/lld/Core/DefinedAtom.h Tue Apr  3 13:39:40 2012
@@ -247,7 +247,7 @@
   
   /// rawContent - returns a reference to the raw (unrelocated) bytes of 
   /// this Atom's content.
-  virtual llvm::ArrayRef<uint8_t> rawContent() const = 0;
+  virtual ArrayRef<uint8_t> rawContent() const = 0;
   
   /// This class abstracts iterating over the sequence of References
   /// in an Atom.  Concrete instances of DefinedAtom must implement

Modified: lld/trunk/include/lld/Core/File.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/include/lld/Core/File.h?rev=153963&r1=153962&r2=153963&view=diff
==============================================================================
--- lld/trunk/include/lld/Core/File.h (original)
+++ lld/trunk/include/lld/Core/File.h Tue Apr  3 13:39:40 2012
@@ -39,7 +39,7 @@
 
   /// For error messages and debugging, this returns the path to the file
   /// which was used to create this object (e.g. "/tmp/foo.o").
-  llvm::StringRef path() const  {
+  StringRef path() const  {
     return _path;
   }
 
@@ -47,7 +47,7 @@
   /// file which this (File) object represents.  This information is usually 
   /// parsed out of the DWARF debug information. If the source file cannot 
   /// be ascertained, this method returns the empty string.
-  virtual llvm::StringRef translationUnitSource() const;
+  virtual StringRef translationUnitSource() const;
 
 protected:
   template <typename T> class atom_iterator; // forward reference
@@ -118,7 +118,7 @@
 
 protected:
   /// only subclasses of File can be instantiated 
-  File(llvm::StringRef p) : _path(p) {}
+  File(StringRef p) : _path(p) {}
 
 
   /// Different object file readers may instantiate and manage atoms with
@@ -207,7 +207,7 @@
   
 
 private:
-  llvm::StringRef _path;
+  StringRef _path;
 };
 
 } // namespace lld

Modified: lld/trunk/include/lld/Core/InputFiles.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/include/lld/Core/InputFiles.h?rev=153963&r1=153962&r2=153963&view=diff
==============================================================================
--- lld/trunk/include/lld/Core/InputFiles.h (original)
+++ lld/trunk/include/lld/Core/InputFiles.h Tue Apr  3 13:39:40 2012
@@ -39,7 +39,7 @@
   virtual void forEachInitialAtom(Handler &) const = 0;
 
   /// @brief searches libraries for name
-  virtual bool searchLibraries(  llvm::StringRef name
+  virtual bool searchLibraries(  StringRef name
                                , bool searchDylibs
                                , bool searchArchives
                                , bool dataSymbolOnly

Added: lld/trunk/include/lld/Core/LLVM.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/include/lld/Core/LLVM.h?rev=153963&view=auto
==============================================================================
--- lld/trunk/include/lld/Core/LLVM.h (added)
+++ lld/trunk/include/lld/Core/LLVM.h Tue Apr  3 13:39:40 2012
@@ -0,0 +1,75 @@
+//===--- LLVM.h - Import various common LLVM datatypes ----------*- C++ -*-===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// This file forward declares and imports various common LLVM datatypes that
+// lld wants to use unqualified.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLD_CORE_LLVM_H
+#define LLD_CORE_LLVM_H
+
+// This should be the only #include, force #includes of all the others on
+// clients.
+#include "llvm/Support/Casting.h"
+
+namespace llvm {
+  // ADT's.
+  class StringRef;
+  class Twine;
+  template<typename T> class ArrayRef;
+  template<class T> class OwningPtr;
+  template<unsigned InternalLen> class SmallString;
+  template<typename T, unsigned N> class SmallVector;
+  template<typename T> class SmallVectorImpl;
+
+  template<typename T>
+  struct SaveAndRestore;
+
+  // Reference counting.
+  template <typename T> class IntrusiveRefCntPtr;
+  template <typename T> struct IntrusiveRefCntPtrInfo;
+  template <class Derived> class RefCountedBase;
+  class RefCountedBaseVPTR;
+
+  class error_code;
+  class raw_ostream;
+  // TODO: DenseMap, ...
+}
+
+
+namespace lld {
+  // Casting operators.
+  using llvm::isa;
+  using llvm::cast;
+  using llvm::dyn_cast;
+  using llvm::dyn_cast_or_null;
+  using llvm::cast_or_null;
+
+  // ADT's.
+  using llvm::StringRef;
+  using llvm::Twine;
+  using llvm::ArrayRef;
+  using llvm::OwningPtr;
+  using llvm::SmallString;
+  using llvm::SmallVector;
+  using llvm::SmallVectorImpl;
+  using llvm::SaveAndRestore;
+
+  // Reference counting.
+  using llvm::IntrusiveRefCntPtr;
+  using llvm::IntrusiveRefCntPtrInfo;
+  using llvm::RefCountedBase;
+  using llvm::RefCountedBaseVPTR;
+
+  using llvm::error_code;
+  using llvm::raw_ostream;
+} // end namespace clang.
+
+#endif

Modified: lld/trunk/include/lld/Core/NativeReader.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/include/lld/Core/NativeReader.h?rev=153963&r1=153962&r2=153963&view=diff
==============================================================================
--- lld/trunk/include/lld/Core/NativeReader.h (original)
+++ lld/trunk/include/lld/Core/NativeReader.h Tue Apr  3 13:39:40 2012
@@ -25,15 +25,15 @@
 namespace lld {
   /// parseNativeObjectFileOrSTDIN - Open the specified native object file (use 
   /// stdin if the path is "-") and instantiate into an lld::File object.
-  llvm::error_code parseNativeObjectFileOrSTDIN( llvm::StringRef path
-                                               , std::unique_ptr<File> &result);
+  error_code parseNativeObjectFileOrSTDIN( StringRef path
+                                         , std::unique_ptr<File> &result);
 
 
   /// parseNativeObjectFile - Parse the specified native object file 
   /// (in a buffer) and instantiate into an lld::File object.
-  llvm::error_code parseNativeObjectFile(std::unique_ptr<llvm::MemoryBuffer> &mb
-                                        ,llvm::StringRef path
-                                        ,std::unique_ptr<File> &result);
+  error_code parseNativeObjectFile( std::unique_ptr<llvm::MemoryBuffer> &mb
+                                  , StringRef path
+                                  , std::unique_ptr<File> &result);
 
 } // namespace lld
 

Modified: lld/trunk/include/lld/Core/NativeWriter.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/include/lld/Core/NativeWriter.h?rev=153963&r1=153962&r2=153963&view=diff
==============================================================================
--- lld/trunk/include/lld/Core/NativeWriter.h (original)
+++ lld/trunk/include/lld/Core/NativeWriter.h Tue Apr  3 13:39:40 2012
@@ -23,11 +23,11 @@
 
   /// writeNativeObjectFile - writes the lld::File object in native object
   /// file format to the specified file path.
-  int writeNativeObjectFile(const lld::File &, llvm::StringRef path);
+  int writeNativeObjectFile(const lld::File &, StringRef path);
 
   /// writeNativeObjectFile - writes the lld::File object in native object
   /// file format to the specified stream.
-  int writeNativeObjectFile(const lld::File &, llvm::raw_ostream &);
+  int writeNativeObjectFile(const lld::File &, raw_ostream &);
 
 } // namespace lld
 

Modified: lld/trunk/include/lld/Core/Platform.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/include/lld/Core/Platform.h?rev=153963&r1=153962&r2=153963&view=diff
==============================================================================
--- lld/trunk/include/lld/Core/Platform.h (original)
+++ lld/trunk/include/lld/Core/Platform.h Tue Apr  3 13:39:40 2012
@@ -40,7 +40,7 @@
                              std::vector<const DefinedAtom *>&) = 0;
 
   /// @brief give platform a chance to resolve platform-specific undefs
-  virtual bool getPlatformAtoms(llvm::StringRef undefined,
+  virtual bool getPlatformAtoms(StringRef undefined,
                                 std::vector<const DefinedAtom *>&) = 0;
 
   /// @brief resolver should remove unreferenced atoms
@@ -53,11 +53,11 @@
   virtual bool getImplicitDeadStripRoots(std::vector<const DefinedAtom *>&) = 0;
 
   /// @brief return entry point for output file (e.g. "main") or nullptr
-  virtual llvm::StringRef entryPointName() = 0;
+  virtual StringRef entryPointName() = 0;
 
   /// @brief for iterating must-be-defined symbols ("main" or -u command line
   ///        option)
-  typedef llvm::StringRef const *UndefinesIterator;
+  typedef StringRef const *UndefinesIterator;
   virtual UndefinesIterator  initialUndefinesBegin() const = 0;
   virtual UndefinesIterator  initialUndefinesEnd() const = 0;
 
@@ -66,10 +66,10 @@
   virtual bool searchSharedLibrariesToOverrideTentativeDefinitions() = 0;
 
   /// @brief if platform allows symbol to remain undefined (e.g. -r)
-  virtual bool allowUndefinedSymbol(llvm::StringRef name) = 0;
+  virtual bool allowUndefinedSymbol(StringRef name) = 0;
 
   /// @brief for debugging dead code stripping, -why_live
-  virtual bool printWhyLive(llvm::StringRef name) = 0;
+  virtual bool printWhyLive(StringRef name) = 0;
 
   /// When core linking finds a duplicate definition, the platform
   /// can either print an error message and terminate or return with
@@ -104,11 +104,11 @@
 
   /// Converts a reference kind string to a in-memory numeric value.
   /// For use with parsing YAML encoded object files.
-  virtual Reference::Kind kindFromString(llvm::StringRef) = 0;
+  virtual Reference::Kind kindFromString(StringRef) = 0;
 
   /// Converts an in-memory reference kind value to a string.
   /// For use with writing YAML encoded object files.
-  virtual llvm::StringRef kindToString(Reference::Kind) = 0;
+  virtual StringRef kindToString(Reference::Kind) = 0;
 
   /// If true, the linker will use stubs and GOT entries for
   /// references to shared library symbols. If false, the linker

Modified: lld/trunk/include/lld/Core/SharedLibraryAtom.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/include/lld/Core/SharedLibraryAtom.h?rev=153963&r1=153962&r2=153963&view=diff
==============================================================================
--- lld/trunk/include/lld/Core/SharedLibraryAtom.h (original)
+++ lld/trunk/include/lld/Core/SharedLibraryAtom.h Tue Apr  3 13:39:40 2012
@@ -25,7 +25,7 @@
   /// Returns shared library name used to load it at runtime.
   /// On linux that is the DT_NEEDED name.
   /// On Darwin it is the LC_DYLIB_LOAD dylib name.
-  virtual llvm::StringRef loadName() const = 0;
+  virtual StringRef loadName() const = 0;
 
   /// Returns if shared library symbol can be missing at runtime and if
   /// so the loader should silently resolve address of symbol to be nullptr.

Modified: lld/trunk/include/lld/Core/SymbolTable.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/include/lld/Core/SymbolTable.h?rev=153963&r1=153962&r2=153963&view=diff
==============================================================================
--- lld/trunk/include/lld/Core/SymbolTable.h (original)
+++ lld/trunk/include/lld/Core/SymbolTable.h Tue Apr  3 13:39:40 2012
@@ -10,6 +10,8 @@
 #ifndef LLD_CORE_SYMBOL_TABLE_H_
 #define LLD_CORE_SYMBOL_TABLE_H_
 
+#include "lld/Core/LLVM.h"
+
 #include "llvm/ADT/DenseSet.h"
 #include "llvm/ADT/StringExtras.h"
 #include "llvm/ADT/StringRef.h"
@@ -50,10 +52,10 @@
   
   /// @brief checks if name is in symbol table and if so atom is not
   ///        UndefinedAtom
-  bool isDefined(llvm::StringRef sym);
+  bool isDefined(StringRef sym);
 
   /// @brief returns atom in symbol table for specified name (or nullptr)
-  const Atom *findByName(llvm::StringRef sym);
+  const Atom *findByName(StringRef sym);
 
   /// @brief returns vector of remaining UndefinedAtoms
   void undefines(std::vector<const Atom *>&);
@@ -68,14 +70,14 @@
   typedef llvm::DenseMap<const Atom *, const Atom *> AtomToAtom;
 
   struct StringRefMappingInfo {
-    static llvm::StringRef getEmptyKey() { return llvm::StringRef(); }
-    static llvm::StringRef getTombstoneKey() { return llvm::StringRef(" ", 0); }
-    static unsigned getHashValue(llvm::StringRef const val) {
+    static StringRef getEmptyKey() { return StringRef(); }
+    static StringRef getTombstoneKey() { return StringRef(" ", 0); }
+    static unsigned getHashValue(StringRef const val) {
                                                return llvm::HashString(val); }
-    static bool isEqual(llvm::StringRef const lhs, 
-                        llvm::StringRef const rhs) { return lhs.equals(rhs); }
+    static bool isEqual(StringRef const lhs,
+                        StringRef const rhs) { return lhs.equals(rhs); }
   };
-	typedef llvm::DenseMap<llvm::StringRef, const Atom *, 
+	typedef llvm::DenseMap<StringRef, const Atom *,
                                            StringRefMappingInfo> NameToAtom;
   
   struct AtomMappingInfo {

Modified: lld/trunk/include/lld/Core/YamlReader.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/include/lld/Core/YamlReader.h?rev=153963&r1=153962&r2=153963&view=diff
==============================================================================
--- lld/trunk/include/lld/Core/YamlReader.h (original)
+++ lld/trunk/include/lld/Core/YamlReader.h Tue Apr  3 13:39:40 2012
@@ -10,6 +10,8 @@
 #ifndef LLD_CORE_YAML_READER_H_
 #define LLD_CORE_YAML_READER_H_
 
+#include "lld/Core/LLVM.h"
+
 #include "llvm/Support/system_error.h"
 
 #include <vector>
@@ -29,16 +31,16 @@
   /// parseObjectTextFileOrSTDIN - Open the specified YAML file (use stdin if 
   /// the path is "-") and parse into lld::File object(s) and append each to 
   /// the specified vector<File*>.
-  llvm::error_code parseObjectTextFileOrSTDIN(llvm::StringRef path
-                                              , Platform& 
-                                              , std::vector<const File *>&);
+  error_code parseObjectTextFileOrSTDIN( StringRef path
+                                       , Platform&
+                                       , std::vector<const File *>&);
 
 
   /// parseObjectText - Parse the specified YAML formatted MemoryBuffer
   /// into lld::File object(s) and append each to the specified vector<File*>.
-  llvm::error_code parseObjectText(llvm::MemoryBuffer *mb
-                                , Platform& 
-                                , std::vector<const File *>&);
+  error_code parseObjectText( llvm::MemoryBuffer *mb
+                            , Platform&
+                            , std::vector<const File *>&);
 
 } // namespace yaml
 } // namespace lld

Modified: lld/trunk/include/lld/Core/YamlWriter.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/include/lld/Core/YamlWriter.h?rev=153963&r1=153962&r2=153963&view=diff
==============================================================================
--- lld/trunk/include/lld/Core/YamlWriter.h (original)
+++ lld/trunk/include/lld/Core/YamlWriter.h Tue Apr  3 13:39:40 2012
@@ -10,6 +10,8 @@
 #ifndef LLD_CORE_YAML_WRITER_H_
 #define LLD_CORE_YAML_WRITER_H_
 
+#include "lld/Core/LLVM.h"
+
 #include "llvm/Support/raw_ostream.h"
 
 namespace lld {
@@ -21,7 +23,7 @@
 
   /// writeObjectText - writes the lld::File object as in YAML
   /// format to the specified stream.
-  void writeObjectText(const lld::File &, Platform &, llvm::raw_ostream &);
+  void writeObjectText(const lld::File &, Platform &, raw_ostream &);
 
 } // namespace yaml
 } // namespace lld

Modified: lld/trunk/lib/Core/File.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Core/File.cpp?rev=153963&r1=153962&r2=153963&view=diff
==============================================================================
--- lld/trunk/lib/Core/File.cpp (original)
+++ lld/trunk/lib/Core/File.cpp Tue Apr  3 13:39:40 2012
@@ -8,13 +8,14 @@
 //===----------------------------------------------------------------------===//
 
 #include "lld/Core/File.h"
+#include "lld/Core/LLVM.h"
 
 namespace lld {
 
 File::~File() {}
 
-llvm::StringRef File::translationUnitSource() const {
-  return llvm::StringRef();
+StringRef File::translationUnitSource() const {
+  return StringRef();
 }
 
 

Modified: lld/trunk/lib/Core/NativeReader.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Core/NativeReader.cpp?rev=153963&r1=153962&r2=153963&view=diff
==============================================================================
--- lld/trunk/lib/Core/NativeReader.cpp (original)
+++ lld/trunk/lib/Core/NativeReader.cpp Tue Apr  3 13:39:40 2012
@@ -40,8 +40,8 @@
   
   virtual uint64_t ordinal() const; 
   
-  virtual llvm::StringRef name() const;
   
+  virtual StringRef name() const;
   virtual uint64_t size() const {
     return _ivarData->contentSize;
   }
@@ -71,7 +71,7 @@
     return (DefinedAtom::SectionChoice)(attributes().sectionChoice);
   }
 
-  virtual llvm::StringRef customSectionName() const;
+  virtual StringRef customSectionName() const;
       
   virtual DefinedAtom::DeadStripKind deadStrip() const {
      return (DefinedAtom::DeadStripKind)(attributes().deadStrip);
@@ -89,8 +89,8 @@
      return (attributes().alias != 0);
   }
   
-  virtual llvm::ArrayRef<uint8_t> rawContent() const;
   
+  virtual ArrayRef<uint8_t> rawContent() const;
   virtual reference_iterator referencesBegin() const;
   
   virtual reference_iterator referencesEnd() const;
@@ -119,7 +119,7 @@
         : _file(&f), _ivarData(ivarData) { } 
 
   virtual const File& file() const;
-  virtual llvm::StringRef name() const;
+  virtual StringRef name() const;
   
   virtual CanBeNull canBeNull() const {
     return (CanBeNull)(_ivarData->flags & 0x3);
@@ -143,8 +143,8 @@
         : _file(&f), _ivarData(ivarData) { } 
 
   virtual const File& file() const;
-  virtual llvm::StringRef name() const;
-  virtual llvm::StringRef loadName() const;
+  virtual StringRef name() const;
+  virtual StringRef loadName() const;
   
   virtual bool canBeNullAtRuntime() const {
     return (_ivarData->flags & 0x1);
@@ -167,7 +167,7 @@
         : _file(&f), _ivarData(ivarData) { } 
 
   virtual const File& file() const;
-  virtual llvm::StringRef name() const;
+  virtual StringRef name() const;
   
   virtual uint64_t value() const {
     return _ivarData->value;
@@ -228,9 +228,9 @@
 
   /// Instantiates a File object from a native object file.  Ownership
   /// of the MemoryBuffer is transfered to the resulting File object.
-  static llvm::error_code make(std::unique_ptr<llvm::MemoryBuffer> mb,
-                               llvm::StringRef path,
-                               std::unique_ptr<File> &result) {
+  static error_code make(std::unique_ptr<llvm::MemoryBuffer> mb,
+                         StringRef path,
+                         std::unique_ptr<File> &result) {
     const uint8_t* const base = 
                        reinterpret_cast<const uint8_t*>(mb->getBufferStart());
     const NativeFileHeader* const header = 
@@ -251,7 +251,7 @@
     
     // process each chunk
     for(uint32_t i=0; i < header->chunkCount; ++i) {
-      llvm::error_code ec;
+      error_code ec;
       const NativeChunk* chunk = &chunks[i];
       // sanity check chunk is within file
       if ( chunk->fileOffset > fileSize )
@@ -343,8 +343,8 @@
   friend class NativeReferenceV1;
   
   // instantiate array of DefinedAtoms from v1 ivar data in file
-  llvm::error_code processDefinedAtomsV1(const uint8_t* base, 
-                                                const NativeChunk* chunk) {
+  error_code processDefinedAtomsV1(const uint8_t *base,
+                                   const NativeChunk *chunk) {
     const size_t atomSize = sizeof(NativeDefinedAtomV1);
     size_t atomsArraySize = chunk->elementCount * atomSize;
     uint8_t* atomsStart = reinterpret_cast<uint8_t*>
@@ -373,16 +373,16 @@
   }
   
   // set up pointers to attributes array
-  llvm::error_code processAttributesV1(const uint8_t* base, 
-                                       const NativeChunk* chunk) {
+  error_code processAttributesV1(const uint8_t *base,
+                                 const NativeChunk *chunk) {
     this->_attributes = base + chunk->fileOffset;
     this->_attributesMaxOffset = chunk->fileSize;
     return make_error_code(native_reader_error::success);
   }
   
   // instantiate array of UndefinedAtoms from v1 ivar data in file
-  llvm::error_code processUndefinedAtomsV1(const uint8_t* base, 
-                                                const NativeChunk* chunk) {
+  error_code processUndefinedAtomsV1(const uint8_t *base,
+                                     const NativeChunk *chunk) {
     const size_t atomSize = sizeof(NativeUndefinedAtomV1);
     size_t atomsArraySize = chunk->elementCount * atomSize;
     uint8_t* atomsStart = reinterpret_cast<uint8_t*>
@@ -412,8 +412,8 @@
   
   
   // instantiate array of ShareLibraryAtoms from v1 ivar data in file
-  llvm::error_code processSharedLibraryAtomsV1(const uint8_t* base, 
-                                                const NativeChunk* chunk) {
+  error_code processSharedLibraryAtomsV1(const uint8_t *base,
+                                         const NativeChunk *chunk) {
     const size_t atomSize = sizeof(NativeSharedLibraryAtomV1);
     size_t atomsArraySize = chunk->elementCount * atomSize;
     uint8_t* atomsStart = reinterpret_cast<uint8_t*>
@@ -443,8 +443,8 @@
   
  
    // instantiate array of AbsoluteAtoms from v1 ivar data in file
-  llvm::error_code processAbsoluteAtomsV1(const uint8_t* base, 
-                                                const NativeChunk* chunk) {
+  error_code processAbsoluteAtomsV1(const uint8_t *base,
+                                    const NativeChunk *chunk) {
     const size_t atomSize = sizeof(NativeAbsoluteAtomV1);
     size_t atomsArraySize = chunk->elementCount * atomSize;
     uint8_t* atomsStart = reinterpret_cast<uint8_t*>
@@ -476,8 +476,8 @@
  
   
   // instantiate array of Referemces from v1 ivar data in file
-  llvm::error_code processReferencesV1(const uint8_t* base, 
-                                                const NativeChunk* chunk) {
+  error_code processReferencesV1(const uint8_t *base,
+                                 const NativeChunk *chunk) {
     if ( chunk->elementCount == 0 )
       return make_error_code(native_reader_error::success);
     const size_t refSize = sizeof(NativeReferenceV1);
@@ -508,8 +508,8 @@
   }
   
   // set up pointers to target table
-  llvm::error_code processTargetsTable(const uint8_t* base, 
-                                                const NativeChunk* chunk) {
+  error_code processTargetsTable(const uint8_t *base,
+                                 const NativeChunk *chunk) {
     const uint32_t* targetIndexes = reinterpret_cast<const uint32_t*>
                                                   (base + chunk->fileOffset);
     this->_targetsTableCount = chunk->elementCount;
@@ -553,8 +553,8 @@
   
   
   // set up pointers to addend pool in file
-  llvm::error_code processAddendsTable(const uint8_t* base, 
-                                                const NativeChunk* chunk) {
+  error_code processAddendsTable(const uint8_t *base,
+                                 const NativeChunk *chunk) {
     this->_addends = reinterpret_cast<const Reference::Addend*>
                                                   (base + chunk->fileOffset);
     this->_addendsMaxIndex = chunk->elementCount;
@@ -562,24 +562,24 @@
   }
   
   // set up pointers to string pool in file
-  llvm::error_code processStrings(const uint8_t* base, 
-                                                const NativeChunk* chunk) {
+  error_code processStrings(const uint8_t *base,
+                            const NativeChunk *chunk) {
     this->_strings = reinterpret_cast<const char*>(base + chunk->fileOffset);
     this->_stringsMaxOffset = chunk->fileSize;
     return make_error_code(native_reader_error::success);
   }
   
   // set up pointers to content area in file
-  llvm::error_code processContent(const uint8_t* base, 
-                                                const NativeChunk* chunk) {
+  error_code processContent(const uint8_t *base,
+                            const NativeChunk *chunk) {
     this->_contentStart = base + chunk->fileOffset;
     this->_contentEnd = base + chunk->fileOffset + chunk->fileSize;
     return make_error_code(native_reader_error::success);
   }
   
-  llvm::StringRef string(uint32_t offset) const {
+  StringRef string(uint32_t offset) const {
     assert(offset < _stringsMaxOffset);
-    return llvm::StringRef(&_strings[offset]);
+    return StringRef(&_strings[offset]);
   }
   
   Reference::Addend addend(uint32_t index) const {
@@ -618,8 +618,8 @@
  
   
   // private constructor, only called by make()
-  NativeFile(std::unique_ptr<llvm::MemoryBuffer> mb, llvm::StringRef path) :
-    lld::File(path), 
+  NativeFile(std::unique_ptr<llvm::MemoryBuffer> mb, StringRef path) :
+    File(path),
     _buffer(std::move(mb)),  // NativeFile now takes ownership of buffer
     _header(nullptr),
     _targetsTable(nullptr),
@@ -704,7 +704,7 @@
   return p - _file->_definedAtoms._arrayStart;
 }
 
-inline llvm::StringRef NativeDefinedAtomV1::name() const {
+inline StringRef NativeDefinedAtomV1::name() const {
   return _file->string(_ivarData->nameOffset);
 }
 
@@ -712,15 +712,15 @@
   return _file->attribute(_ivarData->attributesOffset);
 }
 
-inline llvm::ArrayRef<uint8_t> NativeDefinedAtomV1::rawContent() const {
+inline ArrayRef<uint8_t> NativeDefinedAtomV1::rawContent() const {
   if ( this->contentType() == DefinedAtom::typeZeroFill )
-    return llvm::ArrayRef<uint8_t>();
+    return ArrayRef<uint8_t>();
   const uint8_t* p = _file->content(_ivarData->contentOffset,
                                     _ivarData->contentSize);
-   return llvm::ArrayRef<uint8_t>(p, _ivarData->contentSize);
+   return ArrayRef<uint8_t>(p, _ivarData->contentSize);
 }
 
-inline llvm::StringRef NativeDefinedAtomV1::customSectionName() const {
+inline StringRef NativeDefinedAtomV1::customSectionName() const {
   uint32_t offset = attributes().sectionNameOffset;
   return _file->string(offset);
 }
@@ -752,7 +752,7 @@
   return *_file;
 }
 
-inline llvm::StringRef NativeUndefinedAtomV1::name() const {
+inline StringRef NativeUndefinedAtomV1::name() const {
   return _file->string(_ivarData->nameOffset);
 }
 
@@ -763,11 +763,11 @@
   return *_file;
 }
 
-inline llvm::StringRef NativeSharedLibraryAtomV1::name() const {
+inline StringRef NativeSharedLibraryAtomV1::name() const {
   return _file->string(_ivarData->nameOffset);
 }
 
-inline llvm::StringRef NativeSharedLibraryAtomV1::loadName() const {
+inline StringRef NativeSharedLibraryAtomV1::loadName() const {
   return _file->string(_ivarData->loadNameOffset);
 }
 
@@ -777,7 +777,7 @@
   return *_file;
 }
 
-inline llvm::StringRef NativeAbsoluteAtomV1::name() const {
+inline StringRef NativeAbsoluteAtomV1::name() const {
   return _file->string(_ivarData->nameOffset);
 }
 
@@ -803,9 +803,9 @@
 //
 // Instantiate an lld::File from the given native object file buffer
 //
-llvm::error_code parseNativeObjectFile(std::unique_ptr<llvm::MemoryBuffer> mb,
-                                       llvm::StringRef path,
-                                       std::unique_ptr<File> &result) {
+error_code parseNativeObjectFile(std::unique_ptr<llvm::MemoryBuffer> mb,
+                                 StringRef path,
+                                 std::unique_ptr<File> &result) {
   return NativeFile::make(std::move(mb), path, result);
 }
 
@@ -814,11 +814,11 @@
 //
 // Instantiate an lld::File from the given native object file path
 //
-llvm::error_code parseNativeObjectFileOrSTDIN(llvm::StringRef path,
-                                              std::unique_ptr<File>& result) {
-  llvm::OwningPtr<llvm::MemoryBuffer> mb;
-  llvm::error_code ec = llvm::MemoryBuffer::getFileOrSTDIN(path, mb);
-  if ( ec ) 
+error_code parseNativeObjectFileOrSTDIN(StringRef path,
+                                        std::unique_ptr<File>& result) {
+  OwningPtr<llvm::MemoryBuffer> mb;
+  error_code ec = llvm::MemoryBuffer::getFileOrSTDIN(path, mb);
+  if ( ec )
       return ec;
 
   return parseNativeObjectFile( std::unique_ptr<llvm::MemoryBuffer>(mb.take())

Modified: lld/trunk/lib/Core/NativeWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Core/NativeWriter.cpp?rev=153963&r1=153962&r2=153963&view=diff
==============================================================================
--- lld/trunk/lib/Core/NativeWriter.cpp (original)
+++ lld/trunk/lib/Core/NativeWriter.cpp Tue Apr  3 13:39:40 2012
@@ -58,7 +58,7 @@
   }
 
   // write the lld::File in native format to the specified stream
-  void write(llvm::raw_ostream& out) {
+  void write(raw_ostream &out) {
     assert( out.tell() == 0 );
     out.write((char*)_headerBuffer, _headerBufferSize);
     
@@ -323,7 +323,7 @@
   }
   
   // check if name is already in pool or append and return offset
-  uint32_t getSharedLibraryNameOffset(llvm::StringRef name) {
+  uint32_t getSharedLibraryNameOffset(StringRef name) {
     assert( ! name.empty() );
     // look to see if this library name was used by another atom
     for(NameToOffsetVector::iterator it = _sharedLibraryNames.begin(); 
@@ -338,7 +338,7 @@
   }
   
   // append atom name to string pool and return offset
-  uint32_t getNameOffset(llvm::StringRef name) {
+  uint32_t getNameOffset(StringRef name) {
     if ( name.empty() )
       return 0;
     uint32_t result = _stringPool.size();
@@ -352,7 +352,7 @@
     if ( atom.contentType() == DefinedAtom::typeZeroFill ) 
       return 0;
     uint32_t result = _contentPool.size();
-    llvm::ArrayRef<uint8_t> cont = atom.rawContent();
+    ArrayRef<uint8_t> cont = atom.rawContent();
     _contentPool.insert(_contentPool.end(), cont.begin(), cont.end());
     return result;
   }
@@ -377,7 +377,7 @@
     // if section based on content, then no custom section name available
     if ( atom.sectionChoice() == DefinedAtom::sectionBasedOnContent )
       return 0;
-    llvm::StringRef name = atom.customSectionName();
+    StringRef name = atom.customSectionName();
     assert( ! name.empty() );
     // look to see if this section name was used by another atom
     for(NameToOffsetVector::iterator it=_sectionNames.begin(); 
@@ -495,8 +495,8 @@
     return result;
   }
  
-  void writeAddendTable(llvm::raw_ostream& out) {
     // Build table of addends  
+  void writeAddendTable(raw_ostream &out) {
     uint32_t maxAddendIndex = _addendsTableIndex.size();
     std::vector<Reference::Addend> addends(maxAddendIndex);
     for (AddendToIndex::iterator it = _addendsTableIndex.begin(); 
@@ -510,7 +510,7 @@
     out.write((char*)&addends[0], maxAddendIndex*sizeof(Reference::Addend));
   }
 
-  typedef std::vector<std::pair<llvm::StringRef, uint32_t> > NameToOffsetVector;
+  typedef std::vector<std::pair<StringRef, uint32_t> > NameToOffsetVector;
 
   typedef llvm::DenseMap<const Atom*, uint32_t> TargetToIndex;
   typedef llvm::DenseMap<Reference::Addend, uint32_t> AddendToIndex;
@@ -542,18 +542,20 @@
 
 /// writeNativeObjectFile - writes the lld::File object in native object
 /// file format to the specified stream.
-int writeNativeObjectFile(const lld::File &file, llvm::raw_ostream &out) {
-  NativeWriter  writer(file);
+int writeNativeObjectFile(const File &file, raw_ostream &out) {
+  NativeWriter writer(file);
   writer.write(out);
   return 0;
 }
 
 /// writeNativeObjectFile - writes the lld::File object in native object
 /// file format to the specified file path.
-int writeNativeObjectFile(const lld::File& file, llvm::StringRef path) {
+int writeNativeObjectFile(const File &file, StringRef path) {
   std::string errorInfo;
-  llvm::raw_fd_ostream out(path.data(), errorInfo, llvm::raw_fd_ostream::F_Binary);
-  if ( !errorInfo.empty() )
+  llvm::raw_fd_ostream out( path.data()
+                          , errorInfo
+                          , llvm::raw_fd_ostream::F_Binary);
+  if (!errorInfo.empty())
     return -1;
   return writeNativeObjectFile(file, out);
 }

Modified: lld/trunk/lib/Core/Resolver.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Core/Resolver.cpp?rev=153963&r1=153962&r2=153963&view=diff
==============================================================================
--- lld/trunk/lib/Core/Resolver.cpp (original)
+++ lld/trunk/lib/Core/Resolver.cpp Tue Apr  3 13:39:40 2012
@@ -11,11 +11,11 @@
 #include "lld/Core/Atom.h"
 #include "lld/Core/File.h"
 #include "lld/Core/InputFiles.h"
+#include "lld/Core/LLVM.h"
 #include "lld/Core/Platform.h"
 #include "lld/Core/SymbolTable.h"
 #include "lld/Core/UndefinedAtom.h"
 
-#include "llvm/Support/Casting.h"
 #include "llvm/Support/raw_ostream.h"
 
 #include <algorithm>
@@ -34,7 +34,7 @@
     if ( _liveAtoms.count(atom) )
       return false;
    // don't remove if marked never-dead-strip
-    if (const DefinedAtom* defAtom = llvm::dyn_cast<DefinedAtom>(atom)) {
+    if (const DefinedAtom* defAtom = dyn_cast<DefinedAtom>(atom)) {
       if ( defAtom->deadStrip() == DefinedAtom::deadStripNever )
         return false;
     }
@@ -176,7 +176,7 @@
     _symbolTable.undefines(undefines);
     for (std::vector<const Atom *>::iterator it = undefines.begin();
          it != undefines.end(); ++it) {
-      llvm::StringRef undefName = (*it)->name();
+      StringRef undefName = (*it)->name();
       // load for previous undefine may also have loaded this undefine
       if (!_symbolTable.isDefined(undefName)) {
         _inputFiles.searchLibraries(undefName, true, true, false, *this);
@@ -195,7 +195,7 @@
       std::vector<const Atom *> tents;
       for (std::vector<const Atom *>::iterator ait = _atoms.begin();
            ait != _atoms.end(); ++ait) {
-        if (const DefinedAtom* defAtom = llvm::dyn_cast<DefinedAtom>(*ait)) {
+        if (const DefinedAtom* defAtom = dyn_cast<DefinedAtom>(*ait)) {
           if ( defAtom->merge() == DefinedAtom::mergeAsTentative )
             tents.push_back(defAtom);
         }
@@ -204,11 +204,10 @@
            dit != tents.end(); ++dit) {
         // load for previous tentative may also have loaded
         // this tentative, so check again
-        llvm::StringRef tentName = (*dit)->name();
+        StringRef tentName = (*dit)->name();
         const Atom *curAtom = _symbolTable.findByName(tentName);
         assert(curAtom != nullptr);
-        if (const DefinedAtom* curDefAtom =
-              llvm::dyn_cast<DefinedAtom>(curAtom)) {
+        if (const DefinedAtom* curDefAtom = dyn_cast<DefinedAtom>(curAtom)) {
           if (curDefAtom->merge() == DefinedAtom::mergeAsTentative )
             _inputFiles.searchLibraries(tentName, searchDylibs, 
                                         true, true, *this);
@@ -223,7 +222,7 @@
 // to the new defined atom
 void Resolver::updateReferences() {
   for (auto ait = _atoms.begin(); ait != _atoms.end(); ++ait) {
-    if (const DefinedAtom* defAtom = llvm::dyn_cast<DefinedAtom>(*ait)) {
+    if (const DefinedAtom* defAtom = dyn_cast<DefinedAtom>(*ait)) {
       for (auto rit=defAtom->referencesBegin(), end=defAtom->referencesEnd();
                                                         rit != end; ++rit) {
         const Reference* ref = *rit;
@@ -261,7 +260,7 @@
   WhyLiveBackChain thisChain;
   thisChain.previous = previous;
   thisChain.referer = &atom;
-  if ( const DefinedAtom* defAtom = llvm::dyn_cast<DefinedAtom>(&atom)) {
+  if ( const DefinedAtom* defAtom = dyn_cast<DefinedAtom>(&atom)) {
     for (auto rit=defAtom->referencesBegin(), end=defAtom->referencesEnd();
                                                         rit != end; ++rit) {
       const Reference* ref = *rit;
@@ -287,7 +286,7 @@
   // add -exported_symbols_list, -init, and -u entries to live roots
   for (Platform::UndefinesIterator uit = _platform.initialUndefinesBegin();
        uit != _platform.initialUndefinesEnd(); ++uit) {
-    llvm::StringRef sym = *uit;
+    StringRef sym = *uit;
     const Atom *symAtom = _symbolTable.findByName(sym);
     assert(symAtom->definition() != Atom::definitionUndefined);
     _deadStripRoots.insert(symAtom);
@@ -344,7 +343,7 @@
 void Resolver::checkDylibSymbolCollisions() {
   for (std::vector<const Atom *>::const_iterator it = _atoms.begin();
        it != _atoms.end(); ++it) {
-    const DefinedAtom* defAtom = llvm::dyn_cast<DefinedAtom>(*it);
+    const DefinedAtom* defAtom = dyn_cast<DefinedAtom>(*it);
     if (defAtom == nullptr)
       continue;
     if ( defAtom->merge() != DefinedAtom::mergeAsTentative ) 
@@ -359,7 +358,7 @@
 
 // get "main" atom for linkage unit
 const Atom *Resolver::entryPoint() {
-  llvm::StringRef symbolName = _platform.entryPointName();
+  StringRef symbolName = _platform.entryPointName();
   if (symbolName != nullptr)
     return _symbolTable.findByName(symbolName);
 
@@ -391,15 +390,14 @@
 }
 
 void Resolver::MergedFile::addAtom(const Atom& atom) {
-  if (const DefinedAtom* defAtom = llvm::dyn_cast<DefinedAtom>(&atom)) {
+  if (const DefinedAtom* defAtom = dyn_cast<DefinedAtom>(&atom)) {
     _definedAtoms._atoms.push_back(defAtom);
-  } else if (const UndefinedAtom* undefAtom =
-               llvm::dyn_cast<UndefinedAtom>(&atom)) {
+  } else if (const UndefinedAtom* undefAtom = dyn_cast<UndefinedAtom>(&atom)) {
     _undefinedAtoms._atoms.push_back(undefAtom);
   } else if (const SharedLibraryAtom* slAtom =
-               llvm::dyn_cast<SharedLibraryAtom>(&atom)) {
+               dyn_cast<SharedLibraryAtom>(&atom)) {
     _sharedLibraryAtoms._atoms.push_back(slAtom);
-  } else if (const AbsoluteAtom* abAtom = llvm::dyn_cast<AbsoluteAtom>(&atom)) {
+  } else if (const AbsoluteAtom* abAtom = dyn_cast<AbsoluteAtom>(&atom)) {
     _absoluteAtoms._atoms.push_back(abAtom);
   } else {
     assert(0 && "atom has unknown definition kind");

Modified: lld/trunk/lib/Core/SymbolTable.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Core/SymbolTable.cpp?rev=153963&r1=153962&r2=153963&view=diff
==============================================================================
--- lld/trunk/lib/Core/SymbolTable.cpp (original)
+++ lld/trunk/lib/Core/SymbolTable.cpp Tue Apr  3 13:39:40 2012
@@ -13,6 +13,7 @@
 #include "lld/Core/DefinedAtom.h"
 #include "lld/Core/File.h"
 #include "lld/Core/InputFiles.h"
+#include "lld/Core/LLVM.h"
 #include "lld/Core/Platform.h"
 #include "lld/Core/Resolver.h"
 #include "lld/Core/SharedLibraryAtom.h"
@@ -20,7 +21,6 @@
 
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/DenseMapInfo.h"
-#include "llvm/Support/Casting.h"
 #include "llvm/Support/ErrorHandling.h"
 
 #include <algorithm>
@@ -125,7 +125,7 @@
 
 
 void SymbolTable::addByName(const Atom & newAtom) {
-  llvm::StringRef name = newAtom.name();
+  StringRef name = newAtom.name();
   const Atom *existing = this->findByName(name);
   if (existing == nullptr) {
     // Name is not in symbol table yet, add it associate with this atom.
@@ -162,9 +162,9 @@
         break;
       case NCR_DupUndef: {
           const UndefinedAtom* existingUndef =
-            llvm::dyn_cast<UndefinedAtom>(existing);
+            dyn_cast<UndefinedAtom>(existing);
           const UndefinedAtom* newUndef =
-            llvm::dyn_cast<UndefinedAtom>(&newAtom);
+            dyn_cast<UndefinedAtom>(&newAtom);
           assert(existingUndef != nullptr);
           assert(newUndef != nullptr);
           if ( existingUndef->canBeNull() == newUndef->canBeNull() ) {
@@ -180,9 +180,9 @@
         break;
       case NCR_DupShLib: {
           const SharedLibraryAtom* existingShLib =
-            llvm::dyn_cast<SharedLibraryAtom>(existing);
+            dyn_cast<SharedLibraryAtom>(existing);
           const SharedLibraryAtom* newShLib =
-            llvm::dyn_cast<SharedLibraryAtom>(&newAtom);
+            dyn_cast<SharedLibraryAtom>(&newAtom);
           assert(existingShLib != nullptr);
           assert(newShLib != nullptr);
           if ( (existingShLib->canBeNullAtRuntime() 
@@ -217,7 +217,7 @@
 unsigned SymbolTable::AtomMappingInfo::getHashValue(const DefinedAtom * const atom) {
   unsigned hash = atom->size();
   if ( atom->contentType() != DefinedAtom::typeZeroFill ) {
-    llvm::ArrayRef<uint8_t> content = atom->rawContent();
+    ArrayRef<uint8_t> content = atom->rawContent();
     for (unsigned int i=0; i < content.size(); ++i) {
       hash = hash * 33 + content[i];
     }
@@ -241,13 +241,13 @@
     return false;
   if ( r == getTombstoneKey() )
     return false;
-    
+
   if ( l->contentType() != r->contentType() )
     return false;
   if ( l->size() != r->size() )
     return false;
-  llvm::ArrayRef<uint8_t> lc = l->rawContent();
-  llvm::ArrayRef<uint8_t> rc = r->rawContent();
+  ArrayRef<uint8_t> lc = l->rawContent();
+  ArrayRef<uint8_t> rc = r->rawContent();
   return lc.equals(rc);
 }
 
@@ -265,14 +265,14 @@
 
 
 
-const Atom *SymbolTable::findByName(llvm::StringRef sym) {
+const Atom *SymbolTable::findByName(StringRef sym) {
   NameToAtom::iterator pos = _nameTable.find(sym);
   if (pos == _nameTable.end())
     return nullptr;
   return pos->second;
 }
 
-bool SymbolTable::isDefined(llvm::StringRef sym) {
+bool SymbolTable::isDefined(StringRef sym) {
   const Atom *atom = this->findByName(sym);
   if (atom == nullptr)
     return false;

Modified: lld/trunk/lib/Core/YamlReader.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Core/YamlReader.cpp?rev=153963&r1=153962&r2=153963&view=diff
==============================================================================
--- lld/trunk/lib/Core/YamlReader.cpp (original)
+++ lld/trunk/lib/Core/YamlReader.cpp Tue Apr  3 13:39:40 2012
@@ -13,6 +13,7 @@
 #include "lld/Core/AbsoluteAtom.h"
 #include "lld/Core/Error.h"
 #include "lld/Core/File.h"
+#include "lld/Core/LLVM.h"
 #include "lld/Core/Platform.h"
 #include "lld/Core/Reference.h"
 #include "lld/Core/SharedLibraryAtom.h"
@@ -385,9 +386,9 @@
     return _file;
   }
 
-  virtual llvm::StringRef name() const {
+  virtual StringRef name() const {
     if (_name == nullptr)
-      return llvm::StringRef();
+      return StringRef();
     else
       return _name;
   }
@@ -420,7 +421,7 @@
     return _sectionChoice;
   }
 
-  virtual llvm::StringRef customSectionName() const {
+  virtual StringRef customSectionName() const {
     return _sectionName;
   }
     
@@ -440,11 +441,11 @@
     return _isAlias;
   }
   
- llvm::ArrayRef<uint8_t> rawContent() const {
+ ArrayRef<uint8_t> rawContent() const {
     if (_content != nullptr)
-      return llvm::ArrayRef<uint8_t>(*_content);
+      return ArrayRef<uint8_t>(*_content);
     else
-      return llvm::ArrayRef<uint8_t>();
+      return ArrayRef<uint8_t>();
   }
  
   virtual uint64_t ordinal() const {
@@ -519,7 +520,7 @@
     return _file;
   }
 
-  virtual llvm::StringRef name() const {
+  virtual StringRef name() const {
     return _name;
   }
 
@@ -548,11 +549,11 @@
     return _file;
   }
 
-  virtual llvm::StringRef name() const {
+  virtual StringRef name() const {
     return _name;
   }
 
-  virtual llvm::StringRef loadName() const {
+  virtual StringRef loadName() const {
     return _loadName;
   }
 
@@ -580,7 +581,7 @@
     return _file;
   }
 
-  virtual llvm::StringRef name() const {
+  virtual StringRef name() const {
     return _name;
   }
 
@@ -765,12 +766,12 @@
 }
 
 void YAMLAtomState::setAlign2(const char *s) {
-  if (llvm::StringRef(s).getAsInteger(10, _alignment.powerOf2))
+  if (StringRef(s).getAsInteger(10, _alignment.powerOf2))
     _alignment.powerOf2 = 1;
 }
 
 void YAMLAtomState::setFixupKind(const char *s) {
-  _ref._kind = _platform.kindFromString(llvm::StringRef(s));
+  _ref._kind = _platform.kindFromString(StringRef(s));
 }
 
 void YAMLAtomState::setFixupTarget(const char *s) {
@@ -797,9 +798,9 @@
 
 /// parseObjectText - Parse the specified YAML formatted MemoryBuffer
 /// into lld::File object(s) and append each to the specified vector<File*>.
-llvm::error_code parseObjectText( llvm::MemoryBuffer *mb
-                                , Platform& platform
-                                , std::vector<const File *> &result) {
+error_code parseObjectText( llvm::MemoryBuffer *mb
+                          , Platform& platform
+                          , std::vector<const File *> &result) {
   std::vector<const YAML::Entry *> entries;
   YAML::parse(mb, entries);
 
@@ -912,7 +913,7 @@
           haveAtom = true;
         } 
         else if (strcmp(entry->key, KeyValues::sizeKeyword) == 0) {
-          llvm::StringRef val = entry->value;
+          StringRef val = entry->value;
           if (val.getAsInteger(0, atomState._size))
             return make_error_code(yaml_reader_error::illegal_value);
           haveAtom = true;
@@ -934,7 +935,7 @@
         }
         else if (strcmp(entry->key, KeyValues::valueKeyword) == 0) {
           llvm::APInt Val;
-          llvm::StringRef(entry->value).getAsInteger(0, Val);
+          StringRef(entry->value).getAsInteger(0, Val);
           atomState._value = Val.getZExtValue();
           haveAtom = true;
         }
@@ -954,7 +955,7 @@
           haveFixup = true;
         } 
         else if (strcmp(entry->key, KeyValues::fixupsOffsetKeyword) == 0) {
-          if (llvm::StringRef(entry->value).getAsInteger(0,
+          if (StringRef(entry->value).getAsInteger(0,
                atomState._ref._offsetInAtom))
             return make_error_code(yaml_reader_error::illegal_value);
           haveFixup = true;
@@ -964,7 +965,7 @@
           haveFixup = true;
         }
         else if (strcmp(entry->key, KeyValues::fixupsAddendKeyword) == 0) {
-          llvm::StringRef Addend(entry->value);
+          StringRef Addend(entry->value);
           if (Addend.getAsInteger(0, atomState._ref._addend))
             return make_error_code(yaml_reader_error::illegal_value);
           haveFixup = true;
@@ -987,17 +988,15 @@
 //
 // Fill in vector<File*> from path to input text file.
 //
-llvm::error_code parseObjectTextFileOrSTDIN(llvm::StringRef path
-                                          , Platform&  platform
-                                          , std::vector<const File*>& result) {
-  llvm::OwningPtr<llvm::MemoryBuffer> mb;
-  llvm::error_code ec = llvm::MemoryBuffer::getFileOrSTDIN(path, mb);
-  if ( ec ) 
-      return ec;
-      
+error_code parseObjectTextFileOrSTDIN( StringRef path
+                                     , Platform&  platform
+                                     , std::vector<const File*>& result) {
+  OwningPtr<llvm::MemoryBuffer> mb;
+  if (error_code ec = llvm::MemoryBuffer::getFileOrSTDIN(path, mb))
+    return ec;
+
   return parseObjectText(mb.get(), platform, result);
 }
 
-
 } // namespace yaml
 } // namespace lld

Modified: lld/trunk/lib/Core/YamlWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Core/YamlWriter.cpp?rev=153963&r1=153962&r2=153963&view=diff
==============================================================================
--- lld/trunk/lib/Core/YamlWriter.cpp (original)
+++ lld/trunk/lib/Core/YamlWriter.cpp Tue Apr  3 13:39:40 2012
@@ -115,7 +115,7 @@
      return _refNames.count(atom);
   }
   
-  llvm::StringRef refName(const Atom* atom) {
+  StringRef refName(const Atom *atom) {
      return _refNames.find(atom)->second;
   }
   
@@ -139,7 +139,7 @@
     : _file(file), _platform(platform), _rnb(rnb), _firstAtom(true) { }
 
 
-  void write(llvm::raw_ostream& out) {
+  void write(raw_ostream &out) {
     // write header 
     out << "---\n";
     
@@ -169,7 +169,7 @@
   }
 
   
-  void writeDefinedAtom(const DefinedAtom &atom, llvm::raw_ostream& out) {
+  void writeDefinedAtom(const DefinedAtom &atom, raw_ostream &out) {
     if ( _firstAtom ) {
       out << "atoms:\n";
       _firstAtom = false;
@@ -297,7 +297,7 @@
             << ":"
             << spacePadding(KeyValues::contentKeyword)
             << "[ ";
-      llvm::ArrayRef<uint8_t> arr = atom.rawContent();
+      ArrayRef<uint8_t> arr = atom.rawContent();
       bool needComma = false;
       for (unsigned int i=0; i < arr.size(); ++i) {
         if ( needComma )
@@ -334,7 +334,7 @@
             << "\n";
       const Atom* target = ref->target();
       if (target != nullptr) {
-        llvm::StringRef refName = target->name();
+        StringRef refName = target->name();
         if ( _rnb.hasRefName(target) )
           refName = _rnb.refName(target);
         assert(!refName.empty());
@@ -357,7 +357,7 @@
   }
     
 
-  void writeUndefinedAtom(const UndefinedAtom &atom, llvm::raw_ostream& out) {
+  void writeUndefinedAtom(const UndefinedAtom &atom, raw_ostream &out) {
     if ( _firstAtom ) {
       out  << "atoms:\n";
       _firstAtom = false;
@@ -391,7 +391,7 @@
     }
   }
 
-  void writeSharedLibraryAtom(const SharedLibraryAtom& atom, llvm::raw_ostream& out) {
+  void writeSharedLibraryAtom(const SharedLibraryAtom &atom, raw_ostream &out) {
     if ( _firstAtom ) {
       out  << "atoms:\n";
       _firstAtom = false;
@@ -434,7 +434,7 @@
     }
    }
    
-  void writeAbsoluteAtom(const AbsoluteAtom& atom, llvm::raw_ostream& out) {
+  void writeAbsoluteAtom(const AbsoluteAtom &atom, raw_ostream &out) {
      if ( _firstAtom ) {
       out << "atoms:\n";
       _firstAtom = false;
@@ -497,8 +497,7 @@
 /// writeObjectText - writes the lld::File object as in YAML
 /// format to the specified stream.
 ///
-void writeObjectText(const File& file, Platform& platform, 
-                      llvm::raw_ostream &out) {
+void writeObjectText(const File &file, Platform &platform, raw_ostream &out) {
   // Figure what ref-name labels are needed
   RefNameBuilder rnb(file);
   

Modified: lld/trunk/lib/Passes/GOTPass.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Passes/GOTPass.cpp?rev=153963&r1=153962&r2=153963&view=diff
==============================================================================
--- lld/trunk/lib/Passes/GOTPass.cpp (original)
+++ lld/trunk/lib/Passes/GOTPass.cpp Tue Apr  3 13:39:40 2012
@@ -33,12 +33,12 @@
 
 #include "lld/Core/DefinedAtom.h"
 #include "lld/Core/File.h"
+#include "lld/Core/LLVM.h"
 #include "lld/Core/Pass.h"
 #include "lld/Core/Platform.h"
 #include "lld/Core/Reference.h"
 
 #include "llvm/ADT/DenseMap.h"
-#include "llvm/Support/Casting.h"
 
 namespace lld {
 
@@ -58,7 +58,7 @@
       if ( _platform.isGOTAccess(ref->kind(), canBypassGOT) ) {
         const Atom* target = ref->target();
         assert(target != nullptr);
-        const DefinedAtom* defTarget = llvm::dyn_cast<DefinedAtom>(target);
+        const DefinedAtom* defTarget = dyn_cast<DefinedAtom>(target);
         bool replaceTargetWithGOTAtom = false;
         if ( target->definition() == Atom::definitionSharedLibrary ) {
           // Accesses to shared library symbols must go through GOT.

Modified: lld/trunk/lib/Passes/StubsPass.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Passes/StubsPass.cpp?rev=153963&r1=153962&r2=153963&view=diff
==============================================================================
--- lld/trunk/lib/Passes/StubsPass.cpp (original)
+++ lld/trunk/lib/Passes/StubsPass.cpp Tue Apr  3 13:39:40 2012
@@ -16,12 +16,12 @@
 
 #include "lld/Core/DefinedAtom.h"
 #include "lld/Core/File.h"
+#include "lld/Core/LLVM.h"
 #include "lld/Core/Pass.h"
 #include "lld/Core/Platform.h"
 #include "lld/Core/Reference.h"
 
 #include "llvm/ADT/DenseMap.h"
-#include "llvm/Support/Casting.h"
 
 namespace lld {
 
@@ -49,7 +49,7 @@
           // Calls to shared libraries go through stubs.
           replaceCalleeWithStub = true;
         } else if (const DefinedAtom* defTarget =
-                     llvm::dyn_cast<DefinedAtom>(target)) {
+                     dyn_cast<DefinedAtom>(target)) {
           if ( defTarget->interposable() != DefinedAtom::interposeNo ) {
             // Calls to interposable functions in same linkage unit 
             // must also go through a stub.

Modified: lld/trunk/tools/lld-core/lld-core.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/tools/lld-core/lld-core.cpp?rev=153963&r1=153962&r2=153963&view=diff
==============================================================================
--- lld/trunk/tools/lld-core/lld-core.cpp (original)
+++ lld/trunk/tools/lld-core/lld-core.cpp Tue Apr  3 13:39:40 2012
@@ -8,6 +8,7 @@
 //===----------------------------------------------------------------------===//
 
 #include "lld/Core/Atom.h"
+#include "lld/Core/LLVM.h"
 #include "lld/Core/NativeReader.h"
 #include "lld/Core/NativeWriter.h"
 #include "lld/Core/Pass.h"
@@ -29,11 +30,11 @@
 
 using namespace lld;
 
-static void error(llvm::Twine message) {
+static void error(Twine message) {
   llvm::errs() << "lld-core: " << message << ".\n";
 }
 
-static bool error(llvm::error_code ec) {
+static bool error(error_code ec) {
   if (ec) {
     error(ec.message());
     return true;
@@ -59,8 +60,8 @@
     return _file;
   }
 
-  virtual llvm::StringRef name() const {
-    return llvm::StringRef();
+  virtual StringRef name() const {
+    return StringRef();
   }
   
   virtual uint64_t ordinal() const {
@@ -95,8 +96,8 @@
     return DefinedAtom::sectionBasedOnContent;
   }
     
-  virtual llvm::StringRef customSectionName() const {
-    return llvm::StringRef();
+  virtual StringRef customSectionName() const {
+    return StringRef();
   }
   virtual DeadStripKind deadStrip() const {
     return DefinedAtom::deadStripNormal;
@@ -114,8 +115,8 @@
     return false;
   }
   
-  virtual llvm::ArrayRef<uint8_t> rawContent() const {
-    return llvm::ArrayRef<uint8_t>();
+  virtual ArrayRef<uint8_t> rawContent() const {
+    return ArrayRef<uint8_t>();
   }
   
   virtual reference_iterator referencesBegin() const {
@@ -158,8 +159,8 @@
     return _file;
   }
 
-  virtual llvm::StringRef name() const {
-    return llvm::StringRef();
+  virtual StringRef name() const {
+    return StringRef();
   }
   
   virtual uint64_t ordinal() const {
@@ -194,8 +195,8 @@
     return DefinedAtom::sectionBasedOnContent;
   }
     
-  virtual llvm::StringRef customSectionName() const {
-    return llvm::StringRef();
+  virtual StringRef customSectionName() const {
+    return StringRef();
   }
   virtual DeadStripKind deadStrip() const {
     return DefinedAtom::deadStripNormal;
@@ -213,8 +214,8 @@
     return false;
   }
   
-  virtual llvm::ArrayRef<uint8_t> rawContent() const {
-    return llvm::ArrayRef<uint8_t>();
+  virtual ArrayRef<uint8_t> rawContent() const {
+    return ArrayRef<uint8_t>();
   }
   
   virtual reference_iterator referencesBegin() const {
@@ -263,7 +264,7 @@
   }
 
   // give platform a chance to resolve platform-specific undefs
-  virtual bool getPlatformAtoms(llvm::StringRef undefined,
+  virtual bool getPlatformAtoms(StringRef undefined,
                                 std::vector<const DefinedAtom *>&) {
     return false;
   }
@@ -284,12 +285,12 @@
   }
 
   // return entry point for output file (e.g. "main") or nullptr
-  virtual llvm::StringRef entryPointName() {
+  virtual StringRef entryPointName() {
     return nullptr;
   }
 
   // for iterating must-be-defined symbols ("main" or -u command line option)
-  typedef llvm::StringRef const *UndefinesIterator;
+  typedef StringRef const *UndefinesIterator;
   virtual UndefinesIterator initialUndefinesBegin() const {
     return nullptr;
   }
@@ -307,19 +308,19 @@
   }
 
   // if platform allows symbol to remain undefined (e.g. -r)
-  virtual bool allowUndefinedSymbol(llvm::StringRef name) {
+  virtual bool allowUndefinedSymbol(StringRef name) {
     return true;
   }
 
   // for debugging dead code stripping, -why_live
-  virtual bool printWhyLive(llvm::StringRef name) {
+  virtual bool printWhyLive(StringRef name) {
     return false;
   }
 
-  virtual const Atom& handleMultipleDefinitions(const Atom& def1, 
+  virtual const Atom& handleMultipleDefinitions(const Atom& def1,
                                                 const Atom& def2) {
     llvm::report_fatal_error("symbol '" 
-                            + llvm::Twine(def1.name()) 
+                            + Twine(def1.name())
                             + "' multiply defined");
   }
 
@@ -352,7 +353,7 @@
 
   static const KindMapping _s_kindMappings[]; 
   
-  virtual Reference::Kind kindFromString(llvm::StringRef kindName) {
+  virtual Reference::Kind kindFromString(StringRef kindName) {
     for (const KindMapping* p = _s_kindMappings; p->string != nullptr; ++p) {
       if ( kindName.equals(p->string) )
         return p->value;
@@ -363,12 +364,12 @@
     return k;
   }
   
-  virtual llvm::StringRef kindToString(Reference::Kind value) {
+  virtual StringRef kindToString(Reference::Kind value) {
     for (const KindMapping* p = _s_kindMappings; p->string != nullptr; ++p) {
       if ( value == p->value)
         return p->string;
     }
-    return llvm::StringRef("???");
+    return StringRef("???");
   }
 
   virtual bool noTextRelocs() {
@@ -459,7 +460,7 @@
     }
   }
 
-  virtual bool searchLibraries(llvm::StringRef name, bool searchDylibs,
+  virtual bool searchLibraries(StringRef name, bool searchDylibs,
                                bool searchArchives, bool dataSymbolOnly,
                                InputFiles::Handler &) const {
     return false;
@@ -539,7 +540,7 @@
 
   // make unique temp .o file to put generated object file
   int fd;
-  llvm::SmallString<128> tempPath;
+  SmallString<128> tempPath;
   llvm::sys::fs::unique_file("temp%%%%%.o", fd, tempPath);
   llvm::raw_fd_ostream  binaryOut(fd, /*shouldClose=*/true);
   





More information about the llvm-commits mailing list