Commit Graph

1132 Commits

Author SHA1 Message Date
Doug Gregor
91629378c1 Unbreak the build after r205685, although now we have test failures.
Swift SVN r16005
2014-04-07 06:15:16 +00:00
John McCall
f1180f5e6d in order to work correctly for non-@objc protocols.
Language features like erasing concrete metatype
values are also left for the future.  Still, baby steps.

The singleton ordinary metatype for existential types
is still potentially useful; we allow it to be written
as P.Protocol.

I've been somewhat cavalier in making code accept
AnyMetatypeType instead of a more specific type, and
it's likely that a number of these places can and
should be more restrictive.
When T is an existential type, parse T.Type as an
ExistentialMetatypeType instead of a MetatypeType.

An existential metatype is the formal type
 \exists t:P . (t.Type)
whereas the ordinary metatype is the formal type
 (\exists t:P . t).Type
which is singleton.  Our inability to express that
difference was leading to an ever-increasing cascade
of hacks where information is shadily passed behind
the scenes in order to make various operations with
static members of protocols work correctly.

This patch takes the first step towards fixing that
by splitting out existential metatypes and giving
them a pointer representation.  Eventually, we will
need them to be able to carry protocol witness tables

Swift SVN r15716
2014-04-01 00:38:28 +00:00
Doug Gregor
1cdd295182 Move the @objc attribute over to a DeclAttribute.
Swift SVN r15517
2014-03-26 19:33:07 +00:00
Adrian Prantl
493eab817c Debug info: don't crash on implicit clang decls. rdar://problem/16307518.
Swift SVN r15173
2014-03-18 00:29:52 +00:00
Adrian Prantl
9f8adfa401 silence warning
Swift SVN r15172
2014-03-18 00:29:46 +00:00
Chris Lattner
2593a52b99 implement <rdar://problem/16191398> add an 'oldValue' to didSet so you can implement "didChange" properties
This names the implicit argument "oldValue".  Whether we keep implicit arguments or not
is a subject of debate, tracked by rdar://16268361.



Swift SVN r14819
2014-03-08 02:15:01 +00:00
Greg Parker
a11eff260f Adapt to header file changes in llvm r203038 and r203046.
Swift SVN r14716
2014-03-06 02:04:32 +00:00
Argyrios Kyrtzidis
918abab467 Update for llvm API change in r202736.
Swift SVN r14612
2014-03-03 22:00:33 +00:00
Michael Gottesman
4c3ae242d9 Disable debug info for "*_external" linkage functions and an assertion on certain SILLocations to avoid the fact we don't serialize DebugScopes.
The specific SILLocations are: SILFileKind, InlineKind, and
MandatoryInlineKind.

This was done in coordination with Adrian Prantl.

Swift SVN r14580
2014-03-03 03:15:36 +00:00
Adrian Prantl
8948375658 Debug Info: Cleanup: Remove debug scope from DebugTypeInfo.
Swift SVN r14548
2014-03-01 00:50:50 +00:00
Argyrios Kyrtzidis
eeb9589d2c [AST] Introduce "hasName()" convenience methods and replace "getName().empty()" callers.
Swift SVN r14206
2014-02-21 15:00:38 +00:00
Adrian Prantl
c1eda9c7e7 Debug info: do not emit linetable info for ObjC thunks and other auto_gen
code.
<rdar://problem/15975329> Don't emit line numbers for Thunks

Swift SVN r13872
2014-02-13 20:33:33 +00:00
Adrian Prantl
89ca27aebd fix 80-column violations.
Swift SVN r13871
2014-02-13 20:33:32 +00:00
Joe Groff
42677b21d1 IRGenDebugInfo: Stub out debug info for dependent types.
Build debug info for function types using the interface types of their lowered SILFunctionTypes. We can't use the archetype path to declare dependent parameter types of a generic function, since the function type can't be tied to any specific decl context, so stub them out as an UnspecifiedType for now.

Swift SVN r13722
2014-02-09 22:25:58 +00:00
Mark Lacey
08fb77b0b9 Revert "IRGenDebugInfo: Contextualize interface types to get archetype parameter types."
This reverts commit r13693, which breaks the stdlib build.

Swift SVN r13704
2014-02-09 09:09:08 +00:00
Joe Groff
3899d1bfd5 IRGenDebugInfo: Contextualize interface types to get archetype parameter types.
Use the debug DeclContext to contextualize interface types before emitting debug info for them.

Swift SVN r13693
2014-02-09 03:25:10 +00:00
Adrian Prantl
bacd2d3c04 Debug info: Fix the locations for branches in case statements.
<rdar://problem/15899195> Step from a case the middle of a switch goes to the beginning of the containing function

