Now that we have true serialized modules, the standard library can import
the Builtin module without any special direction (beyond -parse-stdlib),
and anyone can include those modules without special direction.
Swift SVN r6752
Add BCOffsetRAII to getDecl() and getType() so that these functions
preserve the current cursor position. This spends an extra save and
restore to avoid accidentally shooting ourselves in the foot by losing
our position (see r6516).
No functionality change.
Swift SVN r6750
This makes ProtocolConformances fully self-identifying so that a ProtocolConformance* pointer alone is enough to identify a conformance as a link entity.
We currently lose the conforming decl during deserialization because trying to deserialize a reference to an ExtensionDecl asserts out. I'll bug Jordan about that.
Swift SVN r6735
Standardize on the more-common "superclass" and "subclass" terminology
throughout the compiler, rather than the odd mix of base/derived and
super/sub.
Also, have ClassDecl only store the Type of the superclass. Location
information will be part of the inheritance clause for parsed classes.
Swift SVN r6687
The 'inherited' type list of a declaration represents the parsed for
of the inheritance clause, which is now not serialized. The semantic
informance exists in the superclass (when present) and list of
protocols. Future refactoring of the 'inherited' list will make this
more clear.
Swift SVN r6686
Switch a few more clients from ::getInherited() to
::getProtocols(). The trajectory here is that ::getInherited() will
turn into something only populated when we've parsed the inheritance
clause, and that "the truth" will be getProtocols(). The former will
cease being serialized once this is the case.
Swift SVN r6661
Previously, we only tracked the mapping from associated types to their
type witnesses. Now, also track the protocol conformances for each of
the requirements placed on the associated types.
Swift SVN r6655
...instead of keeping around extra deserialized copies.
Also, fix memory management for inherited conformances already in the
ASTContext, instead of just leaking them.
In the long run, conformances under substitutions should be encoded with
some kind of CONFORMANCE_REF, because it is known that these conformances
will already exist.
Swift SVN r6557
This involved threading it through ModuleLoader, as with all the other
module-generic callbacks. I plan to collapse a bit of the chaining, but
unfortunately not that much.
This brings back the CodeCompletion tests.
Swift SVN r6527
This is a hack to handle "typedef struct CGRect CGRect", but obviously
it isn’t going to work in the general case. Filed <rdar://problem/14526923>
to undo this later.
Swift SVN r6526
This involves correctly uniquing them, using existing archetypes
(rather than deserializing new ones), and recording them in the
ASTContext's conformance maps, which are used by the type-checker.
Swift SVN r6525
Rather than automatically re-exporting or not re-exporting every import in
a TranslationUnit, we'll eventually want to control which imports are local
(most of them) and which imports are shared with eventual module loaders.
It's probably not worth implementing this for TranslationUnit, but
LoadedModule can certainly do something here.
Currently, a LoadedModule is even more permissive than a TranslationUnit:
all imports are re-exported. We can lock down on this once we have a
re-export syntax.
Swift SVN r6523
...and use it for shadowed modules (e.g. the Clang module "Foundation"
referenced by the Swift module "Foundation"), so that we can actually
find "NSString" when building AppKit.
Additionally, record shadowed modules as dependencies, so that they can
be loaded when the adapter module is loaded.
Swift SVN r6522
This unfortunately duplicates the hack of directly referencing the Clang
module loader if a cross-reference points to the current module; ideally
we'd have some kind of module chain, but I'd settle for a refactoring of
the code to share with NameBinding.
Additionally, Clang nodes are not actually validated to be from the right
module, which could be problematic for extensions or any case of actual
name collision.
Swift SVN r6519
If a protocol requirement is satisfied by a generic method, we'll need to save the substitutions necessary to call that method from the witness thunk. This patch adds the spot in the ProtocolConformance::Mapping to save the substitutions; for now, always leave it empty and update the code for the type change.
Swift SVN r6399
- Add the attribute to AnyFunctionType::ExtInfo.
- Propagate the attributes from DeclAttributes to AnyFunctionType for
FuncDecls in TypeCheckDecl.cpp.
- Make sure the new attribute is serialized.
The main missing pieces are checking the applicability of the type attributes
on the FuncDecl and teaching typechecker about conversions on types with
noreturn.
Swift SVN r6359
Elements of a tuple type now know if there is a default argument, and
what kind of default argument it is (callee side, __FILE__, __LINE__,
__COLUMN__), but they don't have an actual expression. There are a
number of cleanups this enables that will follow.
Note that the serialization support is as-yet-untested.
Swift SVN r6351
Generic parameters are implemented using specially-tagged TypeAliasDecls.
Unlike normal ValueDecls, their names are not resilient, and so cross-
module references shouldn't refer to them by name. Instead, use an index
into the generic parameter list of their context.
Since generic parameters can appear within extensions, this new kind isn't
mutually exclusive with the just-introduced ExtensionValue. Change that to
be a separate flag that applies to both Values and GenericParameters.
Swift SVN r6304
Previously, cross-references used a simple access path to refer to values
in other modules, but extensions have no name. They also accidentally
picked up values in extensions anyway, because lookupDirect includes
members in extensions. Now, we filter out values that don't come from
the referenced module, which may not be the same module the base type
comes from.
Swift SVN r6301
Teach TuplePatternElt to keep track of the kind of the default
argument: none, normal (provided by calling into the appropriate
callee generator), __FILE__, __LINE__, or __COLUMN__. For the latter
three cases, the type checker forms the appropriate argument as part
of the call.
The actual default argument expression will only be held in the tuple
pattern element when we've parsed it; it won't be serialized or
deserialized, because only the defining module cares. This is a step
toward eliminate the initialization expression from tuple types.
The extension to TupleShuffleExpr is a hack, which will also be
replicated in ScalarToTupleExpr, until we finally rework the
representation of TupleShuffleExpr (<rdar://problem/12340004>).
Swift SVN r6299
The semantics of varargs (only for the last element) make it more appropriate as a property of the TuplePattern.
Also free the Parser from needing to construct synthetic types (ArraySlice for type of vararg element) to
accommodate the TypeChecker and move the logic to the TypeChecker. This will be more beneficial when the parser stops
creating types in general.
Swift SVN r6271
As long as we don't create an entity twice, it's actually okay to be
re-entrant. This makes it simpler to deserialize members -- trying to
do so will deserialize the parent instead, which will then initialize
each of the members including the one that was asked for.
Swift SVN r6228
Deserializing a nominal decl often ends up referring to the nominal's type,
so if we're /already/ serializing the type, we should finish that as soon
as we have a decl. Accomplish this by adding a callback that is called
right after a nominal decl is recorded in the module's decl table, so that
the type can be immediately recorded as well.
Swift SVN r6227
Give oneof bodies syntax consistent with other NominalTypes. Give oneof elements first-class declaration syntax using the 'case' introducer, as suggested by Jordan. Oneofs can contain 'case' decls, functions, properties, and constructors, but not physical ivars. Non-oneof scopes cannot contain 'case' decls. Add some QoI to the oneof 'case' parser to also parse and complain about things that resemble switch 'case' labels inside decl contexts.
Swift SVN r6211
I had previously thought these didn't appear in public decls, but they're
used when you extend a generic class without generic arguments.
Swift SVN r6187
Currently, we are eagerly deserializing extensions. This probably isn't
what we want to do in the long run, but until lookup settles down a bit
it's not worth optimizing.
Swift SVN r6186
Take advantage of the fact that a function can never be both a conversion
method and an assignment operator to pack both flags into the same bit in
the serialized record.
Swift SVN r6185
For consistency purposes, VarDecls in the subscript pattern now have the
enclosing nominal as their decl context, rather than no decl context at all.
Swift SVN r6177
Turns out we actually have to serialize the name of an archetype, because
it may be different from the declaration in a context where it has been
unified with another archetype. Found on attempting to emit a module for
the standard library.
(This is actually the commit that uses the two-container for_each
introduced in the last commit.)
Swift SVN r6172
These still need to be serialized, because they are one-to-one with the
type's protocol list, but don't actually require any data. Found on
attempting to emit a module for the standard library.
Most of the churn here is moving Interleave.h to a more general STLExtras.h.
Swift SVN r6167
The way llvm::BitstreamCursor works is that reading an end-of-block
code will pop the current block off the stack, along with all its
record abbreviation codes. This means we’d no longer know how to
read any records. Fix this by telling the cursor not to auto-pop blocks
any time we’re doing a tentative read.
Swift SVN r6135