[cfe-commits] r79342 - in /cfe/trunk: include/clang/Parse/Action.h lib/Frontend/PrintParserCallbacks.cpp lib/Parse/ParseStmt.cpp lib/Sema/Sema.h lib/Sema/SemaStmt.cpp lib/Sema/SemaTemplateInstantiateStmt.cpp
Anders Carlsson
andersca at mac.com
Tue Aug 18 09:11:00 PDT 2009
Author: andersca
Date: Tue Aug 18 11:11:00 2009
New Revision: 79342
URL: http://llvm.org/viewvc/llvm-project?rev=79342&view=rev
Log:
Change ActOnReturnStmt to not take a FullExprArg. Instead, Sema will wrap the return expr inside a CXXExprWithTemporaries if needed.
Modified:
cfe/trunk/include/clang/Parse/Action.h
cfe/trunk/lib/Frontend/PrintParserCallbacks.cpp
cfe/trunk/lib/Parse/ParseStmt.cpp
cfe/trunk/lib/Sema/Sema.h
cfe/trunk/lib/Sema/SemaStmt.cpp
cfe/trunk/lib/Sema/SemaTemplateInstantiateStmt.cpp
Modified: cfe/trunk/include/clang/Parse/Action.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Parse/Action.h?rev=79342&r1=79341&r2=79342&view=diff
==============================================================================
--- cfe/trunk/include/clang/Parse/Action.h (original)
+++ cfe/trunk/include/clang/Parse/Action.h Tue Aug 18 11:11:00 2009
@@ -641,7 +641,7 @@
return StmtEmpty();
}
virtual OwningStmtResult ActOnReturnStmt(SourceLocation ReturnLoc,
- FullExprArg RetValExp) {
+ ExprArg RetValExp) {
return StmtEmpty();
}
virtual OwningStmtResult ActOnAsmStmt(SourceLocation AsmLoc,
Modified: cfe/trunk/lib/Frontend/PrintParserCallbacks.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/PrintParserCallbacks.cpp?rev=79342&r1=79341&r2=79342&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/PrintParserCallbacks.cpp (original)
+++ cfe/trunk/lib/Frontend/PrintParserCallbacks.cpp Tue Aug 18 11:11:00 2009
@@ -374,7 +374,7 @@
return StmtEmpty();
}
virtual OwningStmtResult ActOnReturnStmt(SourceLocation ReturnLoc,
- FullExprArg RetValExp) {
+ ExprArg RetValExp) {
Out << __FUNCTION__ << "\n";
return StmtEmpty();
}
Modified: cfe/trunk/lib/Parse/ParseStmt.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseStmt.cpp?rev=79342&r1=79341&r2=79342&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/ParseStmt.cpp (original)
+++ cfe/trunk/lib/Parse/ParseStmt.cpp Tue Aug 18 11:11:00 2009
@@ -1085,7 +1085,7 @@
return StmtError();
}
}
- return Actions.ActOnReturnStmt(ReturnLoc, Actions.FullExpr(R));
+ return Actions.ActOnReturnStmt(ReturnLoc, move(R));
}
/// FuzzyParseMicrosoftAsmStatement. When -fms-extensions is enabled, this
Modified: cfe/trunk/lib/Sema/Sema.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/Sema.h?rev=79342&r1=79341&r2=79342&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/Sema.h (original)
+++ cfe/trunk/lib/Sema/Sema.h Tue Aug 18 11:11:00 2009
@@ -1366,7 +1366,7 @@
Scope *CurScope);
virtual OwningStmtResult ActOnReturnStmt(SourceLocation ReturnLoc,
- FullExprArg RetValExp);
+ ExprArg RetValExp);
OwningStmtResult ActOnBlockReturnStmt(SourceLocation ReturnLoc,
Expr *RetValExp);
Modified: cfe/trunk/lib/Sema/SemaStmt.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaStmt.cpp?rev=79342&r1=79341&r2=79342&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaStmt.cpp (original)
+++ cfe/trunk/lib/Sema/SemaStmt.cpp Tue Aug 18 11:11:00 2009
@@ -867,8 +867,8 @@
}
Action::OwningStmtResult
-Sema::ActOnReturnStmt(SourceLocation ReturnLoc, FullExprArg rex) {
- Expr *RetValExp = rex->takeAs<Expr>();
+Sema::ActOnReturnStmt(SourceLocation ReturnLoc, ExprArg rex) {
+ Expr *RetValExp = rex.takeAs<Expr>();
if (CurBlock)
return ActOnBlockReturnStmt(ReturnLoc, RetValExp);
@@ -897,6 +897,8 @@
<< CurDecl->getDeclName() << isa<ObjCMethodDecl>(CurDecl)
<< RetValExp->getSourceRange();
}
+
+ RetValExp = MaybeCreateCXXExprWithTemporaries(RetValExp, true);
}
return Owned(new (Context) ReturnStmt(ReturnLoc, RetValExp));
}
@@ -945,6 +947,8 @@
if (RetValExp) CheckReturnStackAddr(RetValExp, FnRetType, ReturnLoc);
}
+ if (RetValExp)
+ RetValExp = MaybeCreateCXXExprWithTemporaries(RetValExp, true);
return Owned(new (Context) ReturnStmt(ReturnLoc, RetValExp));
}
Modified: cfe/trunk/lib/Sema/SemaTemplateInstantiateStmt.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaTemplateInstantiateStmt.cpp?rev=79342&r1=79341&r2=79342&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaTemplateInstantiateStmt.cpp (original)
+++ cfe/trunk/lib/Sema/SemaTemplateInstantiateStmt.cpp Tue Aug 18 11:11:00 2009
@@ -130,7 +130,7 @@
return SemaRef.StmtError();
}
- return SemaRef.ActOnReturnStmt(S->getReturnLoc(), FullExpr(Result));
+ return SemaRef.ActOnReturnStmt(S->getReturnLoc(), move(Result));
}
Sema::OwningStmtResult
More information about the cfe-commits
mailing list