This is an archive of the discontinued LLVM Phabricator instance.

Fix for PR25271: Ensure that variadic template parameter defaults PCH roundtrip
ClosedPublic

Authored by jix on Jan 13 2016, 11:30 AM.

Details

Reviewers
rsmith
Summary

Parameter default values are expected to be attached to all redeclarations of a template. During serialization they are serialized only for the first redeclaration (probably to save space, see OwnsDefaultArg in ASTDeclWriter::VisitNonTypeTemplateParmDecl in ASTWriterDecl.cpp).

During deserialization the default arguments are recovered for all redeclartions by static void inheritDefaultTemplateArguments(... in ASTReaderDecl.cpp. This function includes the following optimization: As the parameters that have default values have to be at the end of the parameter list, it inherits them from back to front, stopping at the first parameter without a default. This works fine as long as there are no parameter packs, which may follow parameters with defaults.

The fix in this patch simply checks for parameter packs and skips them, continuing the default value inheritance for the preceding parameters.

Diff Detail

Repository
rL LLVM

Event Timeline

jix updated this revision to Diff 44772.Jan 13 2016, 11:30 AM
jix retitled this revision from to Fix for PR25271: Ensure that variadic template parameter defaults PCH roundtrip.
jix updated this object.
jix set the repository for this revision to rL LLVM.
jix added a subscriber: cfe-commits.
jix added a reviewer: rsmith.Jan 15 2016, 8:19 AM
rsmith accepted this revision.Feb 4 2016, 11:48 AM
rsmith edited edge metadata.

LGTM, thanks!

This revision is now accepted and ready to land.Feb 4 2016, 11:48 AM
rsmith closed this revision.Feb 4 2016, 2:58 PM

Committed as r259836.