summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaExprCXX.cpp
diff options
context:
space:
mode:
authorEli Friedman <eli.friedman@gmail.com>2012-01-20 01:26:23 +0000
committerEli Friedman <eli.friedman@gmail.com>2012-01-20 01:26:23 +0000
commit456f01833b6a6356b200a06c5b2ab81ba706d03b (patch)
tree75464c03c9ee48fc1fc92abd16b32a844bae6ea7 /clang/lib/Sema/SemaExprCXX.cpp
parent6561d15dcb514fee576b41264eff91315f1799fb (diff)
downloadbcm5719-llvm-456f01833b6a6356b200a06c5b2ab81ba706d03b.tar.gz
bcm5719-llvm-456f01833b6a6356b200a06c5b2ab81ba706d03b.zip
Remove PotentiallyPotentiallyEvaluated, and replace it with a much simpler and less error-prone way of handling the relevant cases. Towards marking of whether a declaration is used more accurately.
llvm-svn: 148522
Diffstat (limited to 'clang/lib/Sema/SemaExprCXX.cpp')
-rw-r--r--clang/lib/Sema/SemaExprCXX.cpp22
1 files changed, 6 insertions, 16 deletions
diff --git a/clang/lib/Sema/SemaExprCXX.cpp b/clang/lib/Sema/SemaExprCXX.cpp
index db41f5a3ca7..f0b31fd0f10 100644
--- a/clang/lib/Sema/SemaExprCXX.cpp
+++ b/clang/lib/Sema/SemaExprCXX.cpp
@@ -310,7 +310,6 @@ ExprResult Sema::BuildCXXTypeId(QualType TypeInfoType,
SourceLocation TypeidLoc,
Expr *E,
SourceLocation RParenLoc) {
- bool isUnevaluatedOperand = true;
if (E && !E->isTypeDependent()) {
if (E->getType()->isPlaceholderType()) {
ExprResult result = CheckPlaceholderExpr(E);
@@ -332,7 +331,11 @@ ExprResult Sema::BuildCXXTypeId(QualType TypeInfoType,
// polymorphic class type [...] [the] expression is an unevaluated
// operand. [...]
if (RecordD->isPolymorphic() && E->Classify(Context).isGLValue()) {
- isUnevaluatedOperand = false;
+ // The subexpression is potentially evaluated; switch the context
+ // and recheck the subexpression.
+ ExprResult Result = TranformToPotentiallyEvaluated(E);
+ if (Result.isInvalid()) return ExprError();
+ E = Result.take();
// We require a vtable to query the type at run time.
MarkVTableUsed(TypeidLoc, RecordD);
@@ -352,12 +355,6 @@ ExprResult Sema::BuildCXXTypeId(QualType TypeInfoType,
}
}
- // If this is an unevaluated operand, clear out the set of
- // declaration references we have been computing and eliminate any
- // temporaries introduced in its computation.
- if (isUnevaluatedOperand)
- ExprEvalContexts.back().Context = Unevaluated;
-
return Owned(new (Context) CXXTypeidExpr(TypeInfoType.withConst(),
E,
SourceRange(TypeidLoc, RParenLoc)));
@@ -695,14 +692,7 @@ void Sema::CheckCXXThisCapture(SourceLocation Loc) {
continue;
}
// This context can't implicitly capture 'this'; fail out.
- // (We need to delay the diagnostic in the
- // PotentiallyPotentiallyEvaluated case because it doesn't apply to
- // unevaluated contexts.)
- if (ExprEvalContexts.back().Context == PotentiallyPotentiallyEvaluated)
- ExprEvalContexts.back()
- .addDiagnostic(Loc, PDiag(diag::err_implicit_this_capture));
- else
- Diag(Loc, diag::err_implicit_this_capture);
+ Diag(Loc, diag::err_implicit_this_capture);
return;
}
break;
OpenPOWER on IntegriCloud