aaron.ballman accepted this revision.
aaron.ballman added a comment.
This revision is now accepted and ready to land.
LGTM aside from a minor cleanup.



================
Comment at: clang/lib/AST/Interp/ByteCodeExprGen.cpp:1165
+    return visit(LV);
+
   return false;
----------------
tbaeder wrote:
> Since complex types are arrays with two elements, we can't dereference them 
> like normal. This change just ignore the dereference.
> 
> I was wondering if it would be better to add an opcode to dereference it so 
> we have `[real, imag]` on the stack and then callers that operate on such 
> complex rvalues can `pop(); pop();` to get the values.
> I was wondering if it would be better to add an opcode to dereference it so 
> we have [real, imag] on the stack and then callers that operate on such 
> complex rvalues can pop(); pop(); to get the values.

That might be worthwhile as an optimization, but I suppose we can wait to see 
how often complex is used in constant expressions before deciding what to do 
there?


================
Comment at: clang/lib/AST/Interp/ByteCodeExprGen.h:272-275
+    assert(T->isAnyComplexType());
+
+    QualType ElemType = T->getAs<ComplexType>()->getElementType();
+
----------------
This form does the assertion for you.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D148426

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to