Commit Graph

1132 Commits

Author SHA1 Message Date
Greg Clayton
cddae42bac Don't crash (via assert) when trying to enable debug info in Swift JIT'ed expressions.
Swift SVN r19102
2014-06-23 22:21:44 +00:00
Adrian Prantl
b1a7a7af1b Reference-count inlined functions to keep them alive until we emit debug
info for them and generally clean up the inline scope handling a bit.
Fix the debug scope handling for all clients of SILCloner, especially
the SIL-level spezializers and inliners.
This also adds a ton of additional assertions that will ensure that
future optimization passes won't mess with the debug info in a way that
could confuse the LLVM backend.

Swift SVN r18984
2014-06-18 22:34:10 +00:00
Jordan Rose
574054b8fd Distance SourceManager from llvm::SourceMgr.
...in preparation for non-source locations, i.e. locations that don't come
frome source buffers.

No functionality change, but a fair bit of SourceManager API and idioms have
changed.

Swift SVN r18942
2014-06-17 01:15:47 +00:00
Michael Gottesman
9b72aa0e47 Revert "Update to ToT which removed std::error_code"
This reverts commit r18853. This was already fixed by the previous
commit.

Swift SVN r18855
2014-06-13 04:34:18 +00:00
Pete Cooper
676b005839 Update to ToT which removed std::error_code
Swift SVN r18853
2014-06-13 03:50:33 +00:00
Justin Bogner
a0c0dc25be Use std::error_code rather than llvm::error_code
std::error_code is no longer available via the llvm namespace as of
r210835.

Swift SVN r18851
2014-06-13 02:54:07 +00:00
Bob Wilson
2df66cf8c4 Implement inline scopes for the performance inliner.
Mandatory-inlined (aka transparent functions) are still treated as if they
had the location and scope of the call site. <rdar://problem/14845844>
Support inline scopes once we have an optimizing SIL-based inliner

Patch by Adrian Prantl.

Swift SVN r18835
2014-06-12 19:48:43 +00:00
Bob Wilson
9ab1136ba8 Update error_code usage to match llvm trunk.
LLVM's system_error.h has been changed to forward to the standard
version of the same. Update usage for the minor API changes that this
entails.

Based in part on a patch by Justin Bogner.

Swift SVN r18832
2014-06-12 19:48:39 +00:00
Adrian Prantl
4e7fa3c19a Remove this assertion. Bridging headers will not have an owning module.
Swift SVN r18793
2014-06-10 23:50:08 +00:00
Adrian Prantl
0b7f82bcc9 Linetable: Make sure the function prologue ends after manipulating the
stackpointer.
<rdar://problem/16903725> Line tables seem to assume prologue ends one instruction too early

Swift SVN r18284
2014-05-17 23:41:07 +00:00
Doug Gregor
5783d0b313 Revert r19185: Add T* syntactic sugar type for UnsafePointer<T>.
Swift SVN r18255
2014-05-17 16:43:46 +00:00
Adrian Prantl
98383a5c6a Debug info: Use WeakVHs in DIRefMap so LLDB can safely invoke IRGen more
than once (at least as far as IRGenDebugInfo is concerned).

No new testcases, but it comes with new assertions.

Part of <rdar://problem/15283227> A crash in llvm's getFnAttributes when IRGen is called more than once.

Swift SVN r18214
2014-05-16 21:26:06 +00:00
Doug Gregor
806daf3a87 Add T* syntactic sugar type for UnsafePointer<T>.
This is the basic plumbing for <rdar://problem/16912508>.


Swift SVN r18195
2014-05-16 15:30:26 +00:00
Adrian Prantl
22beacddf8 Debug Info: Linetable. Emit the end location for ImplicitReturnLocations.
<rdar://problem/15204469> Odd line table when passing closure to function

Swift SVN r18174
2014-05-16 04:32:09 +00:00
Adrian Prantl
f5325f9cf4 Debug Info: Do a marginally better job of supporting enums by emitting
the argument types and underlying raw types.
In the long run we'd really want to emit them as DW_TAG_variant_types.

<rdar://problem/14845818> Support enums

Swift SVN r18170
2014-05-16 03:51:08 +00:00
Adrian Prantl
3848f9a069 Debug info: Emit the mangled name for function types, if it is possible.
<rdar://problem/16450045> variables of closure type cause "warning: swift types not handled in"... warnings