Swift SVN r13623
2014-02-07 02:37:36 +00:00
Chris Lattner
827acad533 Various inout improvements:
- purge @inout from comments in the compiler except for places talking about
   the SIL argument convention.
 - change diagnostics to not refer to @inout
 - Change the astprinter to print InoutType without the @, so it doesn't show
   up in diagnostics or in closure argument types in code completion.
 - Implement type parsing support for the new inout syntax (before we just 
   handled patterns).
 - Switch the last couple of uses in the stdlib (in types) to inout.
 - Various testcase updates (more to come).



Swift SVN r13564
2014-02-06 06:22:27 +00:00
Argyrios Kyrtzidis
48023490de [AST] Move AccessorKind enum to top-level so it can be forward declared.
No functionality change.

Swift SVN r13299
2014-02-01 08:50:15 +00:00
Doug Gregor
030770a8c2 Make DynamicSelf into its own special type node.
Making DynamicSelf its own special type node makes it easier to opt-in
to the behavior we want rather than opting out of the behavior we
don't want. Some things already work better with this representation,
such as mangling and overriding; others are more broken, such as the
handling of DynamicSelf within generic classes and the lookup of the
DynamicSelf type.


Swift SVN r13141
2014-01-30 05:36:20 +00:00
Adrian Prantl
72984b44dc add an assertion
Swift SVN r13123
2014-01-29 22:15:53 +00:00
Adrian Prantl
18b4ec2f5b simplify code
Swift SVN r13122
2014-01-29 22:15:51 +00:00
Chris Lattner
290a58494e Implement debug info for willset/didset, and teach dispatch to be non-virtual
to didset/will set since we don't drop these in the class vtable.


Swift SVN r13056
2014-01-28 06:33:31 +00:00
Chris Lattner
5b0ecdace1 This went with r12994
Swift SVN r12995
2014-01-27 17:57:54 +00:00
Adrian Prantl
e1387cf7ef reorder functions in the file
Swift SVN r12804
2014-01-22 22:42:07 +00:00
Adrian Prantl
eef4a53bcd Cleanup: Move code to a more appropriate location.
Swift SVN r12802
2014-01-22 22:42:06 +00:00
Doug Gregor
d52cec4b20 Eliminate a pile of literal identifiers for self, init, destructor, etc.
... because I can't stomach adding another one of these.


Swift SVN r12687
2014-01-22 01:09:49 +00:00
Chris Lattner
f5b85341a1 Expand out the "isComputed" property in AbstractStorageDecl to be an enum
with two kinds, and some more specific predicates that clients can use.

The notion of 'computed or not' isn't specific enough for how properties
are accessed.  We already have problems with ObjC properties that are 
stored but usually accessed through getters and setters, and a bool here
isn't helping matters.

NFC.



Swift SVN r12593
2014-01-20 18:16:30 +00:00
Joe Groff
0776c4b6b8 SIL: Reorient function type lowering toward interface types.
Lower types for SILDeclRefs from the interface types of their referents, dragging the old type along for the ride so we can still offer the context to clients that haven't been weaned off of it. Make SILFunctionType's interface types and generic signature independent arguments of its  Derive the context types of SILFunctionType from the interface types, instead of the other way around. Do a bunch of annoying inseparable work in the AST and IRGen to accommodate the switchover.

Swift SVN r12536
2014-01-18 19:42:02 +00:00
Adrian Prantl
03bb47e017 Debug info: Emit "global" variables in the top level module as static
variables of SWIFT_ENTRY_POINT_FUNCTION.
<rdar://problem/15805751> Emit top-level variables as DWARF

Swift SVN r12362
2014-01-15 23:56:27 +00:00
Adrian Prantl
10a62788c2 misc cleanups
Swift SVN r12361
2014-01-15 23:56:26 +00:00
Adrian Prantl
6310c07733 Debug info: re-enable mangling of type alias types.
<rdar://problem/15797764> Debug info for $swift.type is confusing

Swift SVN r12187
2014-01-11 01:34:45 +00:00
Adrian Prantl
4bf7a5b0f6 Debug info: Add a reference to the stdlib swiftmodule in the line table
so LLDB can find it even if nothing in the CU references it.

<rdar://problem/15776868> p 32 gives "error: use of undeclared type 'COpaquePointer'"

Swift SVN r12180
2014-01-11 01:08:40 +00:00
Adrian Prantl
946dc5678b Debug info: Provide an in interface for LLDB to mangle types and refactor
some code in IRGenDebugInfo along the way.
This is WIP for rdar://problem/15498877.

Swift SVN r12146
2014-01-10 22:35:53 +00:00
Mark Lacey
079c6fc7cb Add case for UncheckedOptional in debug info generation.
Swift SVN r12132
2014-01-10 20:24:05 +00:00
Adrian Prantl
395bd1eede Debug info: record the module name in DWARF. For the time being this is
done via an DW_TAG_imported_module.
rdar://problem/15711613.

Swift SVN r12035
2014-01-08 02:34:29 +00:00
Chris Lattner
9ae289de46 Drive the semantic wedge harder into lvalues. Now, instead of having one LValueType
with qualifiers on it, we have two distinct types:
 - LValueType(T) aka @lvalue T, which is used for mutable values on the LHS of an
   assignment in the typechecker.
 - InOutType(T) aka @inout T, which is used for @inout arguments, and the implicit
   @inout self argument of mutable methods on value types.  This type is also used
   at the SIL level for address types.

While I detangled a number of cases that were checking for LValueType (without checking
qualifiers) and only meant @inout or @lvalue, there is more to be done here.  Notably,
getRValueType() still strips @inout, which is totally and unbearably wrong.



Swift SVN r11727
2013-12-29 22:23:11 +00:00
Joe Groff
3e30cbcfef SILGen/IRGen: Don't emit top_level_code for libraries.
If there's no script-mode file in a module, don't produce a top_level_code SILFunction for it, and don't consider emitting an LLVM global_ctor for it. We should never emit static constructors from user code anymore.

Swift SVN r11644
2013-12-26 00:18:29 +00:00
Joe Groff
14362cd8e2 IRGen: Lower metatypes respecting SIL's 'thin' bit.
Use the 'thin' bit set by SIL to decide whether a metatype lowers to an empty type or not. In GenPoly we still need to accommodate unlowered metatypes to keep protocol witnesses limping along; hopefully that code can be killed soon. With this change we now lower @cc(witness_method) consistently for static methods.

Swift SVN r11535
2013-12-21 02:05:37 +00:00
Jordan Rose
7a30de2efe Disallow inheritance clauses for concrete typealiases.
typealias MyInt: ForwardIndex = Int

There is no real reason to allow this; it's just a static_assert that Int
conforms to ForwardIndex, which would be better spelled some other way.

This only applies to concrete typealiases, i.e. those that simply alias an
underlying type. Associated types can still have both inheritance clauses
and a (default) underlying type.

Swift SVN r11481
2013-12-19 21:13:54 +00:00
Adrian Prantl
baa048e89a Remove functions from the debug info generator's internal data structures
prior to erasing them from the module. This should fix
<rdar://problem/15700509> ASan reports a use-after-free in IRGen

Swift SVN r11479
2013-12-19 19:37:56 +00:00
Joe Groff
017440165e Fix the weird capitalization of MetaTypeType.
Swift SVN r11475
2013-12-19 18:43:08 +00:00
Connor Wakamo
59f18f9fc0 Renamed irgen::Options and irgen::OutputKind to IRGenOptions and IRGenOutputKind, and move both out of the irgen namespace now that they're in swiftAST.
Swift SVN r11405
2013-12-18 01:17:09 +00:00
Connor Wakamo
3e81830385 Move "include/swift/IRGen/Options.h" to "include/swift/AST/IRGenOptions.h".
This commit only moves the header file; updating the class so that it is no longer in the irgen namespace will be handled separately.

Swift SVN r11404
2013-12-18 01:17:09 +00:00
Adrian Prantl
5dc5f4963c Debug info: set the appropriate scope for box-allocated variables.
Fixes rdar://problem/15638864.

Swift SVN r11321
2013-12-14 23:53:45 +00:00
Chris Lattner
698380d6d3 Introduce a new bit in VarDecl, "isLet". Teach Sema that 'isLet' properties
are not settable (like get-only ones).  Set the 'isLet' bit in various 
places, but not the particularly interesting or useful places yet.



Swift SVN r11121
2013-12-11 06:45:40 +00:00
Adrian Prantl
1bcbaedcd0 Debug info: get rid of intrinsickind.
Swift SVN r11101
2013-12-10 23:53:18 +00:00
Adrian Prantl
1f927d9ffc Overhaul the handling of return locations for auto-generated code.
- change SILGenFunction to use Cleanup and Implicit return locations for
  auto-generated cleanups/returns where sensible.
- Fix a bug in where ConstructorDecl that would return the wrong
  source range.
- Move the expected locations of some errors to the end of the function
  where they should belong.

Fixes <rdar://problem/15609768> Line tables for classes that don't have
init but just initialize ivars are odd

Swift SVN r11086
2013-12-10 19:23:34 +00:00
Adrian Prantl
22f1d8c7a6 Debug info: Repair emission of the swift.type type after introducing the
_Tta mangling.
Fixes <rdar://problem/15599592> Type for $swift.type arguments is now Builtin.RawPointer.metatype

Swift SVN r11046
2013-12-09 23:09:43 +00:00
Adrian Prantl
e385446593 Debug info: Get the storage size of basic types from llvm::DataLayout.
Swift SVN r10925
2013-12-06 18:15:39 +00:00