Did my commit for the last patch for the .loc directory from the wrong place and
[oota-llvm.git] / include / llvm / Support / IRReader.h
index 50de73803cf9e9df68c56c065fa434a7d4d51dc1..a44da528acfc012b2ca6a55a51134c87fe1ff7fe 100644 (file)
@@ -30,15 +30,15 @@ namespace llvm {
   /// which does lazy deserialization of function bodies.  Otherwise, attempt to
   /// parse it as LLVM Assembly and return a fully populated Module. This
   /// function *always* takes ownership of the given MemoryBuffer.
-  inline Module *getIRModule(MemoryBuffer *Buffer,
-                             SMDiagnostic &Err,
-                             LLVMContext &Context) {
+  inline Module *getLazyIRModule(MemoryBuffer *Buffer,
+                                 SMDiagnostic &Err,
+                                 LLVMContext &Context) {
     if (isBitcode((const unsigned char *)Buffer->getBufferStart(),
                   (const unsigned char *)Buffer->getBufferEnd())) {
       std::string ErrMsg;
       Module *M = getLazyBitcodeModule(Buffer, Context, &ErrMsg);
       if (M == 0) {
-        Err = SMDiagnostic(Buffer->getBufferIdentifier(), -1, -1, ErrMsg, "");
+        Err = SMDiagnostic(Buffer->getBufferIdentifier(), ErrMsg);
         // ParseBitcodeFile does not take ownership of the Buffer in the
         // case of an error.
         delete Buffer;
@@ -53,18 +53,18 @@ namespace llvm {
   /// for it which does lazy deserialization of function bodies.  Otherwise,
   /// attempt to parse it as LLVM Assembly and return a fully populated
   /// Module.
-  inline Module *getIRFileModule(const std::string &Filename,
-                                 SMDiagnostic &Err,
-                                 LLVMContext &Context) {
+  inline Module *getLazyIRFileModule(const std::string &Filename,
+                                     SMDiagnostic &Err,
+                                     LLVMContext &Context) {
     std::string ErrMsg;
     MemoryBuffer *F = MemoryBuffer::getFileOrSTDIN(Filename.c_str(), &ErrMsg);
     if (F == 0) {
-      Err = SMDiagnostic(Filename, -1, -1,
-                         "Could not open input file '" + Filename + "'", "");
+      Err = SMDiagnostic(Filename, 
+                         "Could not open input file: " + ErrMsg);
       return 0;
     }
 
-    return getIRModule(F, Err, Context);
+    return getLazyIRModule(F, Err, Context);
   }
 
   /// If the given MemoryBuffer holds a bitcode image, return a Module
@@ -78,10 +78,10 @@ namespace llvm {
                   (const unsigned char *)Buffer->getBufferEnd())) {
       std::string ErrMsg;
       Module *M = ParseBitcodeFile(Buffer, Context, &ErrMsg);
+      if (M == 0)
+        Err = SMDiagnostic(Buffer->getBufferIdentifier(), ErrMsg);
       // ParseBitcodeFile does not take ownership of the Buffer.
       delete Buffer;
-      if (M == 0)
-        Err = SMDiagnostic(Buffer->getBufferIdentifier(), -1, -1, ErrMsg, "");
       return M;
     }
 
@@ -97,8 +97,8 @@ namespace llvm {
     std::string ErrMsg;
     MemoryBuffer *F = MemoryBuffer::getFileOrSTDIN(Filename.c_str(), &ErrMsg);
     if (F == 0) {
-      Err = SMDiagnostic(Filename, -1, -1,
-                         "Could not open input file '" + Filename + "'", "");
+      Err = SMDiagnostic(Filename, 
+                         "Could not open input file: " + ErrMsg);
       return 0;
     }