From: Timm Bäder Date: Wed, 11 Jan 2023 11:12:05 +0000 (+0100) Subject: [clang][Interp][NFC] Remove code duplication in VisitRecordInitializer X-Git-Tag: upstream/17.0.6~21404 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=78a9ee7834331fb4360457cc565fa36f5452f7e0;p=platform%2Fupstream%2Fllvm.git [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. --- diff --git a/clang/lib/AST/Interp/ByteCodeExprGen.cpp b/clang/lib/AST/Interp/ByteCodeExprGen.cpp index 0c2eaac..0bbab0c 100644 --- a/clang/lib/AST/Interp/ByteCodeExprGen.cpp +++ b/clang/lib/AST/Interp/ByteCodeExprGen.cpp @@ -1041,20 +1041,12 @@ bool ByteCodeExprGen::visitRecordInitializer(const Expr *Initializer) { return true; } else if (const CallExpr *CE = dyn_cast(Initializer)) { - const Decl *Callee = CE->getCalleeDecl(); - const Function *Func = getFunction(dyn_cast(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(Initializer)) { return this->visitInitializer(DIE->getExpr()); }