Commit Graph

1132 Commits

Author SHA1 Message Date
Adrian Prantl
a1da38c3aa Adapt IRGenDebugInfo to upstream LLVM IR Metadata changes.
Swift SVN r27709
2015-04-24 20:59:09 +00:00
Erik Eckstein
f362570fb9 Change IRGenModuleDispatcher to a reference in IRGenModule.
According to Sean's feedback.



Swift SVN r27692
2015-04-24 09:17:29 +00:00
Erik Eckstein
58f43c077a Add comment and assert in IRGenDebugInfo.
According to Adrian's feedback.



Swift SVN r27691
2015-04-24 08:53:46 +00:00
Erik Eckstein
8bd9712ed3 Fix crash when compiling a module with a main-file with -g and -wmo -num-threads.
rdar://problem/20655307



Swift SVN r27631
2015-04-23 08:32:47 +00:00
Adrian Prantl
6aaab86390 Debug info: Account for enums with zero elements.
<rdar://problem/20645585> DebugInfo generation assertion failure on swiftz

Swift SVN r27562
2015-04-22 05:21:39 +00:00
John McCall
9f38d8da50 Require a GenericSignature for dependent AbstractionPatterns.
We still don't actually handle these correctly, but at least
we have sensible information for them now.

Also, remember that we're working with canonical generic
signatures in more places.

Swift SVN r27388
2015-04-16 23:27:00 +00:00
Nadav Rotem
f2169f8103 Silence a few more warnings in Release builds.
Swift SVN r27334
2015-04-15 21:38:23 +00:00
Joe Groff
ad0d20c07a Fold "AbstractCC" into SILFunctionType::Representation.
These aren't really orthogonal concerns--you'll never have a @thick @cc(objc_method), or an @objc_block @cc(witness_method)--and we have gross decision trees all over the codebase that try to hopscotch between the subset of combinations that make sense. Stop the madness by eliminating AbstractCC and folding its states into SILFunctionTypeRepresentation. This cleans up a ton of code across the compiler.

I couldn't quite eliminate AbstractCC's information from AST function types, since SIL type lowering transiently created AnyFunctionTypes with AbstractCCs set, even though these never occur at the source level. To accommodate type lowering, allow AnyFunctionType::ExtInfo to carry a SILFunctionTypeRepresentation, and arrange for the overlapping representations to share raw values.

In order to avoid disturbing test output, AST and SILFunctionTypes are still printed and parsed using the existing @thin/@thick/@objc_block and @cc() attributes, which is kind of gross, but lets me stage in the real source-breaking change separately.

Swift SVN r27095
2015-04-07 21:59:39 +00:00
Joe Groff
4821f594bb SIL: Separate SILFunctionType::Representation and ExtInfo from AST FunctionTypes.
The set of attributes that make sense at the AST level is increasingly divergent from those at the SIL level, so it doesn't really make sense for these to be the same. It'll also help prevent us from accidental unwanted propagation of attributes from the AST to SIL, which has caused bugs in the past. For staging purposes, start off with SILFunctionType's versions exactly the same as the FunctionType versions, which necessitates some ugly glue code but minimizes the potential disruption.

Swift SVN r27022
2015-04-05 17:04:55 +00:00
John McCall
dc4b8ff2c2 Incorporate an optional Clang type into AbstractionPattern.
This is necessary for correctly dealing with non-standard
ownership conventions in secondary positions, and it should
also help with non-injective type imports (like BOOL/_Bool).
But right now we aren't doing much with it.

Swift SVN r26954
2015-04-03 21:39:31 +00:00
Duncan Exon Smith
b519148eb9 IRGen: Fix inlined DebugLoc generation for upstream LLVM r233573
`DebugLoc`'s API changed in LLVM r233573.  Start using it now so the build
doesn't break when the old API gets removed.



Swift SVN r26724
2015-03-30 20:28:24 +00:00
Duncan Exon Smith
624776bf42 Revert "DebugInfo: Update for ToT LLVM change r233446"
Revert r26665, since it was insufficient to fix the builders [1].  Instead,
I've loosened the check upstream for now in r233468.




Swift SVN r26672
2015-03-28 02:49:43 +00:00
Duncan Exon Smith
c422680fce DebugInfo: Update for ToT LLVM change r233446
Upstream requires a valid type array for `MDSubroutineType`, so don't create
one unless we actually have parameters.  Should fix the bot [1].





Swift SVN r26665
2015-03-28 01:57:54 +00:00
Adrian Prantl
47aba92ba2 Add an explicit check for null here — LLVM just became stricter.
<rdar://problem/20245578> [BuildCzar][3/20/15] Debug Info Tests are Failing

Swift SVN r26379
2015-03-20 23:54:33 +00:00
Adrian Prantl
3c6af3610a Debug Info: type-unique enum types by virtue of their mangled name.
rdar://problem/20015686

