Commit Graph

459 Commits

Author SHA1 Message Date
Jordan Rose
6a0609d169 Use .swiftmodule instead of .sm for serialized modules.
We can bikeshed on this later, but for now we can use a very explicit
extension that has no chance of stepping on any existing extension.

Swift SVN r5239
2013-05-20 22:50:40 +00:00
Jordan Rose
ea0d5031ab [serialization] Codify the bringup hack with a special note in the module file.
The bringup hack, again, is to just process the module source files as a
TranslationUnit if the module doesn't accurately represent the original
source. Currently this happens if the module is not empty, or if it imports
/anything/, since we don't actually serialize anything yet.

This also cleans up the decl/type serialization skeleton a bit.

Swift SVN r5238
2013-05-20 22:50:39 +00:00
Doug Gregor
8114ce16f8 Use the list of extensions of a nominal type for name lookup into that type.
This replaces the obscure, inefficient lookup into extensions with
something more straightforward: walk all of the known extensions
(available as a simple list), then eliminate any declarations that
have been shadowed by other declarations. The shadowing rules still
need to consider the module re-export DAG, but we'll leave that for
later.

As part of this, keep track of the last time we loaded extensions for
a given nominal type. If the list of extensions is out-of-date with
respect to the global generation count (which tracks resolved module
imports), ask the modules to load any additional extensions. Only the
Clang module importer can currently load extensions in this manner.


Swift SVN r5223
2013-05-20 18:06:51 +00:00
Jordan Rose
f9c4046896 [serialization] Validate the control block -- is the module too new?
Not so interesting right now, but eventually we'll be validating other
things as well, and it's best not to have FIXMEs lying around.

Swift SVN r5175
2013-05-16 00:23:13 +00:00
Jordan Rose
3109d8c830 [serialization] Pull bitstream processing of modules into its own file.
Like Clang, ModuleFile contains state about reading the serialized module,
while SerializedModuleLoader takes the place of ASTReader in tracking
cross-module data. I'm diverging from Clang's architecture a bit here by
pushing the actual deserialization logic into ModuleFile.

No functionality change.

Swift SVN r5174
2013-05-16 00:23:11 +00:00
Jordan Rose
ebcff9685f [serialization] Hook up a module loader that just builds a TranslationUnit.
The writer stores the paths to the .swift files, the reader just loads
those .swift files. Fun!

No version validation yet. No separate ModuleReader class yet. No use of
the SerializedModule architecture yet, except for creating a dummy module
when the .sm file is corrupted.

Swift SVN r5164
2013-05-13 21:41:23 +00:00
Jordan Rose
b8cf3497a2 [serialization] Change file signature to something non-ASCII.
Based on feedback by Doug. This signature is fairly arbitrary: it's the
UTF-8 encoding of U+2828 SPARKLES, followed by the number 14 to represent
2014. (Hopefully the format will have stabilized by 2014.)

(Why not 0x00 or 0x01 for the last byte? Because it's more likely we'll
collide with someone else being cute. Why not 0x0D / 13? Because that's
\r and could conceivably appear in real Unicode text. No one uses 0x0E
these days.)

Swift SVN r5134
2013-05-09 22:58:08 +00:00
Jordan Rose
1d2dfdb498 [serialization] Push record layout info into a private header.
The reader and writer will need to share this information, but there's no
reason anyone else will need it.

Swift SVN r5133
2013-05-09 22:58:07 +00:00
Jordan Rose
73b6269484 [serialization] Add a trivial Swift module loader.
Currently, the Swift module loader just looks for a .sm file, verifies the
signature "SMod", and produces an empty DeclContext.

Swift SVN r5126
2013-05-09 20:49:29 +00:00