[PATCH] D131555: [Clang] Propagate const context info when emitting compound literal

Ties Stuij via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 11 03:23:02 PDT 2022


stuij marked 2 inline comments as done.
stuij added inline comments.


================
Comment at: clang/lib/CodeGen/CGExprConstant.cpp:2217
   assert(E->isFileScope() && "not a file-scope compound literal expr");
-  return tryEmitGlobalCompoundLiteral(*this, nullptr, E);
+  ConstantEmitter emitter(*this, nullptr);
+  return tryEmitGlobalCompoundLiteral(emitter, E);
----------------
vhscampos wrote:
> vhscampos wrote:
> > This constructor has the second parameter optional anyway. I suggest you omit the nullptr here.
> To clarify, when I say optional, I mean it has a default value with is already nullptr
done. thanks!


================
Comment at: clang/test/CodeGen/const-init.c:1
-// RUN: %clang_cc1 -no-opaque-pointers -triple i386-pc-linux-gnu -ffreestanding -Wno-pointer-to-int-cast -Wno-int-conversion -emit-llvm -o - %s | FileCheck %s
+// RUN: %clang_cc1 -no-opaque-pointers -triple i386-pc-linux-gnu -ffreestanding -Wno-pointer-to-int-cast -Wno-int-conversion -ffp-exception-behavior=strict -emit-llvm -o - %s | FileCheck %s
 
----------------
simon_tatham wrote:
> I think some kind of a comment would be useful saying what this option is doing there -- at least, which one of the tests further down the file it's supposed to apply to. Otherwise I could easily imagine someone throwing it out again, and since the test would pass anyway, not noticing that it's no longer testing what it's meant to test.
thanks, yes is done. I also added a check on generation of the float value.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D131555/new/

https://reviews.llvm.org/D131555



More information about the cfe-commits mailing list