[cfe-commits] r58850 - /cfe/trunk/lib/AST/DeclSerialization.cpp
Argiris Kirtzidis
akyrtzi at gmail.com
Fri Nov 7 06:22:24 PST 2008
Author: akirtzidis
Date: Fri Nov 7 08:22:23 2008
New Revision: 58850
URL: http://llvm.org/viewvc/llvm-project?rev=58850&view=rev
Log:
Properly deserialize ParamInfo of FunctionDecl.
When allocating an array for ParamInfo, the "decl->getNumParams()" call was used, but this will return 0 since it checks ParamInfo (which isn't yet defined and is null).
The result was that ParamInfo got an array of zero length to hold the ParmVarDecls.
Modified:
cfe/trunk/lib/AST/DeclSerialization.cpp
Modified: cfe/trunk/lib/AST/DeclSerialization.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/DeclSerialization.cpp?rev=58850&r1=58849&r2=58850&view=diff
==============================================================================
--- cfe/trunk/lib/AST/DeclSerialization.cpp (original)
+++ cfe/trunk/lib/AST/DeclSerialization.cpp Fri Nov 7 08:22:23 2008
@@ -402,6 +402,7 @@
if (ParamInfo != NULL) {
S.EmitBool(true);
+ S.EmitInt(getNumParams());
S.BatchEmitOwnedPtrs(getNumParams(),&ParamInfo[0], Body,
getNextDeclarator());
}
@@ -425,14 +426,17 @@
Decl* next_declarator;
+ int numParams;
bool hasParamDecls = D.ReadBool();
+ if (hasParamDecls)
+ numParams = D.ReadInt();
decl->ParamInfo = hasParamDecls
- ? new ParmVarDecl*[decl->getNumParams()]
+ ? new ParmVarDecl*[numParams]
: NULL;
if (hasParamDecls)
- D.BatchReadOwnedPtrs(decl->getNumParams(),
+ D.BatchReadOwnedPtrs(numParams,
reinterpret_cast<Decl**>(&decl->ParamInfo[0]),
decl->Body, next_declarator, C);
else
More information about the cfe-commits
mailing list