[clang] 33ba940 - [clang][Interp][NFCI] Support more expression in initializers

Timm Bäder via cfe-commits cfe-commits at lists.llvm.org
Sun Mar 5 01:00:20 PST 2023


Author: Timm Bäder
Date: 2023-03-05T09:57:52+01:00
New Revision: 33ba940de0401c91b4d7e12d98972e6ba0f0f662

URL: https://github.com/llvm/llvm-project/commit/33ba940de0401c91b4d7e12d98972e6ba0f0f662
DIFF: https://github.com/llvm/llvm-project/commit/33ba940de0401c91b4d7e12d98972e6ba0f0f662.diff

LOG: [clang][Interp][NFCI] Support more expression in initializers

Added: 
    

Modified: 
    clang/lib/AST/Interp/ByteCodeExprGen.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/AST/Interp/ByteCodeExprGen.cpp b/clang/lib/AST/Interp/ByteCodeExprGen.cpp
index 1740c5dd939e3..bc682c92c143f 100644
--- a/clang/lib/AST/Interp/ByteCodeExprGen.cpp
+++ b/clang/lib/AST/Interp/ByteCodeExprGen.cpp
@@ -1337,6 +1337,8 @@ bool ByteCodeExprGen<Emitter>::visitArrayInitializer(const Expr *Initializer) {
     return true;
   } else if (const auto *CLE = dyn_cast<CompoundLiteralExpr>(Initializer)) {
     return visitInitializer(CLE->getInitializer());
+  } else if (const auto *EWC = dyn_cast<ExprWithCleanups>(Initializer)) {
+    return visitInitializer(EWC->getSubExpr());
   }
 
   assert(false && "Unknown expression for array initialization");
@@ -1412,6 +1414,8 @@ bool ByteCodeExprGen<Emitter>::visitRecordInitializer(const Expr *Initializer) {
     return this->visitInitializer(DIE->getExpr());
   } else if (const auto *CE = dyn_cast<CastExpr>(Initializer)) {
     return this->visitInitializer(CE->getSubExpr());
+  } else if (const auto *CE = dyn_cast<CXXBindTemporaryExpr>(Initializer)) {
+    return this->visitInitializer(CE->getSubExpr());
   }
 
   return false;


        


More information about the cfe-commits mailing list