[llvm-commits] CVS: llvm/lib/Bytecode/Archive/ArchiveReader.cpp ArchiveWriter.cpp

Reid Spencer reid at x10sys.com
Fri Aug 25 10:43:31 PDT 2006



Changes in directory llvm/lib/Bytecode/Archive:

ArchiveReader.cpp updated: 1.46 -> 1.47
ArchiveWriter.cpp updated: 1.30 -> 1.31
---
Log message:

For PR797: http://llvm.org/PR797 :
Remove exception throwing/handling from lib/Bytecode, and adjust its users
to compensate for changes in the interface.


---
Diffs of the changes:  (+9 -6)

 ArchiveReader.cpp |   10 ++++++----
 ArchiveWriter.cpp |    5 +++--
 2 files changed, 9 insertions(+), 6 deletions(-)


Index: llvm/lib/Bytecode/Archive/ArchiveReader.cpp
diff -u llvm/lib/Bytecode/Archive/ArchiveReader.cpp:1.46 llvm/lib/Bytecode/Archive/ArchiveReader.cpp:1.47
--- llvm/lib/Bytecode/Archive/ArchiveReader.cpp:1.46	Thu Aug 24 18:45:08 2006
+++ llvm/lib/Bytecode/Archive/ArchiveReader.cpp	Fri Aug 25 12:43:11 2006
@@ -475,14 +475,16 @@
   const char* modptr = base + fileOffset;
   ArchiveMember* mbr = parseMemberHeader(modptr, base + mapfile->size(),ErrMsg);
   if (!mbr)
-    return false;
+    return 0;
 
   // Now, load the bytecode module to get the ModuleProvider
   std::string FullMemberName = archPath.toString() + "(" +
     mbr->getPath().toString() + ")";
   ModuleProvider* mp = getBytecodeBufferModuleProvider(
       (const unsigned char*) mbr->getData(), mbr->getSize(),
-      FullMemberName, 0);
+      FullMemberName, ErrMsg, 0);
+  if (!mp)
+    return 0;
 
   modules.insert(std::make_pair(fileOffset, std::make_pair(mp, mbr)));
 
@@ -523,7 +525,7 @@
         std::string FullMemberName = archPath.toString() + "(" +
           mbr->getPath().toString() + ")";
         ModuleProvider* MP = GetBytecodeSymbols((const unsigned char*)At,
-            mbr->getSize(), FullMemberName, symbols);
+            mbr->getSize(), FullMemberName, symbols, error);
 
         if (MP) {
           // Insert the module's symbols into the symbol table
@@ -537,7 +539,7 @@
         } else {
           if (error)
             *error = "Can't parse bytecode member: " + 
-              mbr->getPath().toString();
+              mbr->getPath().toString() + ": " + *error;
           delete mbr;
           return false;
         }


Index: llvm/lib/Bytecode/Archive/ArchiveWriter.cpp
diff -u llvm/lib/Bytecode/Archive/ArchiveWriter.cpp:1.30 llvm/lib/Bytecode/Archive/ArchiveWriter.cpp:1.31
--- llvm/lib/Bytecode/Archive/ArchiveWriter.cpp:1.30	Thu Aug 24 18:45:08 2006
+++ llvm/lib/Bytecode/Archive/ArchiveWriter.cpp	Fri Aug 25 12:43:11 2006
@@ -223,7 +223,7 @@
       member.getPath().toString()
       + ")";
     ModuleProvider* MP = GetBytecodeSymbols(
-      (const unsigned char*)data,fSize,FullMemberName, symbols);
+      (const unsigned char*)data,fSize,FullMemberName, symbols, ErrMsg);
 
     // If the bytecode parsed successfully
     if ( MP ) {
@@ -247,7 +247,8 @@
         delete mFile;
       }
       if (ErrMsg)
-        *ErrMsg = "Can't parse bytecode member: " + member.getPath().toString();
+        *ErrMsg = "Can't parse bytecode member: " + member.getPath().toString()
+          + ": " + *ErrMsg;
       return true;
     }
   }






More information about the llvm-commits mailing list