Avoid creating a redundant zero APInt.
[oota-llvm.git] / include / llvm / Bitcode / Archive.h
index 980bd074ef74c6113528dd6caf93310e79a30597..91684c62e231e8fd5976c51645cb8c72e32dc50b 100644 (file)
@@ -2,8 +2,8 @@
 //
 //                     The LLVM Compiler Infrastructure
 //
-// This file was developed by Reid Spencer and is distributed under the
-// University of Illinois Open Source License. See LICENSE.TXT for details.
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
 //
 #ifndef LLVM_BITCODE_ARCHIVE_H
 #define LLVM_BITCODE_ARCHIVE_H
 
-#include "llvm/ADT/ilist"
+#include "llvm/ADT/ilist.h"
 #include "llvm/System/Path.h"
-#include "llvm/System/MappedFile.h"
 #include <map>
 #include <set>
 #include <fstream>
 
 namespace llvm {
+  class MemoryBuffer;
 
 // Forward declare classes
 class ModuleProvider;      // From VMCore
@@ -198,7 +198,7 @@ class ArchiveMember {
   private:
     /// Used internally by the Archive class to construct an ArchiveMember.
     /// The contents of the ArchiveMember are filled out by the Archive class.
-    ArchiveMember(Archive *PAR);
+    explicit ArchiveMember(Archive *PAR);
 
     // So Archive can construct an ArchiveMember
     friend class llvm::Archive;
@@ -254,7 +254,7 @@ class Archive {
     inline reverse_iterator       rend  ()       { return members.rend();   }
     inline const_reverse_iterator rend  () const { return members.rend();   }
 
-    inline unsigned               size()   const { return members.size();   }
+    inline size_t                 size()   const { return members.size();   }
     inline bool                   empty()  const { return members.empty();  }
     inline const ArchiveMember&   front()  const { return members.front();  }
     inline       ArchiveMember&   front()        { return members.front();  }
@@ -461,8 +461,10 @@ class Archive {
   protected:
     /// @brief Construct an Archive for \p filename and optionally  map it
     /// into memory.
-    Archive(const sys::Path& filename);
+    explicit Archive(const sys::Path& filename);
 
+    /// @param data The symbol table data to be parsed
+    /// @param len  The length of the symbol table data
     /// @param error Set to address of a std::string to get error messages
     /// @returns false on error
     /// @brief Parse the symbol table at \p data.
@@ -476,17 +478,17 @@ class Archive {
       std::string* error ///< Optional error message catcher
     );
 
-    /// @param error Set to address of a std::string to get error messages
+    /// @param ErrMessage Set to address of a std::string to get error messages
     /// @returns false on error
     /// @brief Check that the archive signature is correct
     bool checkSignature(std::string* ErrMessage);
 
-    /// @param error Set to address of a std::string to get error messages
+    /// @param ErrMessage Set to address of a std::string to get error messages
     /// @returns false on error
     /// @brief Load the entire archive.
     bool loadArchive(std::string* ErrMessage);
 
-    /// @param error Set to address of a std::string to get error messages
+    /// @param ErrMessage Set to address of a std::string to get error messages
     /// @returns false on error
     /// @brief Load just the symbol table.
     bool loadSymbolTable(std::string* ErrMessage);
@@ -532,7 +534,7 @@ class Archive {
   protected:
     sys::Path archPath;       ///< Path to the archive file we read/write
     MembersList members;      ///< The ilist of ArchiveMember
-    sys::MappedFile* mapfile; ///< Raw Archive contents mapped into memory
+    MemoryBuffer *mapfile;    ///< Raw Archive contents mapped into memory
     const char* base;         ///< Base of the memory mapped file data
     SymTabType symTab;        ///< The symbol table
     std::string strtab;       ///< The string table for long file names