Author: Timm Bäder
Date: 2023-01-11T13:08:51+01:00
New Revision: 78a9ee7834331fb4360457cc565fa36f5452f7e0

URL: 
https://github.com/llvm/llvm-project/commit/78a9ee7834331fb4360457cc565fa36f5452f7e0
DIFF: 
https://github.com/llvm/llvm-project/commit/78a9ee7834331fb4360457cc565fa36f5452f7e0.diff

LOG: [clang][Interp][NFC] Remove code duplication in VisitRecordInitializer

We can just use the regular VisitCallExpr logic here, since we have the
pointer to initialize already on the stack.

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 0c2eaac0e4e7..0bbab0cc0665 100644
--- a/clang/lib/AST/Interp/ByteCodeExprGen.cpp
+++ b/clang/lib/AST/Interp/ByteCodeExprGen.cpp
@@ -1041,20 +1041,12 @@ bool 
ByteCodeExprGen<Emitter>::visitRecordInitializer(const Expr *Initializer) {
 
     return true;
   } else if (const CallExpr *CE = dyn_cast<CallExpr>(Initializer)) {
-    const Decl *Callee = CE->getCalleeDecl();
-    const Function *Func = getFunction(dyn_cast<FunctionDecl>(Callee));
-
-    if (!Func)
+    // RVO functions expect a pointer to initialize on the stack.
+    // Dup our existing pointer so it has its own copy to use.
+    if (!this->emitDupPtr(Initializer))
       return false;
 
-    if (Func->hasRVO()) {
-      // RVO functions expect a pointer to initialize on the stack.
-      // Dup our existing pointer so it has its own copy to use.
-      if (!this->emitDupPtr(Initializer))
-        return false;
-
-      return this->visit(CE);
-    }
+    return this->VisitCallExpr(CE);
   } else if (const auto *DIE = dyn_cast<CXXDefaultInitExpr>(Initializer)) {
     return this->visitInitializer(DIE->getExpr());
   }


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

Reply via email to