[clang] [CIR] Add if statement support (PR #134333)

Andy Kaylor via cfe-commits cfe-commits at lists.llvm.org
Fri Apr 4 13:49:45 PDT 2025


================
@@ -164,6 +165,20 @@ class CIRGenFunction : public CIRGenTypeCache {
   /// that it requires no code to be generated.
   bool isTrivialInitializer(const Expr *init);
 
+  /// If the specified expression does not fold to a constant, or if it does but
+  /// contains a label, return false.  If it constant folds return true and set
+  /// the boolean result in Result.
+  bool ConstantFoldsToSimpleInteger(const clang::Expr *Cond, bool &ResultBool,
----------------
andykaylor wrote:

I don't like the overloading of this name. What we really mean here is `ConstantFoldsToBool`, but I'm not sure we need this function at all. See separate comments about that.

Also, these function names should start with a lowercase letter.

https://github.com/llvm/llvm-project/pull/134333


More information about the cfe-commits mailing list