rsmith added inline comments.
================
Comment at: lib/CodeGen/CGExprComplex.cpp:156
+ auto Constant = tryEmitDeclRefOrMemberExprAsConstant(
+ ME, ME->getMemberDecl(), /*AllowSideEffects=*/true);
+ if (Constant) {
----------------
If we can (correctly) allow side-effects in the initializer here, why can we
not also do so when emitting a `DeclRefExpr`?
================
Comment at: lib/CodeGen/CGExprScalar.cpp:1314-1321
+ } else {
+ // Fields can evaluate to constants if their base can be evaluated.
+ llvm::APSInt Value;
+ if (E->EvaluateAsInt(Value, CGF.getContext(), Expr::SE_AllowSideEffects))
+ V = Builder.getInt(Value);
+ else
+ V = nullptr;
----------------
Can we remove this and just use `tryEmit...` unconditionally?
Repository:
rL LLVM
https://reviews.llvm.org/D36876
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits