[PATCH] D141497: [clang][Interp] Record initialization via conditional operator

Erich Keane via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Mar 24 06:58:55 PDT 2023


erichkeane added inline comments.


================
Comment at: clang/lib/AST/Interp/ByteCodeExprGen.h:182-183
 
+  template <typename VisitFn>
+  bool visitConditional(const AbstractConditionalOperator *E, VisitFn V);
+
----------------
tbaeder wrote:
> aaron.ballman wrote:
> > The template definition isn't available within the header file, so this is fragile (impossible to instantiate from anything but ByteCodeExprGen.cpp).
> What's the alternative? If I make it a static function in `ByteCodeExprGen.cpp`, I'd have to make a lot of members of `ByteCodeEmitter` etc. public which  is not a very clean solution. Moving the definition into the header file isn't very nice either, all the others are in the source file.
What about making it a static template in `ByteCodeExprGen.cpp`, but make it a 'friend' here?  I think that would work, wouldn't it?  Something like: https://godbolt.org/z/ofYbGvfYa

You unfortunately cannot make it static, but as it is a template, at least it is inline.  WDYT?


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

https://reviews.llvm.org/D141497



More information about the cfe-commits mailing list