Commit Graph

287 Commits

Author SHA1 Message Date
Anthony Latsis
6325915b4b NFC: Solidify and tidy up the BraceStmt interface 2019-10-30 16:43:59 +03:00
David Ungar
e67921f679 Merge pull request #27786 from davidungar/fix-lazy-function-bodies-rdar-56384593
[NameLookup, ASTScope] Create lazily-parsed function body scopes.
2019-10-18 21:48:28 -07:00
David Ungar
8469abb916 Fix expansion of lazily-parsed function bodies 2019-10-18 17:01:26 -07:00
Robert Widmann
3b829943af Uniformly iterate over the pattern binding entry indices
Clarify a bunch of C-style for loops and remove a ton of references to getPatternList().
2019-10-17 13:39:07 -07:00
Robert Widmann
56b6e53dae Remove raw references to PatternBindingEntry APIs
Switch most callers to explicit indices.  The exceptions lie in things that needs to manipulate the parsed output directly including the Parser and components of the ASTScope.  These are included as friend class exceptions.
2019-10-17 13:31:14 -07:00
David Ungar
571d815c6a Remove radar numbers. 2019-10-10 17:39:42 -07:00
David Ungar
a9ab4aa8c2 Use SeparateCaching 2019-10-09 22:33:39 -07:00
David Ungar
86ec6a00da Remove include order dependency 2019-10-08 14:08:43 -07:00
David Ungar
5908cfc5ba First cut at ASTScope expansion requestification 2019-10-08 09:05:19 -07:00
Robert Widmann
2fe3ce8af8 Requestify the Raw Value Accessor
Make getRawValueExpr() return a checked value.

This entails a strange kind of request that effectively acts like
a cache warmer.  In order to properly check the raw value expression for
a single case, we actually need all the other cases for the
autoincrementing synthesis logic.  The strategy is therefore to have the
request act at the level of the parent EnumDecl and check all the values
at once.  We also cache at the level of the EnumDecl so the cache
"warms" for all enum elements simultaneously.

The request also abuses TypeResolutionStage to act as an indicator for
how much information to compute.  In the minimal case, we will return
a complete accounting of (auto-incremented) raw values.  In the maximal
case we will also check and record types and emit diagnostics.  The
minimal case is uncached to support repeated evaluation.

Note that computing the interface type of an @objc enum decl *must*
force this request.  The enum's raw values are part of the ABI, and we
should not get all the way to IRGen before discovering that we cannot
possibly lay out the enum.  In the future, we might want to consider
moving this check earlier or have IRGen tolerate broken cases but for
now we will maintain the status quo and not have IRGen emit
diagnostics.
2019-10-02 16:09:25 -07:00
David Ungar
7d2203e016 Count AST ancestor scopes instead of children when last expanded 2019-09-22 19:17:49 -07:00
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
ef570f9c45 cleanups 2019-09-22 17:59:40 -07:00
David Ungar
e59196cb62 Remove too-restrictive assertion 2019-09-22 17:59:40 -07:00
David Ungar
5144341fe7 Count AST ancestor scopes instead of children when last expanded 2019-09-22 17:59:40 -07:00
David Ungar
b943a3987f Use separate bool to record expansion 2019-09-22 17:59:40 -07:00
David Ungar
7f834cdb54 renaming to ASTAncestor 2019-09-22 17:59:40 -07:00
David Ungar
10583f89c6 Ensure that reexpansion does not lose scopes. 2019-09-22 17:59:40 -07:00
David Ungar
3c891f9532 Fully eager for printing, just eager enough for type-checking. 2019-09-22 17:59:40 -07:00
David Ungar
6e790eacc3 Rm temperature 2019-09-22 17:59:40 -07:00
David Ungar
ae7469b533 Hacked not-so-lazy 2019-09-22 17:59:40 -07:00
David Ungar
c17d9ae7bc Radar tagging 2019-09-22 17:59:40 -07:00
David Ungar
683310eb74 Ever expansion detection. WIP 2019-09-22 17:59:40 -07:00
David Ungar
c808eb5a27 Don't try to expand ASTSourceFileScope when eagerly building. 2019-09-22 17:59:40 -07:00
David Ungar
c271dc4de6 Fix typo 2019-09-22 17:59:39 -07:00
David Ungar
37b16e8b33 Tag cycles w/ radar 2019-09-22 17:59:39 -07:00
David Ungar
603cc05289 WIP lazy whole scopes 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
e3f7760154 Add explanations to all asserts. 2019-09-17 16:30:25 -07:00
David Ungar
8ebba23b06 Add ASTScope_unreachable 2019-09-17 16:03:05 -07:00
David Ungar
3966d086a5 When ASTScope assertions fails, direct user to try disabling ASTScopes. 2019-09-17 15:56:33 -07:00
David Ungar
6ec62d9784 Ensure that Decls aren't added needlessly before creating tree eagerly. 2019-09-17 13:30:54 -07:00
David Ungar
c7be2def90 Merge pull request #27143 from davidungar/A-9-12-eager-off
[NFC NameLookup ASTScope] Fixes for large app, eager primary tree creation, memberCount fix.
2019-09-14 18:46:17 -07:00
David Ungar
69afa80698 Don't need createGenericParametersIfMissing 2019-09-13 22:31:30 -07:00
David Ungar
3afd6a7146 add flag to stress scope creation 2019-09-13 22:30:49 -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
David Ungar
24ef696242 Lazy AbstractFunctionBodyScope creation 2019-09-13 17:02:51 -07:00
David Ungar
7491af9025 Optimize PatternEntryDeclScope currency check by assuming entries do not get added 2019-09-13 16:57:12 -07:00
David Ungar
7e0d96cb59 Added debugging helpers for range-matching 2019-09-13 16:19:55 -07:00
Sasha Krassovsky
1e414f7fb6 Fix warnings in AST 2019-09-13 09:57:48 -07:00
Robert Widmann
d4bb9a5cfe Define GenericParamListRequest
GenericParamListRequest formalizes the lazy generic parameter list construction pattern we were performing before.
2019-09-06 17:22:30 -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
David Ungar
f5f01012a8 Fix ASTScope PatternEntryDeclScope::beCurrent typo 2019-08-29 22:42:50 -07:00
David Ungar
7992e1c6c4 Lots of cleanups, renamings, etc. 2019-08-26 16:55:18 -07:00
David Ungar
b02b4b00ef Cleanup and fixes, also 1st cut at lazy. 2019-08-13 17:48:06 -07:00