Skip to content

Commit 685dde2

Browse files
committed
move assert(fun->arg_size() >= 1) ahead
1 parent d5d4a00 commit 685dde2

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

svf-llvm/lib/CppUtil.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -529,12 +529,12 @@ const Argument* cppUtil::getConstructorThisPtr(const Function* fun)
529529
{
530530
assert((isConstructor(fun) || isDestructor(fun)) &&
531531
"not a constructor?");
532-
// If param 0 is sret, 'this' is typically param 1, but be defensive.
533-
const bool isStructRet = fun->hasParamAttribute(0, llvm::Attribute::StructRet);
534-
535532
// We always need at least one argument to return something meaningful.
536533
assert(fun->arg_size() >= 1 && "expected at least one argument");
537534

535+
// If param 0 is sret, 'this' is typically param 1, but be defensive.
536+
const bool isStructRet = fun->hasParamAttribute(0, llvm::Attribute::StructRet);
537+
538538
// Prefer arg1 when sret is present and available; otherwise fall back to arg0.
539539
const u32_t thisIdx = (isStructRet && fun->arg_size() >= 2) ? 1 : 0;
540540
const Argument* thisPtr = fun->getArg(thisIdx);

0 commit comments

Comments
 (0)