@@ -4830,19 +4830,6 @@ struct DestroyUnpassedArg final : EHScopeStack::Cleanup {
48304830 }
48314831};
48324832
4833- struct DisableDebugLocationUpdates {
4834- CodeGenFunction &CGF;
4835- bool disabledDebugInfo;
4836- DisableDebugLocationUpdates (CodeGenFunction &CGF, const Expr *E) : CGF(CGF) {
4837- if ((disabledDebugInfo = isa<CXXDefaultArgExpr>(E) && CGF.getDebugInfo ()))
4838- CGF.disableDebugInfo ();
4839- }
4840- ~DisableDebugLocationUpdates () {
4841- if (disabledDebugInfo)
4842- CGF.enableDebugInfo ();
4843- }
4844- };
4845-
48464833} // end anonymous namespace
48474834
48484835RValue CallArg::getRValue (CodeGenFunction &CGF) const {
@@ -4879,7 +4866,9 @@ void CodeGenFunction::EmitWritebacks(const CallArgList &args) {
48794866
48804867void CodeGenFunction::EmitCallArg (CallArgList &args, const Expr *E,
48814868 QualType type) {
4882- DisableDebugLocationUpdates Dis (*this , E);
4869+ std::optional<DisableDebugLocationUpdates> Dis;
4870+ if (isa<CXXDefaultArgExpr>(E))
4871+ Dis.emplace (*this );
48834872 if (const ObjCIndirectCopyRestoreExpr *CRE =
48844873 dyn_cast<ObjCIndirectCopyRestoreExpr>(E)) {
48854874 assert (getLangOpts ().ObjCAutoRefCount );
@@ -6294,3 +6283,12 @@ RValue CodeGenFunction::EmitVAArg(VAArgExpr *VE, Address &VAListAddr,
62946283 return CGM.getABIInfo ().EmitMSVAArg (*this , VAListAddr, Ty, Slot);
62956284 return CGM.getABIInfo ().EmitVAArg (*this , VAListAddr, Ty, Slot);
62966285}
6286+
6287+ DisableDebugLocationUpdates::DisableDebugLocationUpdates (CodeGenFunction &CGF)
6288+ : CGF(CGF) {
6289+ CGF.disableDebugInfo ();
6290+ }
6291+
6292+ DisableDebugLocationUpdates::~DisableDebugLocationUpdates () {
6293+ CGF.enableDebugInfo ();
6294+ }
0 commit comments