Commit Graph

14 Commits

Author SHA1 Message Date
Richard Smith 2195ec9ad4 [modules] Properly look up the owning module for an instantiation of a merged template.
When looking for the template instantiation pattern of a templated entity,
consistently select the definition of the pattern if there is one. This means
we'll pick the same owning module when we start instantiating a template that
we'll later pick when determining which modules are visible during that
instantiation.

This reinstates r300650, reverted in r300659, with a fix for a regression
reported by Chandler after commit.

llvm-svn: 300938
2017-04-21 01:15:13 +00:00
Chandler Carruth bd186c0787 Revert r300653 and r300650. The underlying commit fixes one issue with
modules but exposes much more widespread issues. Example and more
information is on the review thread for r300650.

Original commit summary:
[modules] Properly look up the owning module for an instantiation of a merged template.

llvm-svn: 300659
2017-04-19 05:25:13 +00:00
Richard Smith 5aacc4021b [modules] Properly look up the owning module for an instantiation of a merged template.
When looking for the template instantiation pattern of a templated entity,
consistently select the definition of the pattern if there is one. This means
we'll pick the same owning module when we start instantiating a template that
we'll later pick when determining which modules are visible during that
instantiation.

llvm-svn: 300650
2017-04-19 01:36:43 +00:00
Richard Smith 535ff80354 [modules] When picking one of two template declarations as a lookup result,
it's not sufficient to prefer the declaration with more default arguments, or
the one that's visible; they might both be visible, but one of them might have
a visible default argument where the other has a hidden default argument.

llvm-svn: 247486
2015-09-11 22:39:35 +00:00
Richard Smith 6dc8ae10aa [modules] When parsing the base specifiers of a parse-merged class, the current
context is the class itself but lookups should be performed starting with the
lookup parent of the class (class and base members don't shadow types from the
surrounding context because they have not been declared yet).

llvm-svn: 245236
2015-08-17 20:24:17 +00:00
Richard Smith 4440d6eae0 [modules] Add (already passing) test for template default argument merging when the template is declared in a namespace.
llvm-svn: 242653
2015-07-19 23:44:27 +00:00
Richard Smith afe800c456 [modules] Fix typo in default argument merging.
llvm-svn: 239954
2015-06-17 22:13:23 +00:00
Richard Smith 35c1df5cb6 [modules] Improve diagnostic for a template-id that's invalid because a default
argument is not visible.

llvm-svn: 239934
2015-06-17 20:16:32 +00:00
Richard Smith 47972afd10 [modules] Simplify -cc1 interface for enabling implicit module maps.
We used to have a flag to enable module maps, and two more flags to enable
implicit module maps. This is all redundant; we don't need any flag for
enabling module maps in the abstract, and we don't usually have -fno- flags for
-cc1. We now have just a single flag, -fimplicit-module-maps, that enables
implicitly searching the file system for module map files and loading them.

The driver interface is unchanged for now. We should probably rename
-fmodule-maps to -fimplicit-module-maps at some point.

llvm-svn: 239789
2015-06-16 00:08:24 +00:00
Richard Smith 95d83959d8 [modules] Don't allow use of non-visible (inherited) default template arguments.
llvm-svn: 239487
2015-06-10 20:36:34 +00:00
Richard Smith e7bd6defd7 [modules] Track all default template arguments for a given parameter across
modules, and allow use of a default template argument if any of the parameters
providing it is visible.

llvm-svn: 239485
2015-06-10 20:30:23 +00:00
Richard Smith 8dbe7e236c Revert accidentally-committed test change from r239447.
llvm-svn: 239452
2015-06-10 01:36:14 +00:00
Richard Smith 1469b9196c Refactor storage of default template arguments.
This is just a preparatory step towards fixing visibility for default template
arguments in modules builds.

llvm-svn: 239447
2015-06-10 00:29:03 +00:00
Richard Smith 87bb569844 [modules] Fix some visibility issues with default template arguments.
There are still problems here, but this is a better starting point.

The main part of the change is: when doing a lookup that would accept visible
or hidden declarations, prefer to produce the latest visible declaration if
there are any visible declarations, rather than always producing the latest
declaration.

Thus, when we inherit default arguments (and other properties) from a previous
declaration, we inherit them from the previous visible declaration; if the
previous declaration is hidden, we already suppress inheritance of default
arguments.

There are a couple of other changes here that fix latent bugs exposed by this
change.

llvm-svn: 239371
2015-06-09 00:35:49 +00:00