Commit Graph

532 Commits

Author SHA1 Message Date
Ben Langmuir 34da079aa6 Pass DynamicLookupInfo through VisibleDeclConsumers NFC
This commit adds a new type DynamicLookupInfo that provides information
about how a dynamic member lookup found a particular Decl. This is
needed to correctly handle KeyPath dynamic member lookups, but for now
just plumb it through everywhere.
2019-05-06 10:02:39 -07:00
Slava Pestov 07ce01d96d AST: Replace ASTContext's ObjCMethodConflicts list with a per-SourceFile list 2019-04-22 20:42:08 -04:00
Slava Pestov e97fc4e0c2 AST: Replace ASTContext's ObjCMethods list with a per-SourceFile list 2019-04-22 20:42:07 -04:00
Joe Groff 5e1497967a Parse opaque types. 2019-04-17 14:43:32 -07:00
Gogul Balakrishnan 1fa3846224 Add more hooks for overriding name lookup in the DebuggerClient (#23031) 2019-04-08 15:19:31 -07:00
Michael Gottesman 564b4fc11a [silgenpattern] Fix some stack-use-after-free errors caused by iterating over an Optional<ArrayRef<T>>.
Specifically the bad pattern was:

```
   for (auto *vd : *caseStmt->getCaseBodyVariables()) { ... }
```

The problem is that the optional is not lifetime extended over the for loop. To
work around this, I changed the API of CaseStmt's getCaseBodyVariable methods to
never return the inner Optional<MutableArrayRef<T>>. Now we have the following 3
methods (ignoring const differences):

1. CaseStmt::hasCaseBodyVariables().

2. CaseStmt::getCaseBodyVariables(). Asserts if the case body variable array was
   never specified.

3. CaseStmt::getCaseBodyVariablesOrEmptyArray(). Returns either the case body
   variables array or an empty array if we were never given any case body
   variable array.

This should prevent anyone else in the future from hitting this type of bug.

radar://49609717
2019-04-04 13:34:36 -07:00
Michael Gottesman 7b0d8455ca [ast][silgen] Wire up the case body var decls and use them in SILGenPattern emission to fix the evil fallthrough bug.
rdar://47467128
2019-04-03 23:51:06 -07:00
Doug Gregor a848d12665 Parse unknown attributes as "custom" attributes.
Parse custom attributes with the grammar:

```
'@' type-identifier expr-paren?
```
2019-03-29 23:10:36 -07:00
Doug Gregor 9e5d8ee222 Merge pull request #22977 from DougGregor/constraint-solver-common-result-type
[Constraint solver] Compute common apply result type in the solver.
2019-02-28 23:48:17 -08:00
Doug Gregor 0ea6536b95 [Name shadowing] Extend Objective-C initializer shadowing to imported inits.
There are multiple ways in which the Clang importer can produce an
initializer, and we have existing name shadowing rules to decide on
the best. Extend those rules to cover the case where a
Clang-importer-synthesized initializer collides with a C function
imported as an initializer. There's technically no reason to do the
latter because the former already exists, but some frameworks
currently depend on this.

Prior to this, the constraint solver was preferring the synthesized
initializer already (which is the right thing to do), for the wrong
reasons.
2019-02-28 09:13:32 -08:00
David Ungar 6982e66ddf Refactor filterForDiscriminator and call of addLocalVariableResults. 2019-02-22 12:41:03 -07:00
David Ungar 5d49b3bb3d Minor cleanumps 2019-02-20 14:41:23 -07:00
David Ungar cd48cd6eb3 Format 2019-02-20 14:35:52 -07:00
David Ungar 1595efe5e2 Split the file, unfmt 2019-02-20 14:34:11 -07:00
David Ungar 80a234a2ef Use a struct instead of a pair 2019-02-20 11:08:06 -07:00
David Ungar e9277469fb Unify two cases 2019-02-20 10:38:55 -07:00
David Ungar 1ce86b9def Minor fixes 2019-02-20 10:30:51 -07:00
David Ungar 8e7ff01caa WIP 2019-02-19 15:09:46 -07:00
David Ungar d776cf5996 Some reordering 2019-02-19 15:03:42 -07:00
David Ungar edaec2aea5 Move searchPlacesToSearch into PlacesToSearch 2019-02-19 11:24:51 -07:00
David Ungar ef9f99e37c Rename ExpUnqalifiedLookup to UnqualifiedLookup, UnqualifiedLookup to LegacyUnqualifiedLookup 2019-02-19 10:55:44 -07:00
David Ungar 65f8f73992 Todo editing 2019-02-19 10:22:11 -07:00
David Ungar 0aee0dba4b 1st cut finish redo, unfmt 2019-02-18 15:30:18 -07:00
David Ungar 272df9f3b7 Minor return cleanup. 2019-02-17 23:23:27 -07:00
David Ungar b52b85b884 Factor isCascadingUse resolution. 2019-02-17 23:07:01 -07:00
David Ungar 7631ae9148 Manual format correction and added TODOs 2019-02-17 22:35:48 -07:00
David Ungar 13176ff4cf Format 2019-02-17 21:53:42 -07:00
David Ungar 65967171de Move factory method bodies out. 2019-02-17 21:53:14 -07:00
David Ungar 97602a9829 Broke up finishLookup 2019-02-17 14:00:15 -07:00
David Ungar ca025ab8cf First cut no mutable isCascadingUse 2019-02-17 13:14:55 -07:00
David Ungar 92faaae093 constification 2019-02-17 00:16:18 -07:00
David Ungar 2fd4e2d9de Format 2019-02-17 00:12:11 -07:00
David Ungar b02b682766 Eliminating mutable DC 2019-02-17 00:11:49 -07:00
David Ungar 977b0db93d Nonfmt cut down on DC 2019-02-16 23:35:25 -07:00
David Ungar 3c295f8228 Group lookupDecls etc into PlacesToSearch 2019-02-16 22:43:10 -07:00
David Ungar 79906debe2 Factor isOutsideBodyOfFunction 2019-02-16 21:07:02 -07:00
David Ungar ee3c2eea81 Don’t use DC 2019-02-16 21:05:45 -07:00
David Ungar 65ed915fc7 Factor lookupDecl handing 2019-02-16 13:05:10 -07:00
David Ungar dbb998f189 better names 2019-02-16 12:24:53 -07:00
David Ungar ee40bfbdba Note factoring possibility 2019-02-16 12:22:30 -07:00
David Ungar ebd8b38350 Factor GenericParameterCheck 2019-02-16 12:19:16 -07:00
David Ungar 8ece21459b Push GenericParamList check into function case. 2019-02-16 11:55:41 -07:00
David Ungar 3b7131cf0b Factor each variant into a separate function. Facter out Decl dispatch. 2019-02-16 11:49:07 -07:00
David Ungar e9298a1ee0 Renamed shouldReturnBasedOnResults to isFinishedWithLookupNowThatIsAboutToLookForOuterResults 2019-02-16 11:34:43 -07:00
David Ungar 04ef0daeb8 Add ExpUnqualifiedLookup, cross-check 2019-02-16 11:31:16 -07:00
Doug Gregor 18f4bcb5ff [Name lookup] Implement name shadowing rule for Data.withUnsafeBytes.
Address an annoying source compatibility issue with the introduction
of Data.withUnsafeBytes, which is ambiguous with Swift NIO's
implementatio of the same function. Do so with a narrow hackish name
shadowing rule (the Swift NIO version shadows the Foundation version)
that we will eventually generalize to something sensible.

Fixes rdar://problem/46850346.
2019-01-23 16:45:08 -08:00
Slava Pestov 4681b9b1e4 AST: Break circularity in qualified lookup into protocol or extension with 'Self' constraints 2019-01-18 15:12:41 -05:00
Slava Pestov acb37b2b55 AST: Set ClassDecl's HasDestructor bit in one place 2019-01-18 00:15:41 -05:00
Pavel Yaskevich ddc2fa415e [AST] NFC: introduce ASTContext::isAccessControlDisabled 2019-01-11 17:30:10 -08:00
Parker Schuh f5859ff46e Rename NameAliasType to TypeAliasType. 2019-01-09 16:47:13 -08:00