Add a pointer to the owning LLVMContext to Module. This requires threading LLVMContext through a lot
of the bitcode reader and ASM parser APIs, as well as supporting it in all of the tools.
Patches for Clang and LLVM-GCC to follow.
llvm-svn: 74614
diff --git a/llvm/include/llvm/Bitcode/Archive.h b/llvm/include/llvm/Bitcode/Archive.h
index a3631ac..c188df8 100644
--- a/llvm/include/llvm/Bitcode/Archive.h
+++ b/llvm/include/llvm/Bitcode/Archive.h
@@ -32,6 +32,7 @@
class Module; // From VMCore
class Archive; // Declared below
class ArchiveMemberHeader; // Internal implementation class
+class LLVMContext; // Global data
/// This class is the main class manipulated by users of the Archive class. It
/// holds information about one member of the Archive. It is also the element
@@ -278,7 +279,8 @@
/// @returns An Archive* that represents the new archive file.
/// @brief Create an empty Archive.
static Archive* CreateEmpty(
- const sys::Path& Filename ///< Name of the archive to (eventually) create.
+ const sys::Path& Filename,///< Name of the archive to (eventually) create.
+ LLVMContext* C ///< Context to use for global information
);
/// Open an existing archive and load its contents in preparation for
@@ -289,6 +291,7 @@
/// @brief Open and load an archive file
static Archive* OpenAndLoad(
const sys::Path& filePath, ///< The file path to open and load
+ LLVMContext* C, ///< The context to use for global information
std::string* ErrorMessage ///< An optional error string
);
@@ -310,6 +313,7 @@
/// @brief Open an existing archive and load its symbols.
static Archive* OpenAndLoadSymbols(
const sys::Path& Filename, ///< Name of the archive file to open
+ LLVMContext* C, ///< The context to use for global info
std::string* ErrorMessage=0 ///< An optional error string
);
@@ -449,7 +453,7 @@
protected:
/// @brief Construct an Archive for \p filename and optionally map it
/// into memory.
- explicit Archive(const sys::Path& filename);
+ explicit Archive(const sys::Path& filename, LLVMContext* C);
/// @param data The symbol table data to be parsed
/// @param len The length of the symbol table data
@@ -530,6 +534,7 @@
unsigned firstFileOffset; ///< Offset to first normal file.
ModuleMap modules; ///< The modules loaded via symbol lookup.
ArchiveMember* foreignST; ///< This holds the foreign symbol table.
+ LLVMContext* Context; ///< This holds global data.
/// @}
/// @name Hidden
/// @{