Author: Timm Bäder
Date: 2023-01-25T16:59:19+01:00
New Revision: 8b70d97c39174e1547447e8d33b228384987a152

URL: 
https://github.com/llvm/llvm-project/commit/8b70d97c39174e1547447e8d33b228384987a152
DIFF: 
https://github.com/llvm/llvm-project/commit/8b70d97c39174e1547447e8d33b228384987a152.diff

LOG: [clang][Interp][NFC] Use InitThisField in initializers

This creates fewer instructions, makes the bytecode easier to read and
InitThisField also cares about checkingPotentialConstantExpression()
cases.

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/clang/lib/AST/Interp/ByteCodeStmtGen.cpp 
b/clang/lib/AST/Interp/ByteCodeStmtGen.cpp
index ed8794f49a64..522b04254e85 100644
--- a/clang/lib/AST/Interp/ByteCodeStmtGen.cpp
+++ b/clang/lib/AST/Interp/ByteCodeStmtGen.cpp
@@ -107,16 +107,10 @@ bool ByteCodeStmtGen<Emitter>::visitFunc(const 
FunctionDecl *F) {
         const Record::Field *F = R->getField(Member);
 
         if (std::optional<PrimType> T = this->classify(InitExpr)) {
-          if (!this->emitThis(InitExpr))
-            return false;
-
           if (!this->visit(InitExpr))
             return false;
 
-          if (!this->emitInitField(*T, F->Offset, InitExpr))
-            return false;
-
-          if (!this->emitPopPtr(InitExpr))
+          if (!this->emitInitThisField(*T, F->Offset, InitExpr))
             return false;
         } else {
           // Non-primitive case. Get a pointer to the field-to-initialize


        
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to