diff options
author | Ted Kremenek <kremenek@apple.com> | 2010-04-13 23:39:13 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2010-04-13 23:39:13 +0000 |
commit | 709210feee317b8d6690dd1d15c2b74cfe55e261 (patch) | |
tree | fd9041960ca441e2e085f669b275cc357b70e448 /lib/Frontend | |
parent | 9c9bd84383f742513b3cfd656948bab16d752937 (diff) |
Use ASTVector instead of std::vector for the Exprs in InitListExpr. Performance
measurements of '-fsyntax-only' on combine.c (403.gcc) shows no real performance
change, but now the vector isn't leaked.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@101195 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Frontend')
-rw-r--r-- | lib/Frontend/PCHReaderStmt.cpp | 6 | ||||
-rw-r--r-- | lib/Frontend/RewriteObjC.cpp | 14 |
2 files changed, 11 insertions, 9 deletions
diff --git a/lib/Frontend/PCHReaderStmt.cpp b/lib/Frontend/PCHReaderStmt.cpp index 7b94805d39..2c954a68ac 100644 --- a/lib/Frontend/PCHReaderStmt.cpp +++ b/lib/Frontend/PCHReaderStmt.cpp @@ -554,9 +554,9 @@ unsigned PCHStmtReader::VisitExtVectorElementExpr(ExtVectorElementExpr *E) { unsigned PCHStmtReader::VisitInitListExpr(InitListExpr *E) { VisitExpr(E); unsigned NumInits = Record[Idx++]; - E->reserveInits(NumInits); + E->reserveInits(*Reader.getContext(), NumInits); for (unsigned I = 0; I != NumInits; ++I) - E->updateInit(I, + E->updateInit(*Reader.getContext(), I, cast<Expr>(StmtStack[StmtStack.size() - NumInits - 1 + I])); E->setSyntacticForm(cast_or_null<InitListExpr>(StmtStack.back())); E->setLBraceLoc(SourceLocation::getFromRawEncoding(Record[Idx++])); @@ -1124,7 +1124,7 @@ Stmt *PCHReader::ReadStmt(llvm::BitstreamCursor &Cursor) { break; case pch::EXPR_INIT_LIST: - S = new (Context) InitListExpr(Empty); + S = new (Context) InitListExpr(*getContext(), Empty); break; case pch::EXPR_DESIGNATED_INIT: diff --git a/lib/Frontend/RewriteObjC.cpp b/lib/Frontend/RewriteObjC.cpp index 83d392aab3..87272ebe9f 100644 --- a/lib/Frontend/RewriteObjC.cpp +++ b/lib/Frontend/RewriteObjC.cpp @@ -2754,9 +2754,10 @@ Stmt *RewriteObjC::SynthMessageExpr(ObjCMessageExpr *Exp, CastExpr::CK_Unknown, SuperRep); } else { // (struct objc_super) { <exprs from above> } - InitListExpr *ILE = new (Context) InitListExpr(SourceLocation(), - &InitExprs[0], InitExprs.size(), - SourceLocation()); + InitListExpr *ILE = + new (Context) InitListExpr(*Context, SourceLocation(), + &InitExprs[0], InitExprs.size(), + SourceLocation()); TypeSourceInfo *superTInfo = Context->getTrivialTypeSourceInfo(superType); SuperRep = new (Context) CompoundLiteralExpr(SourceLocation(), superTInfo, @@ -2853,9 +2854,10 @@ Stmt *RewriteObjC::SynthMessageExpr(ObjCMessageExpr *Exp, CastExpr::CK_Unknown, SuperRep); } else { // (struct objc_super) { <exprs from above> } - InitListExpr *ILE = new (Context) InitListExpr(SourceLocation(), - &InitExprs[0], InitExprs.size(), - SourceLocation()); + InitListExpr *ILE = + new (Context) InitListExpr(*Context, SourceLocation(), + &InitExprs[0], InitExprs.size(), + SourceLocation()); TypeSourceInfo *superTInfo = Context->getTrivialTypeSourceInfo(superType); SuperRep = new (Context) CompoundLiteralExpr(SourceLocation(), superTInfo, |