aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/SemaStmt.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2010-05-15 06:46:45 +0000
committerDouglas Gregor <dgregor@apple.com>2010-05-15 06:46:45 +0000
commitd86c477fb5d3fc34864afecbbb5443da9355e8fb (patch)
tree43c06bb0a10f4cce71fbd57c3b2d8d97e7acae20 /lib/Sema/SemaStmt.cpp
parent5077c3876beeaed32280af88244e8050078619a8 (diff)
Implement a simple form of the C++ named return value optimization for
return statements. We perform NRVO only when all of the return statements in the function return the same variable. Fixes some link failures in Boost.Interprocess (which is relying on NRVO), and probably improves performance for some C++ applications. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103867 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaStmt.cpp')
-rw-r--r--lib/Sema/SemaStmt.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/Sema/SemaStmt.cpp b/lib/Sema/SemaStmt.cpp
index f8fe4fe21c..d904907e97 100644
--- a/lib/Sema/SemaStmt.cpp
+++ b/lib/Sema/SemaStmt.cpp
@@ -1090,7 +1090,8 @@ static const VarDecl *getNRVOCandidate(ASTContext &Ctx, QualType RetType,
return 0;
if (VD->getKind() == Decl::Var && VD->hasLocalStorage() &&
- !VD->getType()->isReferenceType() && !VD->getType().isVolatileQualified())
+ !VD->getType()->isReferenceType() && !VD->hasAttr<BlocksAttr>() &&
+ !VD->getType().isVolatileQualified())
return VD;
return 0;