Swift SVN r18091
2014-05-15 01:01:17 +00:00
Adrian Prantl
6378a66628 Debug Info: Emit the remaining pointer types with pointer size.
Swift SVN r18052
2014-05-14 01:16:39 +00:00
Adrian Prantl
22522637b3 Debug Info: Emit archetypes with the size and alignment of a pointer.
Swift SVN r18050
2014-05-14 01:16:32 +00:00
Adrian Prantl
fcc346c874 Run clang-format on IRGenDebugInfo.*
Swift SVN r18035
2014-05-13 22:48:35 +00:00
Adrian Prantl
bb9be80edf Debug Info: Factor out createPointerSizedStruct for leaf types that
have mangled names.

Swift SVN r18034
2014-05-13 22:48:31 +00:00
Adrian Prantl
93f423da32 Debug Info: To make life easier for LLDB, emit inout types as structs with
an appropriate mangled name.
rdar://problem/16900833

Swift SVN r18023
2014-05-13 21:05:31 +00:00
Adrian Prantl
9cfb375a96 Debug info: Fix a struct layout bug with zero-sized members.
<rdar://problem/16898394> Library won't build with optimization off

Swift SVN r18015
2014-05-13 18:48:51 +00:00
Adrian Prantl
95168bb97c Temporarily soft-fail this assertion.
<rdar://problem/16898394> Library won't build with optimization off

Swift SVN r18005
2014-05-13 16:06:43 +00:00
John McCall
d7b44f2dc6 Correctly substitute field types when building debug info
for specializations of generic types.

Also remove some impossible error handling and simplify an API.

Swift SVN r17989
2014-05-13 02:09:22 +00:00
Adrian Prantl
baae246fb8 Debug Info: Do not crash when the size of a piece cannot be determined.
Swift SVN r17958
2014-05-12 20:59:57 +00:00
Adrian Prantl
932d08d89b [update LLVM+LLDB] Switch to the custom DW_LANG_Swift specifier.
Retire DW_TAG_restrict in favor of DW_TAG_APPLE_metatype.

<rdar://problem/16513629> Cleanup DWARF output for WWDC

Swift SVN r17949
2014-05-12 19:17:54 +00:00
Adrian Prantl
c0b5da0d7f [please update LLVM] Debug info: Support multi-valued explosions, e.g.,
tuples and structs that are passed to a function by value.

<rdar://problem/15928331> Need to support DW_OP_piece for multi-Value variables/arguments
<rdar://problem/16599747> Variables not displayed at all in SwiftDemo02b_Closure (back again)

Swift SVN r17923
2014-05-12 03:31:07 +00:00
Adrian Prantl
e02f42a460 Debug info: make sure we're using the internal DW_LANG_Swift enum for now.
Swift SVN r17748
2014-05-09 00:55:28 +00:00
Adrian Prantl
6389760e26 Debug info: Support DynamicSelf type.
Swift SVN r17704
2014-05-08 17:49:59 +00:00
Adrian Prantl
91d6140aa5 Rename a couple of variables for consistency.
Swift SVN r17592
2014-05-07 00:29:58 +00:00
Adrian Prantl
b0aa5e34e0 Debug info: Do not emit static variables for metatypes for global class
definitions.

<rdar://problem/16783583> Evaluating expressions in contexts containing class declarations fails

Swift SVN r17591
2014-05-07 00:29:57 +00:00
Ted Kremenek
050fd53af7 Rename UncheckedOptional to ImplicitlyUnwrappedOptional.
Swift SVN r17232
2014-05-02 06:13:57 +00:00
Chris Lattner
a7012f23ef Remove swift::ArrayType. It is dead and vestigial code for supporting fixed size
arrays, which never got baked.  Remove it until we have time to do things right.


Swift SVN r16995
2014-04-28 21:18:27 +00:00
Adrian Prantl
9a19300489 Debug info: Emit all srtruct types with Swift as runtime language so the
accelerator-table mangled-name logic in LLVM works as expected.
<rdar://problem/16730603> Debug info for variable of type NSError does not provide mangled name

Swift SVN r16846
2014-04-25 22:30:31 +00:00
Adrian Prantl
08178d4520 Debug info: Mark allocating constructors artificial.
<rdar://problem/16349779> line table for _allocating_init constructor is odd

Swift SVN r16727
2014-04-23 23:55:46 +00:00
Adrian Prantl
f68f0e81d1 Debug info: represent function pointers as indirect function types.
<rdar://problem/14960518> Incorrect debug info for function pointer

Swift SVN r16716
2014-04-23 20:59:45 +00:00
Adrian Prantl
146c559ee7 remove dead code.
Swift SVN r16714
2014-04-23 20:59:43 +00:00
Adrian Prantl
23f47790e5 Debug info: Retire DW_TAG_meta_type now and use a proper mangled name
instead.
<rdar://problem/16439075> LLDB is trying to print type metadata as an instance

Swift SVN r16710
2014-04-23 19:52:19 +00:00
John McCall
b38a63950d Implement @unowned(unsafe).
This was part of the original weak design that
there was never any particular reason to rush the
implementation for.  It's convenient to do this now
so that we can use it to implement Unmanaged<T> for
importing CF types.

Swift SVN r16693
2014-04-23 08:51:23 +00:00
Adrian Prantl
b1d9d186a0 [please update llvm] Debug info: Use the mangled name as unique identifier
for types where possible.

We use the DICompositeType's UniqueIdentifier field to store the mangled
name, the name field to store the base name and Apple-llvm will emit the
unique identifier as DW_AT_name if RunTimeLang == Swift. This way the
metadata format is compatible between swift and non-Apple clang.
As bonus, we get mangled-name-based type uniquing for swift.

<rdar://problem/16303510> apple-types accelerator table should include basename for swift types

Swift SVN r16665
2014-04-22 21:55:32 +00:00
John McCall
8681963bcb A couple of long-overdue renames.
Builtin.ObjectPointer -> Builtin.NativeObject
Builtin.ObjCPointer -> Builtin.UnknownObject

Swift SVN r16634
2014-04-22 00:17:08 +00:00
Adrian Prantl
a17c8cccc0 Debug Info: Emit all types (with the exception of builtins and qualified
types) in their actual context rather than the context of their first use.
Fixes several FIXMEs and <rdar://problem/16654720>.

Swift SVN r16596
2014-04-20 19:32:35 +00:00
Andrew Trick
65f5a7a1e6 Fix a missing check for null SILDebugScope.
Fixes a crash building Foundation.swift with
SWIFT_ASSERTS=NO
-g -O2 Foundation.swift

The following function had no debug scope:
// reabstraction thunk helper from @callee_owned (@owned Swift.UncheckedOptional<Swift.String>, @unowned C._NSRange, @unowned C._NSRange, @owned Swift.CMutablePointer<ObjectiveC.ObjCBool>) -> (@unowned ()) to @callee_unowned @objc_block (@unowned Swift.UncheckedOptional<ObjectiveC.NSString>, @unowned C._NSRange, @unowned C._NSRange, @unowned Swift.UnsafePointer<ObjectiveC.ObjCBool>) -> (@unowned ())
sil shared [transparent] @_TTRXFo_oGSQSS_dVSC8_NSRangedS_oGVSs15CMutablePointerV10ObjectiveC8ObjCBool__dT__XFdCb_dGSQCSo8NSString_dS_dS_dGVSs13UnsafePointerS2___dT__ : $@cc(cdecl) @thin

Swift SVN r16496
2014-04-18 05:13:34 +00:00
Joe Groff
f7cf592777 Add a SIL-only '@block_storage T' type to represent on-stack storage for blocks.
Blocks need to be born on the stack, so we need a way to represent that on-stack storage. @block_storage T will represent the layout of a block that contains storage for a capture of type T.

Swift SVN r16355
2014-04-15 03:56:09 +00:00
Adrian Prantl
9306fef294 Debug info: Emit the appropriate decl_file/line for import declarations.
rdar://problem/16565308

Swift SVN r16353
2014-04-15 03:08:22 +00:00
Adrian Prantl
79feaa894f [update LLVM] Debug info: Emit modules as DW_TAG_module.
<rdar://problem/16513629> Cleanup DWARF output for WWDC
<rdar://problem/16565308> Fix debug info for modules after LLVM r205685

Swift SVN r16352
2014-04-15 02:31:10 +00:00
Adrian Prantl
3db3eab09c Debug info: Cleanup: use a single catch-all for all internal opaque types.
Swift SVN r16132
2014-04-09 22:09:03 +00:00
Joe Groff
8adaab0233 Fold ExtInfo::isThin and ::isBlock into a "Representation" enum.
These bits are orthogonal to each other, so combine them into one, and diagnose attempts to produce a type that's both. Spot-fix a bunch of places this revealed by inspection that we would have crashed in SILGen or IRGen if blocks were be handled.

Swift SVN r16088
2014-04-09 00:37:26 +00:00
Adrian Prantl
8d0e1d3376 [PLEASE UPDATE LLVM/CLANG] Debug info: Rebase DWARF output for imported
modules on LLVM/trunk.
This should fix most open module related bugs and in a way that is
compatible with upstream LLVM.

<rdar://problem/16539726> Fix debug info for modules after LLVM r205685
<rdar://problem/16504765> Emit DW_TAG_namespace entry for the current module into DWARF

Swift SVN r16086
2014-04-09 00:11:02 +00:00
Adrian Prantl
f3de7e6b17 Debug info: use the proper version string, now that we have one.
Swift SVN r16085
2014-04-09 00:11:01 +00:00