Make ActOnExprStmt take a FullExprArg.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@71989 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/include/clang/Parse/Action.h b/include/clang/Parse/Action.h
index 6d4e2b7..cd19457 100644
--- a/include/clang/Parse/Action.h
+++ b/include/clang/Parse/Action.h
@@ -460,8 +460,8 @@
return StmtEmpty();
}
- virtual OwningStmtResult ActOnExprStmt(ExprArg Expr) {
- return OwningStmtResult(*this, Expr.release());
+ virtual OwningStmtResult ActOnExprStmt(FullExprArg Expr) {
+ return OwningStmtResult(*this, Expr->release());
}
/// ActOnCaseStmt - Note that this handles the GNU 'case 1 ... 4' extension,
diff --git a/lib/AST/Expr.cpp b/lib/AST/Expr.cpp
index 3133a8f..19ab835 100644
--- a/lib/AST/Expr.cpp
+++ b/lib/AST/Expr.cpp
@@ -594,6 +594,9 @@
// effects (e.g. a placement new with an uninitialized POD).
case CXXDeleteExprClass:
return false;
+ case CXXExprWithTemporariesClass:
+ return cast<CXXExprWithTemporaries>(this)
+ ->getSubExpr()->isUnusedResultAWarning(Loc, R1, R2);
}
}
diff --git a/lib/Parse/ParseObjc.cpp b/lib/Parse/ParseObjc.cpp
index 6c42f42..e1d0bb6 100644
--- a/lib/Parse/ParseObjc.cpp
+++ b/lib/Parse/ParseObjc.cpp
@@ -1408,7 +1408,7 @@
}
// Otherwise, eat the semicolon.
ExpectAndConsume(tok::semi, diag::err_expected_semi_after_expr);
- return Actions.ActOnExprStmt(move(Res));
+ return Actions.ActOnExprStmt(Actions.FullExpr(Res));
}
Parser::OwningExprResult Parser::ParseObjCAtExpression(SourceLocation AtLoc) {
diff --git a/lib/Parse/ParseStmt.cpp b/lib/Parse/ParseStmt.cpp
index 16b7a9f..cf4e2f4 100644
--- a/lib/Parse/ParseStmt.cpp
+++ b/lib/Parse/ParseStmt.cpp
@@ -121,7 +121,7 @@
}
// Otherwise, eat the semicolon.
ExpectAndConsume(tok::semi, diag::err_expected_semi_after_expr);
- return Actions.ActOnExprStmt(move(Expr));
+ return Actions.ActOnExprStmt(Actions.FullExpr(Expr));
}
case tok::kw_case: // C99 6.8.1: labeled-statement
@@ -457,7 +457,7 @@
// Eat the semicolon at the end of stmt and convert the expr into a
// statement.
ExpectAndConsume(tok::semi, diag::err_expected_semi_after_expr);
- R = Actions.ActOnExprStmt(move(Res));
+ R = Actions.ActOnExprStmt(Actions.FullExpr(Res));
}
}
@@ -929,7 +929,7 @@
// Turn the expression into a stmt.
if (!Value.isInvalid())
- FirstPart = Actions.ActOnExprStmt(move(Value));
+ FirstPart = Actions.ActOnExprStmt(Actions.FullExpr(Value));
if (Tok.is(tok::semi)) {
ConsumeToken();
diff --git a/lib/Sema/Sema.h b/lib/Sema/Sema.h
index eb723bb..9c27745 100644
--- a/lib/Sema/Sema.h
+++ b/lib/Sema/Sema.h
@@ -1155,7 +1155,7 @@
//===--------------------------------------------------------------------===//
// Statement Parsing Callbacks: SemaStmt.cpp.
public:
- virtual OwningStmtResult ActOnExprStmt(ExprArg Expr);
+ virtual OwningStmtResult ActOnExprStmt(FullExprArg Expr);
virtual OwningStmtResult ActOnNullStmt(SourceLocation SemiLoc);
virtual OwningStmtResult ActOnCompoundStmt(SourceLocation L, SourceLocation R,
diff --git a/lib/Sema/SemaStmt.cpp b/lib/Sema/SemaStmt.cpp
index 5c04c24..155b510 100644
--- a/lib/Sema/SemaStmt.cpp
+++ b/lib/Sema/SemaStmt.cpp
@@ -21,8 +21,8 @@
#include "clang/Basic/TargetInfo.h"
using namespace clang;
-Sema::OwningStmtResult Sema::ActOnExprStmt(ExprArg expr) {
- Expr *E = expr.takeAs<Expr>();
+Sema::OwningStmtResult Sema::ActOnExprStmt(FullExprArg expr) {
+ Expr *E = expr->takeAs<Expr>();
assert(E && "ActOnExprStmt(): missing expression");
// C99 6.8.3p2: The expression in an expression statement is evaluated as a
diff --git a/tools/clang-cc/PrintParserCallbacks.cpp b/tools/clang-cc/PrintParserCallbacks.cpp
index 4ee48f0..73a653d 100644
--- a/tools/clang-cc/PrintParserCallbacks.cpp
+++ b/tools/clang-cc/PrintParserCallbacks.cpp
@@ -266,9 +266,9 @@
return StmtEmpty();
}
- virtual OwningStmtResult ActOnExprStmt(ExprArg Expr) {
+ virtual OwningStmtResult ActOnExprStmt(FullExprArg Expr) {
llvm::cout << __FUNCTION__ << "\n";
- return OwningStmtResult(*this, Expr.release());
+ return OwningStmtResult(*this, Expr->release());
}
/// ActOnCaseStmt - Note that this handles the GNU 'case 1 ... 4' extension,