diff options
Diffstat (limited to 'llvm/lib')
| -rw-r--r-- | llvm/lib/Archive/Archive.cpp | 6 | ||||
| -rw-r--r-- | llvm/lib/Archive/ArchiveInternals.h | 4 | ||||
| -rw-r--r-- | llvm/lib/Archive/ArchiveReader.cpp | 5 | ||||
| -rw-r--r-- | llvm/lib/Archive/ArchiveWriter.cpp | 2 | ||||
| -rw-r--r-- | llvm/lib/AsmParser/Parser.cpp | 4 | ||||
| -rw-r--r-- | llvm/lib/Bitcode/Reader/BitReader.cpp | 4 | ||||
| -rw-r--r-- | llvm/lib/Bitcode/Reader/BitcodeReader.cpp | 4 | ||||
| -rw-r--r-- | llvm/lib/Bitcode/Reader/BitcodeReader.h | 4 | ||||
| -rw-r--r-- | llvm/lib/Debugger/Debugger.cpp | 5 | ||||
| -rw-r--r-- | llvm/lib/Linker/Linker.cpp | 2 | ||||
| -rw-r--r-- | llvm/lib/VMCore/Core.cpp | 2 | ||||
| -rw-r--r-- | llvm/lib/VMCore/LLVMContext.cpp | 4 | ||||
| -rw-r--r-- | llvm/lib/VMCore/Module.cpp | 2 | 
13 files changed, 25 insertions, 23 deletions
diff --git a/llvm/lib/Archive/Archive.cpp b/llvm/lib/Archive/Archive.cpp index e6903b607fb..1a8b25ace25 100644 --- a/llvm/lib/Archive/Archive.cpp +++ b/llvm/lib/Archive/Archive.cpp @@ -138,7 +138,7 @@ bool ArchiveMember::replaceWith(const sys::Path& newFile, std::string* ErrMsg) {  // Archive constructor - this is the only constructor that gets used for the  // Archive class. Everything else (default,copy) is deprecated. This just  // initializes and maps the file into memory, if requested. -Archive::Archive(const sys::Path& filename, LLVMContext* C) +Archive::Archive(const sys::Path& filename, const LLVMContext& C)    : archPath(filename), members(), mapfile(0), base(0), symTab(), strtab(),      symTabSize(0), firstFileOffset(0), modules(), foreignST(0), Context(C) {  } @@ -208,7 +208,7 @@ static void getSymbols(Module*M, std::vector<std::string>& symbols) {  // Get just the externally visible defined symbols from the bitcode  bool llvm::GetBitcodeSymbols(const sys::Path& fName, -                             LLVMContext* Context, +                             const LLVMContext& Context,                               std::vector<std::string>& symbols,                               std::string* ErrMsg) {    std::auto_ptr<MemoryBuffer> Buffer( @@ -240,7 +240,7 @@ bool llvm::GetBitcodeSymbols(const sys::Path& fName,  ModuleProvider*  llvm::GetBitcodeSymbols(const unsigned char *BufPtr, unsigned Length,                          const std::string& ModuleID, -                        LLVMContext* Context, +                        const LLVMContext& Context,                          std::vector<std::string>& symbols,                          std::string* ErrMsg) {    // Get the module provider diff --git a/llvm/lib/Archive/ArchiveInternals.h b/llvm/lib/Archive/ArchiveInternals.h index cdd8e35ca0d..15f01b3690e 100644 --- a/llvm/lib/Archive/ArchiveInternals.h +++ b/llvm/lib/Archive/ArchiveInternals.h @@ -73,13 +73,13 @@ namespace llvm {    // Get just the externally visible defined symbols from the bitcode    bool GetBitcodeSymbols(const sys::Path& fName, -                          LLVMContext* Context, +                          const LLVMContext& Context,                            std::vector<std::string>& symbols,                            std::string* ErrMsg);    ModuleProvider* GetBitcodeSymbols(const unsigned char*Buffer,unsigned Length,                                      const std::string& ModuleID, -                                    LLVMContext* Context, +                                    const LLVMContext& Context,                                      std::vector<std::string>& symbols,                                      std::string* ErrMsg);  } diff --git a/llvm/lib/Archive/ArchiveReader.cpp b/llvm/lib/Archive/ArchiveReader.cpp index 4e3e28166ca..2393554ede8 100644 --- a/llvm/lib/Archive/ArchiveReader.cpp +++ b/llvm/lib/Archive/ArchiveReader.cpp @@ -327,7 +327,7 @@ Archive::loadArchive(std::string* error) {  // Open and completely load the archive file.  Archive* -Archive::OpenAndLoad(const sys::Path& file, LLVMContext* C,  +Archive::OpenAndLoad(const sys::Path& file, const LLVMContext& C,                        std::string* ErrorMessage) {    std::auto_ptr<Archive> result ( new Archive(file, C));    if (result->mapToMemory(ErrorMessage)) @@ -441,7 +441,8 @@ Archive::loadSymbolTable(std::string* ErrorMsg) {  }  // Open the archive and load just the symbol tables -Archive* Archive::OpenAndLoadSymbols(const sys::Path& file, LLVMContext* C, +Archive* Archive::OpenAndLoadSymbols(const sys::Path& file, +                                     const LLVMContext& C,                                       std::string* ErrorMessage) {    std::auto_ptr<Archive> result ( new Archive(file, C) );    if (result->mapToMemory(ErrorMessage)) diff --git a/llvm/lib/Archive/ArchiveWriter.cpp b/llvm/lib/Archive/ArchiveWriter.cpp index 641e3324d63..e84035404bf 100644 --- a/llvm/lib/Archive/ArchiveWriter.cpp +++ b/llvm/lib/Archive/ArchiveWriter.cpp @@ -64,7 +64,7 @@ static inline unsigned numVbrBytes(unsigned num) {  }  // Create an empty archive. -Archive* Archive::CreateEmpty(const sys::Path& FilePath, LLVMContext* C) { +Archive* Archive::CreateEmpty(const sys::Path& FilePath, const LLVMContext& C) {    Archive* result = new Archive(FilePath, C);    return result;  } diff --git a/llvm/lib/AsmParser/Parser.cpp b/llvm/lib/AsmParser/Parser.cpp index 7759c70d73d..daf23fe748b 100644 --- a/llvm/lib/AsmParser/Parser.cpp +++ b/llvm/lib/AsmParser/Parser.cpp @@ -21,7 +21,7 @@  using namespace llvm;  Module *llvm::ParseAssemblyFile(const std::string &Filename, ParseError &Err, -                                LLVMContext* Context) { +                                const LLVMContext& Context) {    Err.setFilename(Filename);    std::string ErrorStr; @@ -39,7 +39,7 @@ Module *llvm::ParseAssemblyFile(const std::string &Filename, ParseError &Err,  }  Module *llvm::ParseAssemblyString(const char *AsmString, Module *M, -                                  ParseError &Err, LLVMContext* Context) { +                                  ParseError &Err, const LLVMContext& Context) {    Err.setFilename("<string>");    OwningPtr<MemoryBuffer> diff --git a/llvm/lib/Bitcode/Reader/BitReader.cpp b/llvm/lib/Bitcode/Reader/BitReader.cpp index 2baf71bb541..273975a59be 100644 --- a/llvm/lib/Bitcode/Reader/BitReader.cpp +++ b/llvm/lib/Bitcode/Reader/BitReader.cpp @@ -22,7 +22,7 @@ int LLVMParseBitcode(LLVMMemoryBufferRef MemBuf, LLVMContextRef ContextRef,                       LLVMModuleRef *OutModule, char **OutMessage) {    std::string Message; -  *OutModule = wrap(ParseBitcodeFile(unwrap(MemBuf), unwrap(ContextRef),   +  *OutModule = wrap(ParseBitcodeFile(unwrap(MemBuf), *unwrap(ContextRef),                                         &Message));    if (!*OutModule) {      if (OutMessage) @@ -42,7 +42,7 @@ int LLVMGetBitcodeModuleProvider(LLVMMemoryBufferRef MemBuf,                                   char **OutMessage) {    std::string Message; -  *OutMP = wrap(getBitcodeModuleProvider(unwrap(MemBuf), unwrap(ContextRef),  +  *OutMP = wrap(getBitcodeModuleProvider(unwrap(MemBuf), *unwrap(ContextRef),                                            &Message));    if (!*OutMP) {      if (OutMessage) diff --git a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp index 7cf03242990..ce33de04f7e 100644 --- a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp +++ b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp @@ -2090,7 +2090,7 @@ Module *BitcodeReader::releaseModule(std::string *ErrInfo) {  /// getBitcodeModuleProvider - lazy function-at-a-time loading from a file.  ///  ModuleProvider *llvm::getBitcodeModuleProvider(MemoryBuffer *Buffer, -                                               LLVMContext* Context, +                                               const LLVMContext& Context,                                                 std::string *ErrMsg) {    BitcodeReader *R = new BitcodeReader(Buffer, Context);    if (R->ParseBitcode()) { @@ -2107,7 +2107,7 @@ ModuleProvider *llvm::getBitcodeModuleProvider(MemoryBuffer *Buffer,  /// ParseBitcodeFile - Read the specified bitcode file, returning the module.  /// If an error occurs, return null and fill in *ErrMsg if non-null. -Module *llvm::ParseBitcodeFile(MemoryBuffer *Buffer, LLVMContext* Context,  +Module *llvm::ParseBitcodeFile(MemoryBuffer *Buffer, const LLVMContext& Context,                                  std::string *ErrMsg){    BitcodeReader *R;    R = static_cast<BitcodeReader*>(getBitcodeModuleProvider(Buffer, Context,  diff --git a/llvm/lib/Bitcode/Reader/BitcodeReader.h b/llvm/lib/Bitcode/Reader/BitcodeReader.h index 498a34ae01b..dd12375cc43 100644 --- a/llvm/lib/Bitcode/Reader/BitcodeReader.h +++ b/llvm/lib/Bitcode/Reader/BitcodeReader.h @@ -86,7 +86,7 @@ public:  };  class BitcodeReader : public ModuleProvider { -  LLVMContext* Context; +  const LLVMContext& Context;    MemoryBuffer *Buffer;    BitstreamReader StreamFile;    BitstreamCursor Stream; @@ -125,7 +125,7 @@ class BitcodeReader : public ModuleProvider {    /// stream) and what linkage the original function had.    DenseMap<Function*, std::pair<uint64_t, unsigned> > DeferredFunctionInfo;  public: -  explicit BitcodeReader(MemoryBuffer *buffer, LLVMContext* C) +  explicit BitcodeReader(MemoryBuffer *buffer, const LLVMContext& C)        : Context(C), Buffer(buffer), ErrorString(0) {      HasReversedFunctionsWithBodies = false;    } diff --git a/llvm/lib/Debugger/Debugger.cpp b/llvm/lib/Debugger/Debugger.cpp index dbfbbed1dc5..61d8358d08d 100644 --- a/llvm/lib/Debugger/Debugger.cpp +++ b/llvm/lib/Debugger/Debugger.cpp @@ -46,7 +46,8 @@ std::string Debugger::getProgramPath() const {  }  static Module * -getMaterializedModuleProvider(const std::string &Filename, LLVMContext* C) { +getMaterializedModuleProvider(const std::string &Filename, +                              const LLVMContext& C) {    std::auto_ptr<MemoryBuffer> Buffer;    Buffer.reset(MemoryBuffer::getFileOrSTDIN(Filename.c_str()));    if (Buffer.get()) @@ -58,7 +59,7 @@ getMaterializedModuleProvider(const std::string &Filename, LLVMContext* C) {  /// the PATH for the specified program, loading it when found.  If the  /// specified program cannot be found, an exception is thrown to indicate the  /// error. -void Debugger::loadProgram(const std::string &Filename, LLVMContext* C) { +void Debugger::loadProgram(const std::string &Filename, const LLVMContext& C) {    if ((Program = getMaterializedModuleProvider(Filename, C)) ||        (Program = getMaterializedModuleProvider(Filename+".bc", C)))      return;   // Successfully loaded the program. diff --git a/llvm/lib/Linker/Linker.cpp b/llvm/lib/Linker/Linker.cpp index d0d69d072c1..42d4e724db4 100644 --- a/llvm/lib/Linker/Linker.cpp +++ b/llvm/lib/Linker/Linker.cpp @@ -20,7 +20,7 @@  using namespace llvm;  Linker::Linker(const std::string& progname, const std::string& modname, -               LLVMContext* C, unsigned flags):  +               const LLVMContext& C, unsigned flags):     Context(C),    Composite(new Module(modname, C)),    LibPaths(), diff --git a/llvm/lib/VMCore/Core.cpp b/llvm/lib/VMCore/Core.cpp index 1c0a8f7af25..9f92e6f2949 100644 --- a/llvm/lib/VMCore/Core.cpp +++ b/llvm/lib/VMCore/Core.cpp @@ -53,7 +53,7 @@ void LLVMContextDispose(LLVMContextRef C) {  /*===-- Operations on modules ---------------------------------------------===*/  LLVMModuleRef LLVMModuleCreateWithName(const char *ModuleID, LLVMContextRef C) { -  return wrap(new Module(ModuleID, unwrap(C))); +  return wrap(new Module(ModuleID, *unwrap(C)));  }  void LLVMDisposeModule(LLVMModuleRef M) { diff --git a/llvm/lib/VMCore/LLVMContext.cpp b/llvm/lib/VMCore/LLVMContext.cpp index 09c7fcc8cf1..d29b758ea74 100644 --- a/llvm/lib/VMCore/LLVMContext.cpp +++ b/llvm/lib/VMCore/LLVMContext.cpp @@ -22,8 +22,8 @@ using namespace llvm;  static ManagedStatic<LLVMContext> GlobalContext; -LLVMContext* getGlobalContext() { -  return &*GlobalContext; +const LLVMContext& llvm::getGlobalContext() { +  return *GlobalContext;  }  LLVMContext::LLVMContext() : pImpl(new LLVMContextImpl()) { } diff --git a/llvm/lib/VMCore/Module.cpp b/llvm/lib/VMCore/Module.cpp index 96a25a5d0d2..5ccd7ccfa35 100644 --- a/llvm/lib/VMCore/Module.cpp +++ b/llvm/lib/VMCore/Module.cpp @@ -55,7 +55,7 @@ template class SymbolTableListTraits<GlobalAlias, Module>;  // Primitive Module methods.  // -Module::Module(const std::string &MID, LLVMContext* C) +Module::Module(const std::string &MID, const LLVMContext& C)    : Context(C), ModuleID(MID), DataLayout("")  {    ValSymTab = new ValueSymbolTable();    TypeSymTab = new TypeSymbolTable();  | 

