Another default arg cleanup

Nathan Sidwell nathan at acm.org
Thu Jan 29 09:13:41 PST 2015


On 01/29/15 11:55, Nathan Sidwell wrote:
> Richard,
> in working on 18432 I've another cleanup patch.
>
> 1) code in Parser::ParseLexedMethodDeclaration uses 'LM.DefaultArgs[I].Param' a
> lot (and my fix for 18432 will add more).  It seemed better to break that out
> into a local var.  It's probably very hard for the compiler to do that
> localization itself, as it'd have to prove that LM.DefaultArgs[I].Param was not
> mutated by any function call -- I'd put it in the 'impossible for practical
> purposes' category.
>
> 2) Code in Sema::MergeCXXFunctionDecl looks to find the defining default arg in
> order to issue a duplicate default diagnostic.  However the current loop probes
> backwards until it finds a param without a default -- and then uses the one just
> previously found.  However, it seems simpler to just check
> hasInheritedDefaultArg and stop on the first param without that.

Oh crap.  Noticed a defect in that hunk.  Please disregard it.




More information about the cfe-commits mailing list