[PATCH] D153296: [AST] Stop evaluate constant expression if the condition expression which in switch statement contains errors
    Yurong via Phabricator via cfe-commits 
    cfe-commits at lists.llvm.org
       
    Thu Jul  6 09:40:59 PDT 2023
    
    
  
yronglin marked an inline comment as done.
yronglin added a comment.
Many thanks for all of your comments, I learned a lot from the discussions, your incredible depth of knowledge have helped fundamentally shape Clang into a great compiler! 
It seems the common denominator is that constant evaluation should stop when we encounter a value dependent expression, and return `ESR_Failed`.
================
Comment at: clang/lib/AST/ExprConstant.cpp:5019
     if (SS->getCond()->isValueDependent()) {
       if (!EvaluateDependentExpr(SS->getCond(), Info))
         return ESR_Failed;
----------------
shafik wrote:
> Please don't forget to remove this `if` and make the return unconditional as reinforced by @hokein comment above.
Thanks for your tips!, removed!
Repository:
  rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D153296/new/
https://reviews.llvm.org/D153296
    
    
More information about the cfe-commits
mailing list