[cfe-commits] r39255 - /cfe/cfe/trunk/AST/Decl.cpp
sabre at cs.uiuc.edu
sabre at cs.uiuc.edu
Wed Jul 11 09:42:01 PDT 2007
Author: sabre
Date: Wed Jul 11 11:42:01 2007
New Revision: 39255
URL: http://llvm.org/viewvc/llvm-project?rev=39255&view=rev
Log:
avoid allocating memory for empty arg lists
Modified:
cfe/cfe/trunk/AST/Decl.cpp
Modified: cfe/cfe/trunk/AST/Decl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/AST/Decl.cpp?rev=39255&r1=39254&r2=39255&view=diff
==============================================================================
--- cfe/cfe/trunk/AST/Decl.cpp (original)
+++ cfe/cfe/trunk/AST/Decl.cpp Wed Jul 11 11:42:01 2007
@@ -37,6 +37,9 @@
assert(ParamInfo == 0 && "Already has param info!");
assert(NumParams == getNumParams() && "Parameter count mismatch!");
- ParamInfo = new VarDecl*[NumParams];
- memcpy(ParamInfo, NewParamInfo, sizeof(VarDecl*)*NumParams);
+ // Zero params -> null pointer.
+ if (NumParams) {
+ ParamInfo = new VarDecl*[NumParams];
+ memcpy(ParamInfo, NewParamInfo, sizeof(VarDecl*)*NumParams);
+ }
}
More information about the cfe-commits
mailing list