[PATCH] D151587: [clang][ConstantEmitter] have tryEmitPrivate[ForVarInit] try ConstExprEmitter fast-path first
    Nick Desaulniers via Phabricator via cfe-commits 
    cfe-commits at lists.llvm.org
       
    Fri Jul 21 12:54:56 PDT 2023
    
    
  
nickdesaulniers added inline comments.
================
Comment at: clang/lib/AST/Expr.cpp:3444
     if (CE->getCastKind() == CK_NoOp ||
         CE->getCastKind() == CK_LValueToRValue ||
         CE->getCastKind() == CK_ToUnion ||
----------------
efriedma wrote:
> nickdesaulniers wrote:
> > efriedma wrote:
> > > efriedma wrote:
> > > > An CK_LValueToRValue conversion needs to change IsForRef (or else you're checking whether the address of the value is constant, not the value itself).
> > > Not sure what I was thinking when I wrote the original comment here.  We need to bail on LValueToRValue here: the only way to correctly do an lvalue-to-rvalue conversion is to evaluate the operand as an lvalue, then convert the resulting lvalue to an rvalue.  We need to use ExprConstant to do that.
> > when you say `we need to bail on LValueToRValue here` do you just `return false` for that case or what?
> Probably just "break;".
I guess this thread is moot if I go back to the way this was previously written...(running tests on that now).
Repository:
  rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D151587/new/
https://reviews.llvm.org/D151587
    
    
More information about the cfe-commits
mailing list