Commit Graph

192 Commits

Author SHA1 Message Date
David Ungar
c25de6af75 Merge pull request #27221 from davidungar/A-9-17-astscope-off
[NFC, NameLookup, ASTScope] Bug fix for eager scope tree construction & better failure messages
2019-09-22 19:10:58 -07:00
David Ungar
a9a9069591 change compare-to-astScope-lookup to crosscheck-unqualified-lookup 2019-09-22 17:59:39 -07:00
David Ungar
87535dfd84 Silence a warning 2019-09-22 17:59:39 -07:00
David Ungar
b47bd97a3b De-experimentalify 2019-09-22 17:59:39 -07:00
David Ungar
7736009f92 Fix debug code 2019-09-22 17:59:39 -07:00
Jordan Rose
8d7f1b7c5d [AST] Separate SourceFile from FileUnit.h
Like the last commit, SourceFile is used a lot by Parse and Sema, but
less so by the ClangImporter and (de)Serialization. Split it out to
cut down on recompilation times when something changes.

This commit does /not/ split the implementation of SourceFile out of
Module.cpp, which is where most of it lives. That might also be a
reasonable change, but the reason I was reluctant to is because a
number of SourceFile members correspond to the entry points in
ModuleDecl. Someone else can pick this up later if they decide it's a
good idea.

No functionality change.
2019-09-17 17:54:41 -07:00
Jordan Rose
853caa66d4 [AST] Split FileUnit and its subclasses out of Module.h
Most of AST, Parse, and Sema deal with FileUnits regularly, but SIL
and IRGen certainly don't. Split FileUnit out into its own header to
cut down on recompilation times when something changes.

No functionality change.
2019-09-17 17:54:41 -07:00
David Ungar
968c5a8282 Eager tree building for primaries 2019-09-13 17:22:50 -07:00
David Ungar
6aa1952a83 Fixes so can recurse back into tree. 2019-09-13 17:08:10 -07:00
Doug Gregor
d8b745db77 Add a request to lazily parse function bodies.
Rework the lazy function body parsing mechanism to use the
request-evaluator, so that asking for the body of a function will
initiate parsing. Clean up a number of callers to
AbstractFunctionDecl::getBody() that don't actually need the body, so
we don't perform unnecessary parsing.

This change does not delay parsing of function bodies in the general
case; rather, it sets up the infrastructure to always delay parsing of
function bodies.
2019-08-31 16:23:08 -07:00
eeckstein
903eeb220b Revert "Add a request to lazily parse function bodies." 2019-08-31 12:29:01 +02:00
Doug Gregor
7ce3553c45 Merge pull request #26972 from DougGregor/request-function-body-parse
Add a request to lazily parse function bodies.
2019-08-30 21:57:15 -07:00
Doug Gregor
2ab05a6835 Add a request to lazily parse function bodies.
Rework the lazy function body parsing mechanism to use the
request-evaluator, so that asking for the body of a function will
initiate parsing. Clean up a number of callers to
AbstractFunctionDecl::getBody() that don't actually need the body, so
we don't perform unnecessary parsing.

This change does not delay parsing of function bodies in the general
case; rather, it sets up the infrastructure to always delay parsing of
function bodies.
2019-08-30 16:48:23 -07:00
Slava Pestov
37f308b8d3 AST: Change lookupInModule() to take a DeclContext instead of a module and extra imports
Also get rid of the 'accessPath' parameter.
2019-08-28 21:09:23 -04:00
Slava Pestov
71eae3222c AST: Use ImportCache to simplify UnqualifiedLookupFactory::lookForAModuleWithTheGivenName() 2019-08-28 16:29:50 -04:00
Slava Pestov
b3d95d7968 AST: removeShadowedDecls() takes a DeclContext instead of a ModuleDecl
This allows shadowing rules to depend on the current SourceFile and
not just the current ModuleDecl. For now, this isn't actually
taken advantage of.
2019-08-28 15:41:03 -04:00
David Ungar
5e14ed3f7d Merge pull request #26859 from davidungar/A-8-15-astscope-off
[NameLookup ASTScopes] Still off-by-default, but much closer to turning on
2019-08-26 18:32:30 -07:00
David Ungar
7992e1c6c4 Lots of cleanups, renamings, etc. 2019-08-26 16:55:18 -07:00
Slava Pestov
d13353f43a AST: Split off ModuleNameLookup.h from NameLookup.h 2019-08-23 23:35:25 -04:00
Slava Pestov
80ccbe5116 AST: Stop passing around a LazyResolver in name lookup
Note that in all cases it was either nullptr or ctx.getLazyResolver().
While passing in nullptr might appear at first glance to mean something
("don't type check anything"), in practice we would check for a nullptr
value and pull out ctx.getLazyResolver() instead. Furthermore, with
the lazy resolver going away (at least for resolveDeclSignature() calls),
it won't make sense to do that anymore anyway.
2019-08-19 23:00:57 -04:00
Slava Pestov
94c5a35bf2 AST: Add some counters related to name lookup 2019-08-19 23:00:57 -04:00
Rintaro Ishizaki
0555d30b8c Merge pull request #26546 from rintaro/ide-completion-rdar53034550
[AST] Be lenient with PatternBindingIntializer without PatBindingDecl
2019-08-13 21:21:37 +02:00
Rintaro Ishizaki
428bbe1060 [AST] Be lenient with PatternBindingIntializer without PatBindingDecl
PatternBindingInitializer may not be attached to any
PatternBindingDecl. e.g.

  struct S {
    @CustomAttr(something)
  }

