Add a SymbolRef::getValue.
[oota-llvm.git] / include / llvm / Object / SymbolicFile.h
index 24908cde193e35b499a542928a5a393537ae2cde..3a3823159c92c93df33b9c9ba41cb84328cb1f8b 100644 (file)
@@ -11,8 +11,8 @@
 //
 //===----------------------------------------------------------------------===//
 
-#ifndef LLVM_OBJECT_SYMBOLIC_FILE_H
-#define LLVM_OBJECT_SYMBOLIC_FILE_H
+#ifndef LLVM_OBJECT_SYMBOLICFILE_H
+#define LLVM_OBJECT_SYMBOLICFILE_H
 
 #include "llvm/Object/Binary.h"
 
@@ -45,7 +45,9 @@ inline bool operator<(const DataRefImpl &a, const DataRefImpl &b) {
   return std::memcmp(&a, &b, sizeof(DataRefImpl)) < 0;
 }
 
-template <class content_type> class content_iterator {
+template <class content_type>
+class content_iterator
+    : public std::iterator<std::forward_iterator_tag, content_type> {
   content_type Current;
 
 public:
@@ -87,8 +89,11 @@ public:
     SF_Absolute = 1U << 3,       // Absolute symbol
     SF_Common = 1U << 4,         // Symbol has common linkage
     SF_Indirect = 1U << 5,       // Symbol is an alias to another symbol
-    SF_FormatSpecific = 1U << 6  // Specific to the object file format
+    SF_Exported = 1U << 6,       // Symbol is visible to other DSOs
+    SF_FormatSpecific = 1U << 7, // Specific to the object file format
                                  // (e.g. section symbols)
+    SF_Thumb = 1U << 8,          // Thumb symbol in a 32-bit ARM binary
+    SF_Hidden = 1U << 9,         // Symbol has hidden visibility
   };
 
   BasicSymbolRef() : OwningObject(nullptr) { }
@@ -110,12 +115,12 @@ public:
 
 typedef content_iterator<BasicSymbolRef> basic_symbol_iterator;
 
-const uint64_t UnknownAddressOrSize = ~0ULL;
+const uint64_t UnknownAddress = ~0ULL;
 
 class SymbolicFile : public Binary {
 public:
-  virtual ~SymbolicFile();
-  SymbolicFile(unsigned int Type, MemoryBuffer *Source);
+  ~SymbolicFile() override;
+  SymbolicFile(unsigned int Type, MemoryBufferRef Source);
 
   // virtual interface.
   virtual void moveSymbolNext(DataRefImpl &Symb) const = 0;
@@ -142,18 +147,16 @@ public:
   }
 
   // construction aux.
-  static ErrorOr<SymbolicFile *> createIRObjectFile(MemoryBuffer *Object,
-                                                    LLVMContext &Context);
+  static ErrorOr<std::unique_ptr<SymbolicFile>>
+  createSymbolicFile(MemoryBufferRef Object, sys::fs::file_magic Type,
+                     LLVMContext *Context);
 
-  static ErrorOr<SymbolicFile *>
-  createSymbolicFile(std::unique_ptr<MemoryBuffer> &Object,
-                     sys::fs::file_magic Type, LLVMContext *Context);
-
-  static ErrorOr<SymbolicFile *>
-  createSymbolicFile(std::unique_ptr<MemoryBuffer> &Object) {
+  static ErrorOr<std::unique_ptr<SymbolicFile>>
+  createSymbolicFile(MemoryBufferRef Object) {
     return createSymbolicFile(Object, sys::fs::file_magic::unknown, nullptr);
   }
-  static ErrorOr<SymbolicFile *> createSymbolicFile(StringRef ObjectPath);
+  static ErrorOr<OwningBinary<SymbolicFile>>
+  createSymbolicFile(StringRef ObjectPath);
 
   static inline bool classof(const Binary *v) {
     return v->isSymbolic();