r348029 - We're in a constant context in the ConstantEmitter.
Bill Wendling via cfe-commits
cfe-commits at lists.llvm.org
Fri Nov 30 12:40:06 PST 2018
Author: void
Date: Fri Nov 30 12:40:06 2018
New Revision: 348029
URL: http://llvm.org/viewvc/llvm-project?rev=348029&view=rev
Log:
We're in a constant context in the ConstantEmitter.
Modified:
cfe/trunk/lib/CodeGen/CGExprConstant.cpp
cfe/trunk/test/CodeGen/builtin-constant-p.c
Modified: cfe/trunk/lib/CodeGen/CGExprConstant.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExprConstant.cpp?rev=348029&r1=348028&r2=348029&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGExprConstant.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGExprConstant.cpp Fri Nov 30 12:40:06 2018
@@ -1552,7 +1552,8 @@ llvm::Constant *ConstantEmitter::tryEmit
if (destType->isReferenceType())
Success = E->EvaluateAsLValue(Result, CGM.getContext());
else
- Success = E->EvaluateAsRValue(Result, CGM.getContext());
+ Success = E->EvaluateAsRValue(Result, CGM.getContext(),
+ /* InConstantContext */ true);
llvm::Constant *C;
if (Success && !Result.HasSideEffects)
Modified: cfe/trunk/test/CodeGen/builtin-constant-p.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/builtin-constant-p.c?rev=348029&r1=348028&r2=348029&view=diff
==============================================================================
--- cfe/trunk/test/CodeGen/builtin-constant-p.c (original)
+++ cfe/trunk/test/CodeGen/builtin-constant-p.c Fri Nov 30 12:40:06 2018
@@ -157,3 +157,14 @@ static void src_fn(void) {
void test14() {
assign(dest_p, src_fn);
}
+
+struct test15_s {
+ const char *name;
+ int num_args;
+};
+
+extern int test15_v;
+
+struct test15_s tcg_op_defs_org_x86_64[] = {
+ {"tag", __builtin_constant_p(test15_v) && !test15_v ? 0x10 : 0 },
+};
More information about the cfe-commits
mailing list