Another default arg cleanup

Nathan Sidwell nathan at acm.org
Thu Jan 29 08:55:17 PST 2015


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.

tested on x86-linux, ok?

nathan
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 18432-b.patch
Type: text/x-patch
Size: 4357 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20150129/3f74415b/attachment.bin>


More information about the cfe-commits mailing list