summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaDecl.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2011-09-06 20:46:03 +0000
committerDouglas Gregor <dgregor@apple.com>2011-09-06 20:46:03 +0000
commit49695f078e3d7eaacdaa46fb994df7323a294a56 (patch)
tree226e6f5ef28c9dc267c1cb24793d8f55d0caa7fa /clang/lib/Sema/SemaDecl.cpp
parent70532e289fbdd558dad7b09e8ff49e5130debc4d (diff)
downloadbcm5719-llvm-49695f078e3d7eaacdaa46fb994df7323a294a56.tar.gz
bcm5719-llvm-49695f078e3d7eaacdaa46fb994df7323a294a56.zip
Implement the Named Return Value Optimization (NRVO) for blocks.
llvm-svn: 139178
Diffstat (limited to 'clang/lib/Sema/SemaDecl.cpp')
-rw-r--r--clang/lib/Sema/SemaDecl.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp
index 6a205786d62..f8b0af49db5 100644
--- a/clang/lib/Sema/SemaDecl.cpp
+++ b/clang/lib/Sema/SemaDecl.cpp
@@ -6626,7 +6626,7 @@ Decl *Sema::ActOnStartOfFunctionDef(Scope *FnBodyScope, Decl *D) {
/// FIXME: Employ a smarter algorithm that accounts for multiple return
/// statements and the lifetimes of the NRVO candidates. We should be able to
/// find a maximal set of NRVO variables.
-static void ComputeNRVO(Stmt *Body, FunctionScopeInfo *Scope) {
+void Sema::computeNRVO(Stmt *Body, FunctionScopeInfo *Scope) {
ReturnStmt **Returns = Scope->Returns.data();
const VarDecl *NRVOCandidate = 0;
@@ -6687,7 +6687,7 @@ Decl *Sema::ActOnFinishFunctionBody(Decl *dcl, Stmt *Body,
if (CXXConstructorDecl *Constructor = dyn_cast<CXXConstructorDecl>(FD))
MarkVTableUsed(FD->getLocation(), Constructor->getParent());
- ComputeNRVO(Body, getCurFunction());
+ computeNRVO(Body, getCurFunction());
}
assert(FD == getCurFunctionDecl() && "Function parsing confused");
@@ -6702,7 +6702,7 @@ Decl *Sema::ActOnFinishFunctionBody(Decl *dcl, Stmt *Body,
MD->getResultType(), MD);
if (Body)
- ComputeNRVO(Body, getCurFunction());
+ computeNRVO(Body, getCurFunction());
}
if (ObjCShouldCallSuperDealloc) {
Diag(MD->getLocEnd(), diag::warn_objc_missing_super_dealloc);
OpenPOWER on IntegriCloud