[cfe-commits] r44076 - /cfe/trunk/AST/DeclSerialization.cpp
Ted Kremenek
kremenek at apple.com
Tue Nov 13 14:51:09 PST 2007
Author: kremenek
Date: Tue Nov 13 16:51:08 2007
New Revision: 44076
URL: http://llvm.org/viewvc/llvm-project?rev=44076&view=rev
Log:
Fixed bug in FunctionDecl serialization where we crashed when the
FunctionDecl had decls for its parameters but still had greater than 0
arguments.
Modified:
cfe/trunk/AST/DeclSerialization.cpp
Modified: cfe/trunk/AST/DeclSerialization.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/AST/DeclSerialization.cpp?rev=44076&r1=44075&r2=44076&view=diff
==============================================================================
--- cfe/trunk/AST/DeclSerialization.cpp (original)
+++ cfe/trunk/AST/DeclSerialization.cpp Tue Nov 13 16:51:08 2007
@@ -226,9 +226,15 @@
// NOTE: We do not need to serialize out the number of parameters, because
// that is encoded in the type (accessed via getNumParams()).
- S.BatchEmitOwnedPtrs(getNumParams(),&ParamInfo[0], // From FunctionDecl.
- Body, // From FunctionDecl.
- getNextDeclarator()); // From ScopedDecl.
+ if (ParamInfo != NULL) {
+ S.EmitBool(true);
+ S.BatchEmitOwnedPtrs(getNumParams(),&ParamInfo[0], Body,
+ getNextDeclarator());
+ }
+ else {
+ S.EmitBool(false);
+ S.BatchEmitOwnedPtrs(Body,getNextDeclarator());
+ }
}
FunctionDecl* FunctionDecl::CreateImpl(Deserializer& D) {
@@ -247,10 +253,14 @@
Decl* next_declarator;
- D.BatchReadOwnedPtrs(decl->getNumParams(),
- reinterpret_cast<Decl**>(&decl->ParamInfo[0]), // FunctionDecl.
- decl->Body, // From FunctionDecl.
- next_declarator); // From ScopedDecl.
+ bool hasParamDecls = D.ReadBool();
+
+ if (hasParamDecls)
+ D.BatchReadOwnedPtrs(decl->getNumParams(),
+ reinterpret_cast<Decl**>(&decl->ParamInfo[0]),
+ decl->Body, next_declarator);
+ else
+ D.BatchReadOwnedPtrs(decl->Body, next_declarator);
decl->setNextDeclarator(cast_or_null<ScopedDecl>(next_declarator));
More information about the cfe-commits
mailing list