summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
authorChris Bieneman <chris.bieneman@me.com>2019-05-17 05:45:57 +0000
committerChris Bieneman <chris.bieneman@me.com>2019-05-17 05:45:57 +0000
commita5a4124c494ce08a9decb96d2be94e7f216bedbd (patch)
tree7405e4aeac6dcd87e0e49e3ed17080a907235bee /clang/lib
parente18a6ad0b8b7d670bb06ec3ed5eb348cec9e6133 (diff)
downloadbcm5719-llvm-a5a4124c494ce08a9decb96d2be94e7f216bedbd.tar.gz
bcm5719-llvm-a5a4124c494ce08a9decb96d2be94e7f216bedbd.zip
Revert [c++20] P1327R1: Support for typeid applied to objects of polymorphic class type in constant evaluation.
This reverts r360977 (git commit f51dc8d2f98f4029247552bc45ef53628ab3b6b9) llvm-svn: 360987
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/AST/ExprConstant.cpp28
1 files changed, 6 insertions, 22 deletions
diff --git a/clang/lib/AST/ExprConstant.cpp b/clang/lib/AST/ExprConstant.cpp
index 35000f42b24..e41264e55e4 100644
--- a/clang/lib/AST/ExprConstant.cpp
+++ b/clang/lib/AST/ExprConstant.cpp
@@ -1349,7 +1349,6 @@ enum AccessKinds {
AK_Decrement,
AK_MemberCall,
AK_DynamicCast,
- AK_TypeId,
};
static bool isModification(AccessKinds AK) {
@@ -1357,7 +1356,6 @@ static bool isModification(AccessKinds AK) {
case AK_Read:
case AK_MemberCall:
case AK_DynamicCast:
- case AK_TypeId:
return false;
case AK_Assign:
case AK_Increment:
@@ -6031,33 +6029,19 @@ LValueExprEvaluator::VisitCompoundLiteralExpr(const CompoundLiteralExpr *E) {
}
bool LValueExprEvaluator::VisitCXXTypeidExpr(const CXXTypeidExpr *E) {
- TypeInfoLValue TypeInfo;
-
if (!E->isPotentiallyEvaluated()) {
+ TypeInfoLValue TypeInfo;
if (E->isTypeOperand())
TypeInfo = TypeInfoLValue(E->getTypeOperand(Info.Ctx).getTypePtr());
else
TypeInfo = TypeInfoLValue(E->getExprOperand()->getType().getTypePtr());
- } else {
- if (!Info.Ctx.getLangOpts().CPlusPlus2a) {
- Info.CCEDiag(E, diag::note_constexpr_typeid_polymorphic)
- << E->getExprOperand()->getType()
- << E->getExprOperand()->getSourceRange();
- }
-
- if (!Visit(E->getExprOperand()))
- return false;
-
- Optional<DynamicType> DynType =
- ComputeDynamicType(Info, E, Result, AK_TypeId);
- if (!DynType)
- return false;
-
- TypeInfo =
- TypeInfoLValue(Info.Ctx.getRecordType(DynType->Type).getTypePtr());
+ return Success(APValue::LValueBase::getTypeInfo(TypeInfo, E->getType()));
}
- return Success(APValue::LValueBase::getTypeInfo(TypeInfo, E->getType()));
+ Info.FFDiag(E, diag::note_constexpr_typeid_polymorphic)
+ << E->getExprOperand()->getType()
+ << E->getExprOperand()->getSourceRange();
+ return false;
}
bool LValueExprEvaluator::VisitCXXUuidofExpr(const CXXUuidofExpr *E) {
OpenPOWER on IntegriCloud