[PATCH] D148206: [clang] Do not crash after suggesting typo correction to constexpr if condition
    Aaron Ballman via Phabricator via cfe-commits 
    cfe-commits at lists.llvm.org
       
    Thu Apr 13 07:57:22 PDT 2023
    
    
  
aaron.ballman added inline comments.
================
Comment at: clang/include/clang/Sema/Sema.h:12855
+                        !Condition.get()->isValueDependent() &&
+                        Condition.get()->isIntegerConstantExpr(S.Context)),
           KnownValue(HasKnownValue &&
----------------
Oof, this adds quite a bit of expense to this constructor -- `isIntegerConstantExpr()` is implemented by evaluating the constant expression and throwing away the computed result... which we then recompute when setting `KnownValue` one line later. It'd be better to only do this computation once and use the computed value to initialize both members.
Repository:
  rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D148206/new/
https://reviews.llvm.org/D148206
    
    
More information about the cfe-commits
mailing list