summaryrefslogtreecommitdiffstats
path: root/clang/lib/Parse/ParseExpr.cpp
diff options
context:
space:
mode:
authorEli Friedman <eli.friedman@gmail.com>2012-01-21 01:01:51 +0000
committerEli Friedman <eli.friedman@gmail.com>2012-01-21 01:01:51 +0000
commite0afc98742422e99f7ed4c5f82812ab64781d7e7 (patch)
tree814bdbd4523e47b3b5c92378658f47d9876a3af5 /clang/lib/Parse/ParseExpr.cpp
parent8e3bb315d8721211474fb7759002acb1c190317e (diff)
downloadbcm5719-llvm-e0afc98742422e99f7ed4c5f82812ab64781d7e7.tar.gz
bcm5719-llvm-e0afc98742422e99f7ed4c5f82812ab64781d7e7.zip
Make clang's AST model sizeof and typeof with potentially-evaluated operands correctly, similar to what we already do with typeid.
llvm-svn: 148610
Diffstat (limited to 'clang/lib/Parse/ParseExpr.cpp')
-rw-r--r--clang/lib/Parse/ParseExpr.cpp18
1 files changed, 2 insertions, 16 deletions
diff --git a/clang/lib/Parse/ParseExpr.cpp b/clang/lib/Parse/ParseExpr.cpp
index c766bad110d..bdebb5e6b94 100644
--- a/clang/lib/Parse/ParseExpr.cpp
+++ b/clang/lib/Parse/ParseExpr.cpp
@@ -1442,14 +1442,6 @@ Parser::ParseExprAfterUnaryExprOrTypeTrait(const Token &OpTok,
return ExprError();
}
- // C++0x [expr.sizeof]p1:
- // [...] The operand is either an expression, which is an unevaluated
- // operand (Clause 5) [...]
- //
- // The GNU typeof and GNU/C++11 alignof extensions also behave as
- // unevaluated operands.
- EnterExpressionEvaluationContext Unevaluated(Actions,
- Sema::Unevaluated);
Operand = ParseCastExpression(true/*isUnaryExpression*/);
} else {
// If it starts with a '(', we know that it is either a parenthesized
@@ -1459,14 +1451,6 @@ Parser::ParseExprAfterUnaryExprOrTypeTrait(const Token &OpTok,
ParenParseOption ExprType = CastExpr;
SourceLocation LParenLoc = Tok.getLocation(), RParenLoc;
- // C++0x [expr.sizeof]p1:
- // [...] The operand is either an expression, which is an unevaluated
- // operand (Clause 5) [...]
- //
- // The GNU typeof and GNU/C++11 alignof extensions also behave as
- // unevaluated operands.
- EnterExpressionEvaluationContext Unevaluated(Actions,
- Sema::Unevaluated);
Operand = ParseParenExpression(ExprType, true/*stopIfCastExpr*/,
false, CastTy, RParenLoc);
CastRange = SourceRange(LParenLoc, RParenLoc);
@@ -1555,6 +1539,8 @@ ExprResult Parser::ParseUnaryExprOrTypeTraitExpression() {
if (OpTok.is(tok::kw_alignof))
Diag(OpTok, diag::warn_cxx98_compat_alignof);
+ EnterExpressionEvaluationContext Unevaluated(Actions, Sema::Unevaluated);
+
bool isCastExpr;
ParsedType CastTy;
SourceRange CastRange;
OpenPOWER on IntegriCloud