@@ -2477,34 +2477,31 @@ std::optional<clang::QualType> GetOperandImplicitConversionTarget(
24772477 return std::nullopt ;
24782478}
24792479
2480- bool IsTransparentStdCall (const clang::CallExpr *expr) {
2481- const auto *callee = expr->getDirectCallee ();
2482- if (!callee) {
2483- return false ;
2484- }
2485- switch (callee->getBuiltinID ()) {
2486- case clang::Builtin::BImove:
2487- case clang::Builtin::BImove_if_noexcept:
2488- case clang::Builtin::BIforward:
2489- case clang::Builtin::BIforward_like:
2490- case clang::Builtin::BIas_const:
2491- return true ;
2492- default :
2480+ bool IsTransparentStdCall (clang::ASTContext &ctx, const clang::CallExpr *expr) {
2481+ auto *rule = RuleRegistry::GetExprRule (ctx, expr);
2482+ if (!rule || rule->body .size () != 1 ||
2483+ !RuleRegistry::ReturnsReference (expr) ||
2484+ clang::isa<clang::CXXMemberCallExpr>(expr) || expr->getNumArgs () == 0 ) {
24932485 return false ;
24942486 }
2487+ auto *ph = std::get_if<TranslationRule::PlaceholderFragment>(&rule->body [0 ]);
2488+ return ph && ph->n == 0 &&
2489+ ctx.hasSameUnqualifiedType (expr->getArg (0 )->getType (),
2490+ expr->getType ());
24952491}
24962492
2497- const clang::Expr *IgnoreTransparentStdCall (const clang::Expr *expr) {
2493+ const clang::Expr *IgnoreTransparentStdCall (clang::ASTContext &ctx,
2494+ const clang::Expr *expr) {
24982495 if (const auto *call =
24992496 clang::dyn_cast<clang::CallExpr>(expr->IgnoreParenImpCasts ());
2500- call && IsTransparentStdCall (call)) {
2497+ call && IsTransparentStdCall (ctx, call)) {
25012498 return call->getArg (0 );
25022499 }
25032500 return expr;
25042501}
25052502
2506- bool IsTemporaryObject (const clang::Expr *expr) {
2507- const auto *operand = IgnoreTransparentStdCall (expr);
2503+ bool IsTemporaryObject (clang::ASTContext &ctx, const clang::Expr *expr) {
2504+ const auto *operand = IgnoreTransparentStdCall (ctx, expr);
25082505 if (operand != expr) {
25092506 return !operand->isGLValue ();
25102507 }
0 commit comments