diff options
author | Chris Lattner <sabre@nondot.org> | 2009-01-20 19:11:22 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2009-01-20 19:11:22 +0000 |
commit | 1ce41edd8da47d7c438c18a819ced3237a2f49f7 (patch) | |
tree | cdc57b07696a11d253611686b05a923a5435b89f /clang/lib/Parse/ParseDecl.cpp | |
parent | 72854c3811e7c952e3f26e5eed6b51a49dd218be (diff) | |
download | llvm-1ce41edd8da47d7c438c18a819ced3237a2f49f7.zip llvm-1ce41edd8da47d7c438c18a819ced3237a2f49f7.tar.gz llvm-1ce41edd8da47d7c438c18a819ced3237a2f49f7.tar.bz2 |
Optimize Declarator to avoid malloc/free traffic for the argument list of a
function DeclaratorChunk in common cases. This uses a fixed array in
Declarator when it is small enough for the first function declarator chunk
in a declarator.
This eliminates all malloc/free traffic from DeclaratorChunk::getFunction
when running on Cocoa.h except for five functions: signal/bsd_signal/sigset,
which have multiple Function DeclChunk's, and
CFUUIDCreateWithBytes/CFUUIDGetConstantUUIDWithBytes, which take more than
16 arguments.
This patch was pair programmed with Steve.
llvm-svn: 62599
Diffstat (limited to 'clang/lib/Parse/ParseDecl.cpp')
-rw-r--r-- | clang/lib/Parse/ParseDecl.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/clang/lib/Parse/ParseDecl.cpp b/clang/lib/Parse/ParseDecl.cpp index 456acbe..bf92278 100644 --- a/clang/lib/Parse/ParseDecl.cpp +++ b/clang/lib/Parse/ParseDecl.cpp @@ -1854,7 +1854,7 @@ void Parser::ParseFunctionDeclarator(SourceLocation LParenLoc, Declarator &D, /*variadic*/ false, /*arglist*/ 0, 0, DS.getTypeQualifiers(), - LParenLoc)); + LParenLoc, D)); return; } @@ -2013,7 +2013,7 @@ void Parser::ParseFunctionDeclarator(SourceLocation LParenLoc, Declarator &D, D.AddTypeInfo(DeclaratorChunk::getFunction(/*proto*/true, IsVariadic, &ParamInfo[0], ParamInfo.size(), DS.getTypeQualifiers(), - LParenLoc)); + LParenLoc, D)); } /// ParseFunctionDeclaratorIdentifierList - While parsing a function declarator @@ -2080,7 +2080,7 @@ void Parser::ParseFunctionDeclaratorIdentifierList(SourceLocation LParenLoc, // has no prototype. D.AddTypeInfo(DeclaratorChunk::getFunction(/*proto*/false, /*varargs*/false, &ParamInfo[0], ParamInfo.size(), - /*TypeQuals*/0, LParenLoc)); + /*TypeQuals*/0, LParenLoc, D)); // If we have the closing ')', eat it and we're done. MatchRHSPunctuation(tok::r_paren, LParenLoc); |