Commit Graph

165 Commits

Author SHA1 Message Date
Zach Panzarino
e3a4147ac9 Update copyright date 2015-12-31 23:28:40 +00:00
practicalswift
22e10737e2 Fix typos 2015-12-26 01:19:40 +01: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
6d20d22269 Clang importer: allow subsequent macro definitions to replace earlier ones.
This better matches the behavior we had before enabling the Swift name
lookup tables. Tests will be forthcoming, but this is expected to fix
a failure on Linux.
2015-12-21 12:05:16 -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
2244cb4fc8 Swift lookup tables: start testing and cleaning up handling for Objective-C.
Start testing the construction of the Swift lookup tables in the Clang
importer for Objective-C entities. Fix some obvious issues, e.g.,
category and extension entries should be associated with the
corresponding class, and the categories/extensions shouldn't have
entries in the lookup table.
2015-12-03 11:50:41 -08:00
Doug Gregor
c41535a7fb Clang importer: start computing the effective lookup context with the name.
This places enumerators that will become either cases of a Swift enum
or options in a Swift option into the context of the C enum type for
the name lookup table.
2015-12-03 11:50:40 -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
2dc262f5b0 Clang importer: Don't add duplicate declarations to the Swift lookup tables. 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