[PATCH] D38320: [clang] Fix serializers for `TypeTemplateParmDecl` + related types

Steve O'Brien via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jan 3 20:52:52 PST 2018


elsteveogrande updated this revision to Diff 128593.
elsteveogrande added a comment.

Update: now works properly with modules as well.

This needed to handle the case where a `ParmDecl` is already inheriting, but it's innocuously inheriting from the same decl.  Now `inheritDefaultTemplateArgument` will return successfully and avoid the assertion error saying that `default argument already inherited`.

We'll now possibly step once or twice through the inheritance list, so when a `ParmDecl` is inheriting from another `ParmDecl`, which *itself* is inheriting from a third decl.  This is the case where `inheritDefaultTemplateArgument` is called with `From` being an inheriting (and not "owning") template parameter.

Modules make use of the `Chain` struct as well, and IIUC this can lead to one extra level of indirection, as it too has a `ParmDecl *` field.  So this now handles up to 2 indirections before validating that the inheritance is consistent.

Passes existing and new tests; also works with a mini project that uses modules, which was previously broken.


Repository:
  rC Clang

https://reviews.llvm.org/D38320

Files:
  lib/Serialization/ASTReaderDecl.cpp
  lib/Serialization/ASTWriterDecl.cpp
  test/PCH/cxx-templates.cpp
  test/PCH/cxx-templates.h

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D38320.128593.patch
Type: text/x-patch
Size: 9379 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180104/01b0c0b5/attachment.bin>


More information about the cfe-commits mailing list