tbaeder created this revision. tbaeder added reviewers: aaron.ballman, erichkeane, shafik, cor3ntin. Herald added a project: All. tbaeder requested review of this revision. Herald added a project: clang. Herald added a subscriber: cfe-commits.
I think this makes sense to do, given that the `ConstantExpr`... is constant and can even already have the result attached. Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D155548 Files: clang/lib/AST/ExprConstant.cpp Index: clang/lib/AST/ExprConstant.cpp =================================================================== --- clang/lib/AST/ExprConstant.cpp +++ clang/lib/AST/ExprConstant.cpp @@ -15206,6 +15206,17 @@ return true; } + if (const auto *CE = dyn_cast<ConstantExpr>(Exp)) { + if (CE->hasAPValueResult()) { + Result.Val = CE->getAPValueResult(); + IsConst = true; + return true; + } + + // The SubExpr is usually just an IntegerLiteral. + return FastEvaluateAsRValue(CE->getSubExpr(), Result, Ctx, IsConst); + } + // This case should be rare, but we need to check it before we check on // the type below. if (Exp->getType().isNull()) {
Index: clang/lib/AST/ExprConstant.cpp =================================================================== --- clang/lib/AST/ExprConstant.cpp +++ clang/lib/AST/ExprConstant.cpp @@ -15206,6 +15206,17 @@ return true; } + if (const auto *CE = dyn_cast<ConstantExpr>(Exp)) { + if (CE->hasAPValueResult()) { + Result.Val = CE->getAPValueResult(); + IsConst = true; + return true; + } + + // The SubExpr is usually just an IntegerLiteral. + return FastEvaluateAsRValue(CE->getSubExpr(), Result, Ctx, IsConst); + } + // This case should be rare, but we need to check it before we check on // the type below. if (Exp->getType().isNull()) {
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits