]> granicus.if.org Git - clang/commitdiff
Fix read of uninitialized enum value in test, caught by UBSan. No functionality
authorRichard Smith <richard-llvm@metafoo.co.uk>
Wed, 31 Jul 2013 00:26:46 +0000 (00:26 +0000)
committerRichard Smith <richard-llvm@metafoo.co.uk>
Wed, 31 Jul 2013 00:26:46 +0000 (00:26 +0000)
change, other than removal of undefined behavior.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@187465 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/Serialization/ASTReader.h
lib/Serialization/ASTReader.cpp
lib/Serialization/ASTReaderStmt.cpp

index 746850f40dc9506bcb2d4ba4ddf828d1db76b7ba..fff5cbca8578d425ef42a913fb0f0eb146785121 100644 (file)
@@ -916,7 +916,7 @@ private:
 
   /// \brief What kind of records we are reading.
   enum ReadingKind {
-    Read_Decl, Read_Type, Read_Stmt
+    Read_None, Read_Decl, Read_Type, Read_Stmt
   };
 
   /// \brief What kind of records we are reading.
index e2a57f3829470ffdb019886e1979cba06ccc7aa8..ec7051e7212f53be11b3655e1df84df53bee6008 100644 (file)
@@ -7498,7 +7498,7 @@ ASTReader::ASTReader(Preprocessor &PP, ASTContext &Context,
     NumVisibleDeclContextsRead(0), TotalVisibleDeclContexts(0),
     TotalModulesSizeInBits(0), NumCurrentElementsDeserializing(0),
     PassingDeclsToConsumer(false),
-    NumCXXBaseSpecifiersLoaded(0)
+    NumCXXBaseSpecifiersLoaded(0), ReadingKind(Read_None)
 {
   SourceMgr.setExternalSLocEntrySource(this);
 }
index ed07b0532f13c6663621bbb15efb27343568c5ee..8cf4bae8990ad3f1d2dea52dc3e44dafb1fcf39b 100644 (file)
@@ -1739,6 +1739,8 @@ void ASTStmtReader::VisitOMPParallelDirective(OMPParallelDirective *D) {
 
 Stmt *ASTReader::ReadStmt(ModuleFile &F) {
   switch (ReadingKind) {
+  case Read_None:
+    llvm_unreachable("should not call this when not reading anything");
   case Read_Decl:
   case Read_Type:
     return ReadStmtFromStream(F);