Commit Graph

558 Commits

Author SHA1 Message Date
Adrian Prantl
d50448a55f Represent Swift errors as DW_TAG_thrown_type in DWARF
This allows the debugger to display them alongside the function's
return value when finish-ing a function.

rdar://problem/29481673
2017-04-27 09:45:54 -07:00
Bob Wilson
df1b64eaa7 Update uses of DIBuilder.createPointerType to match LLVM r297320.
This function has a new argument to specify a DWARFAddressSpace value.
There is a default value but since it was not added as the last argument,
Swift needs to update calls that specify the optional pointer type name
argument.

(cherry picked from commit 21ddc5c087)
(cherry picked from commit 915cda6a05cf7c7eddbb79af14a023914cb9cea9)
2017-04-18 12:24:07 -07:00
Adrian Prantl
8e6d6338ce Emit debug info for Swift types using the default alignment where possible.
This patch emits the alignment for all default-aligned types as 0
which causes the backend to not emit an alignment attribute at
all. This mirrors clang's behavior.

<rdar://problem/29007471>
2017-04-17 11:35:33 -07:00
swift-ci
78a90fba46 Merge pull request #8661 from adrian-prantl/abs 2017-04-10 12:14:34 -07:00
Adrian Prantl
869dba0674 Don't call make_absolute more often than necessary in IRGenDebugInfo. 2017-04-10 11:29:15 -07:00
Adrian Prantl
f5d41fb853 Don't emit debug info for generic types with no declcontext.
Follow-up to 991a66fd99.

rdar://problem/31482203
2017-04-06 17:26:34 -07:00
Huon Wilson
31b92b1b46 Merge pull request #8473 from huonw/symbol-list-2
Remove dependency on IRGenModule of some linkage computations
2017-04-05 16:39:04 -07:00
Huon Wilson
3105c6ed00 [IRGen] Expose LinkInfo publicly, like LinkEntity. 2017-04-05 09:54:19 -07:00
Adrian Prantl
b3f642853c Rearrange IRGenDebugInfo::setCurrentLoc() to avoid decoding throwaway locations. 2017-04-05 08:34:10 -07:00
Adrian Prantl
5ea2d13f5e Improve the performance of IRGenDebugInfo
This commit changes how inline information is stored in SILDebugScope
from a tree to a linear chain of inlined call sites (similar to what
LLVM is using). This makes creating inlined SILDebugScopes slightly
more expensive, but makes lowering SILDebugScopes into LLVM metadata
much faster because entire inlined-at chains can now be cached. This
means that SIL is no longer preserve the inlining history (i.e., ((a
was inlined into b) was inlined into c) is represented the same as (a
was inlined into (b was inlined into c)), but this information was not
used by anyone.

On my late 2012 i7 iMac, this saves about 4 seconds when compiling the
RelWithDebInfo x86_64 swift standard library — or 40% of IRGen time.

rdar://problem/28311051
2017-04-05 08:33:55 -07:00
Adrian Prantl
b872127b66 Debgger type mangling: Pass GenericEnvironment separate from DeclContext.
This fixes a crash while building the Swift standard library when
partial specializations are enabled.

Eventually we should get rid of needing the DeclContext in the mangled
typename at all, and this is one step towards that goal.

rdar://problem/31253373
2017-03-25 14:09:14 -07:00
Erik Eckstein
d70bfc5de2 rename namespace NewMangling -> Mangle 2017-03-20 10:09:30 -07:00
Erik Eckstein
1625345b90 Remove the old mangler.
NFC
2017-03-17 16:10:36 -07:00
Erik Eckstein
5e80555c9b demangler: put the demangler into a separate library
Previously it was part of swiftBasic.

The demangler library does not depend on llvm (except some header-only utilities like StringRef). Putting it into its own library makes sure that no llvm stuff will be linked into clients which use the demangler library.

This change also contains other refactoring, like moving demangler code into different files. This makes it easier to remove the old demangler from the runtime library when we switch to the new symbol mangling.

Also in this commit: remove some unused API functions from the demangler Context.

fixes rdar://problem/30503344
2017-03-09 13:42:43 -08:00
Slava Pestov
0611d663b8 SIL: Remove SILType::getSwiftType() 2017-02-27 20:01:35 -08:00
Slava Pestov
721e6178f5 AST: Remove TypeBase::isUnspecializedGeneric() 2017-02-27 20:00:35 -08:00
David Farler
431b7ff2af [Syntax] Add Equal '=' token location to TypeAliasDecl
Needed for full-fidelity structured editing.
2017-02-17 12:57:04 -08:00
Slava Pestov
41eba98902 Gardening: Fix some unused variable warnings in no-assert builds 2017-02-15 12:57:35 -08:00
Slava Pestov
dca292c652 Serialization: Don't serialize contextual enum argument type
Storing this separately is unnecessary since we already
serialize the enum element's interface type. Also, this
eliminates one of the few remaining cases where we serialize
archetypes during AST serialization.
2017-01-30 00:08:53 -08:00
Andrew Trick
978b2fc80b Fix terminology. There's no such thing as a "formal SIL type".
Formal types are defined by the language's type system. SIL types are
lowered. They are no longer part of that type system.

The important distinction here is between the SIL storage type and the SIL value
type. To make this distinction clear, I refer to the SILFunctionTypes "formal"
conventions. These conventions dictate the SIL storage type but *not* the SIL
value type. I call them "formal" conventions because they are an immutable
characteristic of the function's type and made explicit via qualifiers on the
function type's parameters and results. This is in contrast to to SIL
conventions which depend on the SIL stage, and in the short term whether the
opaque values flag is enabled.
2017-01-26 15:35:48 -08:00
Andrew Trick
1abeddcc5d [SILType] SILFunctionConventions API.
Separate formal lowered types from SIL types.
The SIL type of an argument will depend on the SIL module's conventions.
The module conventions are determined by the SIL stage and LangOpts.

Almost NFC, but specialized manglings are broken incidentally as a result of
fixes to the way passes handle book-keeping of aruments. The mangler is fixed in
the subsequent commit.

Otherwise, NFC is intended, but quite possible do to rewriting the logic in many
places.
2017-01-26 15:35:48 -08:00
Erik Eckstein
a56a97c89f Mangling: prepare for using new mangling for USR and debug-info type generation.
Select between old and new mangling as we already do in other places in the compiler.
NFC as long as the new mangling is not enabled yet.
2017-01-23 17:49:00 -08:00
Bob Wilson
eeb0f08988 Merge remote-tracking branch 'origin/master' into master-next 2017-01-17 10:45:44 -08:00
Adrian Prantl
bb55c6d8a6 Clean up the constructors of DebugTypeInfo
and ensure that the DeclContext of the SILFunction is used when
mangling substituted archetypes found in inlined variable declarations
that have been reparented into the caller

<rdar://problem/28859432>
2017-01-13 15:56:27 -08:00
Bob Wilson
37e7d1c627 Merge remote-tracking branch 'origin/master' into master-next 2017-01-08 17:07:46 -08:00
Brian Gesiak
663b92ece9 [AST] Completely replace Module with ModuleDecl
The typedef `swift::Module` was a temporary solution that allowed
`swift::Module` to be renamed to `swift::ModuleDecl` without requiring
every single callsite to be modified.

Modify all the callsites, and get rid of the typedef.
2017-01-08 00:36:08 -05:00
practicalswift
6d1ae2a39c [gardening] 2016 → 2017 2017-01-06 16:41:22 +01:00
Saleem Abdulrasool
1aecddbdef Adjust for SVN r290153
DIGlobalVariable had the associated expression separated into a
DIGlobalVariableExpression which ties the DIGlobalVariable and the
DIExpression together.
2017-01-03 14:30:55 -08:00
Saleem Abdulrasool
6d47571baf Adjust for SVN r289702
The File and Directory parameters to CreateCompileUnit have been changed to a
single DIFile parameter to permit future expansion.
2017-01-03 14:30:07 -08:00
Bob Wilson
78b28243ff Merge remote-tracking branch 'origin/master' into master-next 2017-01-03 14:22:59 -08:00
Saleem Abdulrasool
27bf54328f IRGen: adjust DI for SVN r288683
The original implementation of DW_OP_bit_piece was using the wrong base for the
offset.  To accommodate a fix for that, the old operation was renamed.  Use the
new migration name.

(cherry picked from commit 100eaf889e)
2016-12-21 09:11:37 -08:00
Slava Pestov
2c6b9f71b6 AST: Change TypeAliasDecls to store an interface type as their underlying type
- TypeAliasDecl::getAliasType() is gone. Now, getDeclaredInterfaceType()
  always returns the NameAliasType.

- NameAliasTypes now always desugar to the underlying type as an
  interface type.

- The NameAliasType of a generic type alias no longer desugars to an
  UnboundGenericType; call TypeAliasDecl::getUnboundGenericType() if you
  want that.

- The "lazy mapTypeOutOfContext()" hack for deserialized TypeAliasDecls
  is gone.

- The process of constructing a synthesized TypeAliasDecl is much simpler
  now; instead of calling computeType(), setInterfaceType() and then
  setting the recursive properties in the right order, just call
  setUnderlyingType(), passing it either an interface type or a
  contextual type.

  In particular, many places weren't setting the recursive properties,
  such as the ClangImporter and deserialization. This meant that queries
  such as hasArchetype() or hasTypeParameter() would return incorrect
  results on NameAliasTypes, which caused various subtle problems.

- Finally, add some more tests for generic typealiases, most of which
  fail because they're still pretty broken.
2016-12-15 22:46:15 -08:00
Slava Pestov
a384b2a677 Don't call VarDecl::getType() on deserialized VarDecls 2016-12-15 22:46:15 -08:00
Erik Eckstein
ad8a6d2a00 Mangling: remove unnecessary size check in assert condition 2016-12-15 14:08:11 -08:00
Saleem Abdulrasool
100eaf889e IRGen: adjust DI for SVN r288683
The original implementation of DW_OP_bit_piece was using the wrong base for the
offset.  To accommodate a fix for that, the old operation was renamed.  Use the
new migration name.
2016-12-13 14:43:35 -08:00
Bob Wilson
deddf19aae Merge remote-tracking branch 'origin/master' into master-next 2016-12-13 10:23:03 -08:00
Erik Eckstein
d218c92f24 Mangling: fix assert in IRGenDebugInfo to support new mangling prefix 2016-12-09 09:05:16 -08:00
Slava Pestov
f3c72d8941 AST: Remove SubstitutedType 2016-12-07 17:03:07 -08:00
Michael Gottesman
59c6a64f5a [gardening] 0 => nullptr. Fixed with clang-tidy. 2016-12-06 23:14:13 -08:00
Bob Wilson
13da3fa8b1 Merge remote-tracking branch 'origin/master' into master-next 2016-12-04 18:16:09 -08:00
Slava Pestov
52b91ad910 AST: Remove AssociatedTypeType 2016-12-01 14:53:31 -08:00
Slava Pestov
9caaad442b AST: Don't call hasType()/getType()/setType() on TypeDecls 2016-12-01 13:00:19 -08:00
Slava Pestov
2d83a79c2c AST: Remove TypeDecl::getDeclaredType()
A pointless use of polymorphism -- the result values are not
interchangeable in any practical sense:

- For GenericTypeParamDecls, this returned getDeclaredInterfaceType(),
  which is an interface type.

- For AssociatedTypeDecls, this returned the sugared AssociatedTypeType,
  which desugars to an archetype.

- For TypeAliasDecls, this returned TypeAliasDecl::getAliasType(),
  which desugars to a type containing archetypes.

- For NominalTypeDecls, this returned NominalTypeDecl::getDeclaredType(),
  which is the unbound generic type, a special case used for inferring
  generic arguments when they're not written in source.
2016-12-01 13:00:18 -08:00
Slava Pestov
835472b14f AST: Remove PolymorphicFunctionType 2016-11-29 03:05:35 -07:00
Slava Pestov
cb539bc766 IRGen: Remove unnecessary hasType() check 2016-11-29 03:05:29 -07:00
practicalswift
797b80765f [gardening] Use the correct base URL (https://swift.org) in references to the Swift website
Remove all references to the old non-TLS enabled base URL (http://swift.org)
2016-11-20 17:36:03 +01:00
Bob Wilson
f10ae47b9f Merge remote-tracking branch 'origin/master' into master-next 2016-11-15 17:32:28 -08:00
Bob Wilson
a4e5bb6d3f Fix debug info to build with llvm r284678.
This is likely not the full solution, since it does not add the
alignment for DIVariables.
2016-10-28 12:09:57 -07:00
Jordan Rose
26be9369d5 [IRGen] Fix lifetime extension issue with StringRef.
Similar to 4960ad1.
2016-10-20 20:17:00 -07:00
Bob Wilson
123865cef5 Use llvm::DINode::DIFlags typed enum to match llvm r280700 2016-10-15 11:02:19 -07:00