]> granicus.if.org Git - clang/commitdiff
Fixed bug in serialization of EnumConstantDecl where we improperly
authorTed Kremenek <kremenek@apple.com>
Wed, 14 Nov 2007 23:38:09 +0000 (23:38 +0000)
committerTed Kremenek <kremenek@apple.com>
Wed, 14 Nov 2007 23:38:09 +0000 (23:38 +0000)
"default constructed" an APSInt.  Fixed another bug in the same method
where we did not allow the NextDeclarator to be NULL.

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

AST/DeclSerialization.cpp

index 208e81ca0f927a9cfedc8c9f28730e724768a24b..4f80ca1bb4af103e2818113326358f92706d98c7 100644 (file)
@@ -266,7 +266,7 @@ void EnumConstantDecl::EmitImpl(Serializer& S) const {
 }
  
 EnumConstantDecl* EnumConstantDecl::CreateImpl(Deserializer& D) {
-  llvm::APSInt val(0);
+  llvm::APSInt val(1);
   D.Read(val);
   
   EnumConstantDecl* decl = 
@@ -279,7 +279,7 @@ EnumConstantDecl* EnumConstantDecl::CreateImpl(Deserializer& D) {
   
   D.BatchReadOwnedPtrs(next_declarator,decl->Init);
   
-  decl->setNextDeclarator(cast<ScopedDecl>(next_declarator));
+  decl->setNextDeclarator(cast_or_null<ScopedDecl>(next_declarator));
 
   return decl;    
 }