In this case DeclContext for 'something' is PatternBindingInitializer,
but it doesn't have PatternBindingDecl because it's not written yet.

Fixes a crash in code-completion.

rdar://problem/53034550
2019-08-08 10:48:47 -07:00
David Ungar
3a2d284d5d Merge pull request #26535 from davidungar/A-7-9-astscope-no-nesting-off
[NameLookup ASTScope] Latest experimental ASTScope code, off by default.
2019-08-07 19:02:09 -07:00
David Ungar
5b1726e99a ASTScope off by default 2019-08-07 11:59:44 -07:00
David Ungar
09342dfa47 Add frontend flag -warn-if-astscope-lookup w/ test 2019-08-06 23:17:49 -07:00
David Ungar
f64033a2d2 Manual rebase with master 2019-08-06 22:13:20 -07:00
David Ungar
3a3145c0f4 Alternate SelfDC computation, fixes, and cleanups.
ASTScopeLookup by default
Create empty fn bodies for IDE tests.
Include initializer source range for property wrappers.
Add -disable-astscope-lookup
2019-06-23 09:17:09 -07:00
David Ungar
aac3a3d2ae Add a test & don’t look for a module with a special name. 2019-06-20 11:19:12 -07:00
David Ungar
375e21232f Don’t lookupOverrides of special names. 2019-06-18 15:01:14 -07:00
David Ungar
69f6b41a13 Use unique_ptr for Scope, getScope returns a reference 2019-06-12 07:29:00 -07:00
David Ungar
2e9f6c0f15 Formats and fixes 2019-06-08 11:51:35 -07:00
David Ungar
13d3c009be Fixes to build release version. 2019-06-05 17:18:05 -07:00
David Ungar
f36648463a rm finishExpansion 2019-06-05 12:15:01 -07:00
David Ungar
15cc98cc14 WIP HERE 2019-06-04 21:52:57 -07:00
David Ungar
606ce7b8cb pattern fixes 2019-06-04 20:50:59 -07:00
David Ungar
94bd4a801a fmt 2019-06-04 18:11:35 -07:00
David Ungar
bae074e2ef More gross hackery for top-level 2019-06-04 18:10:59 -07:00
David Ungar
8ff4309580 WIP, unfmt 2019-06-04 17:14:32 -07:00
David Ungar
5c3bea52b1 Fixes 2019-06-04 11:01:41 -07:00
David Ungar
ad77af1b87 Catch top-level dependency for use under pattern.
var x = 3
_ = x
2019-06-03 21:13:25 -07:00
David Ungar
29f0204cdb WIP 2019-06-03 19:56:21 -07:00
David Ungar
665a282995 Temp debug change 2019-06-02 18:14:54 -07:00
David Ungar
5b2bf1268f Fix debug code. 2019-06-02 18:13:50 -07:00
David Ungar
e48ea31ce7 NDEBUG typo fix 2019-06-02 18:12:47 -07:00
David Ungar
8814390225 ifndef NDEBUG nify 2019-05-28 14:40:10 -07:00
David Ungar
3f820c374e Some review tweaks. 2019-05-28 11:12:12 -07:00
David Ungar
663760e3b7 ASTOOScope ontology 2019-05-28 10:48:22 -07:00
Slava Pestov
df633ffcbf AST: Fix shouldLookupMembers() for invalid extensions and nominals
If there are no braces, the start and end location of the range is
the same token. When performing a lookup at this token's location,
don't consider it to be "inside" the braces.

NFC for now, but this problem causes some tests to fail once we
enable cycle diagnostics.
2019-04-22 21:51:42 -04:00
Jordan Rose
0ba6c495ba Add @_implementationOnly
This is an attribute that gets put on an import in library FooKit to
keep it from being a requirement to import FooKit. It's not checked at
all, meaning that in this form it is up to the author of FooKit to
make sure nothing in its API or ABI depends on the implementation-only
dependency. There's also no debugging support here (debugging FooKit
/should/ import the implementation-only dependency if it's present).

The goal is to get to a point where it /can/ be checked, i.e. FooKit
developers are prevented from writing code that would rely on FooKit's
implementation-only dependency being present when compiling clients of
FooKit. But right now it's not.

rdar://problem/48985979
2019-03-28 15:57:53 -07:00