diff options
author | Eli Friedman <eli.friedman@gmail.com> | 2012-01-04 23:13:47 +0000 |
---|---|---|
committer | Eli Friedman <eli.friedman@gmail.com> | 2012-01-04 23:13:47 +0000 |
commit | 65639284118d54ddf2e51a05d2ffccda567fe246 (patch) | |
tree | 66b7a7ae4545db073ada0549d8af683c5c2b4231 /lib/AST/Expr.cpp | |
parent | 08f7760eb2bc25ba3335169be83f7ba492860135 (diff) |
Add an APValue representation for the difference between two address-of-label expressions. Add support to Evaluate and CGExprConstant for generating/handling them. Remove the special-case for such differences in Expr::isConstantInitializer.
With that done, remove a bunch of buggy code from CGExprConstant for handling scalar expressions which is no longer necessary.
Fixes PR11705.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147561 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AST/Expr.cpp')
-rw-r--r-- | lib/AST/Expr.cpp | 27 |
1 files changed, 0 insertions, 27 deletions
diff --git a/lib/AST/Expr.cpp b/lib/AST/Expr.cpp index 9f87161290..bbf54112c8 100644 --- a/lib/AST/Expr.cpp +++ b/lib/AST/Expr.cpp @@ -2530,16 +2530,6 @@ bool Expr::isConstantInitializer(ASTContext &Ctx, bool IsForRef) const { return Exp->getSubExpr()->isConstantInitializer(Ctx, false); break; } - case BinaryOperatorClass: { - // Special case &&foo - &&bar. It would be nice to generalize this somehow - // but this handles the common case. - const BinaryOperator *Exp = cast<BinaryOperator>(this); - if (Exp->getOpcode() == BO_Sub && - isa<AddrLabelExpr>(Exp->getLHS()->IgnoreParenNoopCasts(Ctx)) && - isa<AddrLabelExpr>(Exp->getRHS()->IgnoreParenNoopCasts(Ctx))) - return true; - break; - } case CXXFunctionalCastExprClass: case CXXStaticCastExprClass: case ImplicitCastExprClass: @@ -2558,23 +2548,6 @@ bool Expr::isConstantInitializer(ASTContext &Ctx, bool IsForRef) const { CE->getCastKind() == CK_ConstructorConversion) return CE->getSubExpr()->isConstantInitializer(Ctx, false); - // Handle things like (int)(&&x-&&y). It's a bit nasty, but we support it. - if (CE->getCastKind() == CK_IntegralCast) { - const Expr *E = CE->getSubExpr()->IgnoreParenNoopCasts(Ctx); - while (const CastExpr *InnerCE = dyn_cast<CastExpr>(E)) { - if (InnerCE->getCastKind() != CK_IntegralCast) - break; - E = InnerCE->getSubExpr()->IgnoreParenNoopCasts(Ctx); - } - - if (const BinaryOperator *BO = dyn_cast<BinaryOperator>(E)) { - if (BO->getOpcode() == BO_Sub && - isa<AddrLabelExpr>(BO->getLHS()->IgnoreParenNoopCasts(Ctx)) && - isa<AddrLabelExpr>(BO->getRHS()->IgnoreParenNoopCasts(Ctx))) - return true; - } - } - break; } case MaterializeTemporaryExprClass: |