Commit Graph

20 Commits

Author SHA1 Message Date
Doug Gregor
6c2bb84fea [Clang importer] Introduce StoredContext typedef; NFC 2016-03-01 16:09:57 -08:00
Doug Gregor
7265328e07 [Clang importer] Generalize name lookup tables for globals-as-members.
A swift_name attribute on a global declaration can specify a dotted
name (e.g., SomeStruct.member) to map that global into a member of the
(Swift-)named type. Handle this mapping in DeclName parsing, plumb it
through importFullName, and cope with it in the Swift name lookup
tables (tested via the dump) and importing into a Swift DeclContext
(as-yet-untested). Part of SE-0033.
2016-03-01 15:33:20 -08:00
Doug Gregor
940a65a994 [Clang importer] Make the "effective context" a core part of ImportedName.
Previously, the "effective context" parameter to importFullName was
used only during the construction of Swift name lookup tables, so we
can associate each declaration with a context. Expand the role of
"effective context" so it is always a part of ImportedName and is also
used by importDecl when actually importing the enum declaration.

This is partially a cleanup, and partially staging for SE-0033, which
will require this functionality more broadly.
2016-02-29 15:32:34 -08:00
Doug Gregor
78cb038cbb [Omit needless words] Don't prefix-strip when dumping APIs.
We're going to delay NS prefix stripping for a bit. Change the API
dump script accordingly, and bump the Swift name lookup table format
version number so this doesn't break everyone who has already run
swift-api-dump.py.
2016-02-22 14:24:20 -08:00
Doug Gregor
fa36a90d69 [Clang importer] Bump version number of Swift name lookup tables 2016-02-08 11:11:35 -08:00
Doug Gregor
03c1ac4593 [Omit needless words] Lowercase enum cases/option set members consistently. 2016-02-08 10:32:19 -08:00
Jordan Rose
69fbc5b77b Get some files off of PointerLikeTypeTraitsFwdDecl.h 2016-02-06 11:22:28 -08:00
Michael Gottesman
3556db7484 Add in explicit specializations for forward declared pointers that we use. All of the explicit specializations are in the new header "PointerLikeTypeTraitsFwdDecl.h" 2016-02-06 11:22:28 -08:00
Doug Gregor
319e2a7462 [Clang importer] Strip "NS" prefix from macro names, too 2016-02-03 21:03:09 -08:00
Zach Panzarino
e3a4147ac9 Update copyright date 2015-12-31 23:28:40 +00:00
Doug Gregor
f9f9d2db98 Clang importer: add a list of Objective-C categories/extensions to the Swift name lookup table.
We need to be able to query this when enumerating “all declarations”, which is coming soon.
2015-12-21 16:01:21 -08:00
Doug Gregor
f7fd6d4f59 Clang importer: use lookup table version number in the module file extension hash.
We were verifying the Swift full version information from the module
file extension metadata for the Swift name lookup tables, but not
actually putting it in the hash, which meant that having an older
module cache around would cause spurious failures when Swift name
lookup tables were enabled. Instead, use just the major/minor version
numbers of the lookup tables. When the lookup table format or contents
of the lookup table change, we'll bump the version number.
2015-12-17 10:27:13 -08:00
Doug Gregor
69940d166c Clang importer: use Swift name lookup tables for all dynamic lookup searches. 2015-12-15 14:09:44 -08:00
Doug Gregor
d421a4fc0a Clang importer: use Swift name lookup tables for AnyObject member lookup.
When we're building Swift name lookup tables, use them for AnyObject
member lookup rather than falling back to the Objective-C selector
table.
2015-12-14 22:05:04 -08:00
Doug Gregor
f8a76d10c0 Clang importer: add macros to the Swift name lookup tables.
Refactor the storage within the name lookup tables to handle
declarations and macros together. Start populating the tables with
macro information.
2015-12-08 22:56:28 -08:00
Doug Gregor
86701de88a Clang importer: (de-)serialize Swift name lookup tables via module file extensions.
The recently-introduced module file extensions functionality in Clang
allows us to piggy-back the Swift name lookup tables in Clang's module
files. When the Swift name lookup tables are enabled, introduce such a
module file extension, and wire it into the SwiftLookupTable.

The actual contents of the extension block are simple: a single
on-disk hash table mapping base names to "full entries", which store
the context (e.g., a class, protocol, tag, or TU) and the set of
declarations.

Allow lazy resolution of declaration IDs deserialized from the
extension block to Clang declarations, to try to minimize the set of
declarations we must deserialize. Name lookup itself is only used to
dump the Swift name lookup tables and ensure we're round-tripping
properly.
2015-12-08 17:34:04 -08:00
Doug Gregor
f40b195a73 Clang importer: simplify Swift name lookup tables a bit.
The base name -> full name mapping really isn't interesting; index
based on the base name and filter by context instead. This makes the
lookup table dumper less interesting for testing purposes
(unfortunately), but test coverage will improve greatly once we can
turn on these lookup tables.
2015-12-08 17:34:04 -08:00
Doug Gregor
9d74b1d661 Swift lookup tables: translate DeclContext into something less tied to the AST.
We want to serialize this data structure, so make that easier.
2015-12-04 17:05:05 -08:00
Doug Gregor
28dea3bc27 Clang importer: recursively add members to the Swift lookup tables.
This is needed for member lookup via the Swift lookup tables, although
the lookup part is not yet implemented. Note also that the results are
currently wrong for C enumerations mapped into Swift enums or option
sets. That will come shortly.
2015-12-03 11:50:40 -08:00
Doug Gregor
c2bf16c0a9 Clang importer: start building a Swift name -> Clang declarations table.
When we parse a bridging header, start building a mapping from Swift
names (both base names and full names) to the Clang declarations that
have those names in particular Clang contexts. For now, just provide
the ability to build the table (barely) and dump it out; we'll grow
it's contents in time.
2015-12-03 11:50:39 -08:00