Swift SVN r26104
2015-03-13 18:13:59 +00:00
Adrian Prantl
a100a3e6e9 Debug Info: Don't absolutize file paths.
Fixes <rdar://problem/19985842> REPL should set the default file to "repl.swift"

Swift SVN r26022
2015-03-12 02:56:49 +00:00
Adrian Prantl
d495d2110a Debug Info: Use the storage size for debug types where we previously
didn't and make the assertion about zero-sized types stricter.

<rdar://problem/19978910> Assertion failed: (Ty.getSizeInBits() && "type with size 0"), function getSizeInBits

Swift SVN r25599
2015-02-27 06:25:13 +00:00
Adrian Prantl
17c4a51f45 Debug info: Have a function's name default to its linkage name.
Swift SVN r25502
2015-02-24 17:27:35 +00:00
Adrian Prantl
45544727ac Mark reabstraction thunk helpers as auto-generated.
Fixes <rdar://problem/18670152> Stack trace is a lie.

Swift SVN r25362
2015-02-18 00:46:25 +00:00
Adrian Prantl
833a7f48a5 Adopt upstream LLVM API change.
Swift SVN r25183
2015-02-11 18:29:59 +00:00
Adrian Prantl
1d6d890e13 Adapt upstream LLVM API change.
Swift SVN r25109
2015-02-10 00:55:03 +00:00
David Farler
51f8070abe Serialize local types
Local type declarations are saved in the source file during parsing,
now serialized as decls. Some of these may be defined in DeclContexts
which aren't Decls and previously weren't serialized. Create four new
record kinds:

* PatternBindingInitializer
* DefaultArgumentInitializer
* AbstractClosureExpr
* TopLevelCodeDecl

These new records are used to only preserve enough information for
remangling in the debugger, and parental context relationships.

Finally, provide a lookup API in the module to search by mangled name.
With the new remangling API, the debugging lifecycle for local types
should be complete.

The extra LOCAL_CONTEXT record will compressed back down in a
subsequent patch.

Swift SVN r24739
2015-01-27 01:49:54 +00:00
Adrian Prantl
d1d4fd86f8 Don't emit debug info for global values with hidden visibility.
<rdar://problem/19313855> _TWVVSC26NSKeyValueObservingOptions shows up in global variables

Swift SVN r24695
2015-01-23 23:35:36 +00:00
Adrian Prantl
46edb2891d There are currently situations where two (types that
contains an) archetype(s) mangle to the same name but differ in
their storage size.
This is causing an assertion on some of the build bots.
This works around the problem by not caching them, until I can reproduce
the problem on a smaller scale and fix the mangler.

Swift SVN r24682
2015-01-23 05:39:03 +00:00
Adrian Prantl
15f18f79fa Use getFixedBufferSize() here to clarify the intention.
Swift SVN r24651
2015-01-22 19:56:54 +00:00
Adrian Prantl
5ee2fedc37 Debug info: Use 3xi8 as a fallback type size for %swift.opaque if we
can't determine the storage size.

Swift SVN r24649
2015-01-22 19:42:11 +00:00
Adrian Prantl
171035d974 Debug info: Don't emit a line number for tuple types. They are unnamed
and have no declaration, so the line number is nonsensical.

Swift SVN r24648
2015-01-22 19:42:11 +00:00
Adrian Prantl
723c9aa196 Debug Info: Fix the caching policy for types that cannot be cached,
either because they don't have a UID, or because their Swift type may
be more general than their specialized type.

Swift SVN r24647
2015-01-22 19:42:10 +00:00
Adrian Prantl
a2c9033ac2 Debug info: Don't emit a line number for inout types. They are unnamed
so the line number is nonsensical.

Swift SVN r24646
2015-01-22 19:42:09 +00:00
Adrian Prantl
9e66db8d95 remove stale comment.
Swift SVN r24645
2015-01-22 19:42:09 +00:00
Adrian Prantl
cf393e8766 Don't emit sugar typedefs for sugar types that don't have their own
mangling schema. Caught via the "conflicting types for UID" assertion
in getOrCreateType.

Swift SVN r24644
2015-01-22 19:42:05 +00:00
Greg Parker
6cc99440a5 Adopt llvm's removal of MDNodeFwdDecl.
Swift SVN r24544
2015-01-20 02:35:33 +00:00
Adrian Prantl
8c4355460b Remove the soft-fail from this assertion.
Swift SVN r24466
2015-01-16 01:11:25 +00:00
Adrian Prantl
23829b651e Add an assert message.
Swift SVN r24465
2015-01-16 01:11:25 +00:00
Adrian Prantl
c1d391aa66 Debug Info: Only verify the validity of scopes in debug builds as this is
quite an expensive operation and getOrCreateScope either returns a nullptr
or a valid scope.

