rjmccall added inline comments.
================ Comment at: lib/CodeGen/CGExprConstant.cpp:1403 + if (auto *IL = dyn_cast_or_null<InitListExpr>(Init)) { + if (InitTy->isConstantArrayType()) { + for (auto I : IL->inits()) ---------------- Do you actually care if it's an array initialization instead of a struct/enum initialization? ================ Comment at: lib/CodeGen/CGExprConstant.cpp:1413 + } else if (!Init->isEvaluatable(CE.CGM.getContext())) { + return false; + } else if (InitTy->hasPointerRepresentation()) { ---------------- Aren't the null-pointer and integer-constant-expression checks below already checking this? Also, `isEvaluatable` actually computes the full value internally (as an `APValue`), so if you're worried about the memory and compile-time effects of producing such a value, you really shouldn't call it. You could reasonably move this entire function to be a method on `Expr` that takes an `ASTContext`. ================ Comment at: lib/CodeGen/CGExprConstant.cpp:1417 + if (Init->EvaluateAsRValue(ResVal, CE.CGM.getContext())) + return ResVal.Val.isLValue() && ResVal.Val.isNullPointer(); + } else { ---------------- There's a `isNullPointerConstant` method (you should use `NPC_NeverValueDependent`). Repository: rC Clang https://reviews.llvm.org/D46241 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits