[PATCH] Update Clang to change in ReadAbbrevBlock API (bug 20485)

David Callahan dcallahan at fb.com
Thu Jan 15 12:53:54 PST 2015


Hi bogner,

Modified ReadAbbrevBlock to return "true'  when an error is identified (instead of crashing). Propagate that error appropriately

REPOSITORY
  rL LLVM

http://reviews.llvm.org/D7007

Files:
  lib/Frontend/SerializedDiagnosticReader.cpp
  lib/Serialization/ASTReader.cpp

Index: lib/Frontend/SerializedDiagnosticReader.cpp
===================================================================
--- lib/Frontend/SerializedDiagnosticReader.cpp
+++ lib/Frontend/SerializedDiagnosticReader.cpp
@@ -91,7 +91,8 @@
       return Cursor::BlockEnd;
 
     case llvm::bitc::DEFINE_ABBREV:
-      Stream.ReadAbbrevRecord();
+      if (Stream.ReadAbbrevRecord()) 
+        return SDError::InvalidDiagnostics;
       continue;
 
     case llvm::bitc::UNABBREV_RECORD:
Index: lib/Serialization/ASTReader.cpp
===================================================================
--- lib/Serialization/ASTReader.cpp
+++ lib/Serialization/ASTReader.cpp
@@ -1340,7 +1340,10 @@
       Cursor.JumpToBit(Offset);
       return false;
     }
-    Cursor.ReadAbbrevRecord();
+    if (Cursor.ReadAbbrevRecord()) {
+      Error("malformed abbrev record in AST file");
+      return Failure;
+    }
   }
 }
 
@@ -4262,7 +4265,8 @@
         InputFilesCursor.JumpToBit(Offset);
         break;
       }
-      InputFilesCursor.ReadAbbrevRecord();
+      if (InputFilesCursor.ReadAbbrevRecord())
+        return true;
     }
   }

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D7007.18248.patch
Type: text/x-patch
Size: 1128 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20150115/47b30ed2/attachment.bin>


More information about the cfe-commits mailing list