Swift SVN r24464
2015-01-16 01:11:22 +00:00
David Farler
cad9f99929 Revert "Serialize local types and provide a lookup API"
Changing the design of this to maintain more local context
information and changing the lookup API.

This reverts commit 4f2ff1819064dc61c20e31c7c308ae6b3e6615d0.

Swift SVN r24432
2015-01-15 00:33:10 +00:00
David Farler
fab3d491d9 Serialize local types and provide a lookup API
rdar://problem/18295292

Locally scoped type declarations were previously not serialized into the
module, which meant that the debugger couldn't reason about the
structure of instances of those types.

Introduce a new mangling for local types:
[file basename MD5][counter][identifier]
This allows the demangle node's data to be used directly for lookup
without having to backtrack in the debugger.

Local decls are now serialized into a LOCAL_TYPE_DECLS table in the
module, which acts as the backing hash table for looking up
[file basename MD5][counter][identifier] -> DeclID mappings.

New tests:
* swift-ide-test mode for testing the demangle/lookup/mangle lifecycle
of a module that contains local decls
* mangling
* module merging with local decls

Swift SVN r24426
2015-01-14 22:08:47 +00:00
Adrian Prantl
a513e03680 Debug info: Push the non-handling of indirect pieces down to
IRGenDebugInfo.

NFC.

rdar://problem/19417227.

Swift SVN r24319
2015-01-09 18:38:32 +00:00
Adrian Prantl
53f9529e0c Debug info: Do not cache Archetypes based on their Swift type.
After the SILPasses, they may have different underlying storage types.

Discovered via <rdar://problem/19377246>.

Swift SVN r24191
2015-01-05 23:54:28 +00:00
Adrian Prantl
8a817d8dca Adapt to upstream LLVM API changes.
Swift SVN r24006
2014-12-18 17:07:57 +00:00
John McCall
169e4fe319 Add Builtin.UnsafeValueBuffer, which provides opaque
storage for arbitrary values.

A buffer doesn't provide any way to identify the type of
value it stores, and so it cannot be copied, moved, or
destroyed independently; thus it's not available as a
first-class type in Swift, which is why I've labelled
it Unsafe.  But it does allow an efficient means of
opaquely preserving information between two cooperating
functions.  This will be useful for the adjustments I
need to make to materializeForSet to support safe
addressors.

I considered making this a SIL type category instead,
like $@value_buffer T.  This is an attractive idea because
it's generally better-typed.  The disadvantages are that:
- it would need its own address_to_pointer equivalents and
- alloc_stack doesn't know what type will be stored in
  any particular buffer, so there still needs to be
  something opaque.

This representation is a bit gross, but it'll do.

Swift SVN r23903
2014-12-13 01:27:12 +00:00
Adrian Prantl
9ee65d5ff0 Adapt swift for Duncan's upstream LLVM change r223802.
<rdar://problem/19192991> Upstream LLVM MDNode changes break Swift

Swift SVN r23811
2014-12-09 20:25:43 +00:00
Adrian Prantl
883f2d3a24 Revert an accidentally comitted line and fix the build bots.
Swift SVN r23678
2014-12-04 03:49:01 +00:00
Adrian Prantl
3202823f3e Debug info: Emit the actual types for specialized variables instead of
their generic type.

NFC for unoptimized code, testcase for optimized code will come with
rdar://problem/18709125.

Swift SVN r23676
2014-12-04 02:13:46 +00:00
Adrian Prantl
41a30f5988 Support line table only DWARF for Swift. <rdar://problem/19106981>
The new option is called -gline-tables-only to mirror clang.

Swift SVN r23615
2014-12-02 17:44:23 +00:00
Adrian Prantl
6121e4267f Cleanup.
Swift SVN r23375
2014-11-17 18:46:12 +00:00
Adrian Prantl
6f42b37661 Fix a bug were a stack-allocated string was used as an index into a map.
<rdar://problem/19001254> DebugInfo/Imports.swift is broken

Swift SVN r23374
2014-11-17 18:46:09 +00:00
Adrian Prantl
c578ef6f02 Emit human-readable names for destructors in the debug info.
<rdar://problem/16653867> swift is emitting many "empty string" named items in the apple-names table

Swift SVN r23292
2014-11-13 00:11:27 +00:00
Adrian Prantl
dd4032ee41 Modify the Mangler to recursively deal with sugared types.
Unless DWARFmangling is set all methods still expect a CanonicalType.

Fixes <rdar://problem/17042576> [6A214t] Debug information has wrong type for dispatch queue

Swift SVN r23226
2014-11-11 01:32:12 +00:00
Adrian Prantl
993c72499b This week in debug info: global variables are now emitted as global variables.
rdar://problem/15859689 once again.

Swift SVN r23169
2014-11-08 00:29:38 +00:00