[PATCH] D146408: [clang][Interp] Start supporting complex types

Timm Bäder via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Mar 28 08:05:19 PDT 2023


tbaeder added inline comments.


================
Comment at: clang/lib/AST/Interp/ByteCodeExprGen.cpp:1595
+    return true;
+  } else if (const auto *CE = dyn_cast<CallExpr>(Initializer)) {
+    if (!this->emitDupPtr(Initializer))
----------------
aaron.ballman wrote:
> Member calls as well?
Yes, and some others, but I've only added the minimum for now to keep the patch small.


================
Comment at: clang/test/AST/Interp/complex.cpp:7
+
+constexpr _Complex double z1 = {1.0, 2.0};
+static_assert(__real(z1) == 1.0);
----------------
aaron.ballman wrote:
> tbaeder wrote:
> > aaron.ballman wrote:
> > > Can you add tests for `_Complex int` as well? (That's also covered by `isAnyComplexType()`)
> > There's a `FIXME` comment above in `EvalEmitter.cpp` so returning those doesn't work yet (but is otherwise not problematic I think.)
> Hmmm, why the FIXME instead of just making the complex int type? (Alternatively, should we not use `isAnyComplexType()` and wait to add complex int support later?)
Added int support, I just wasn't sure about the `INT_TYPE_SWITCH`.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D146408



More information about the cfe-commits mailing list