Commit Graph

1132 Commits

Author SHA1 Message Date
Adrian Prantl
44aa4822e0 Debug Info: Represent private discriminators in DWARF.
... using an inline namespace as the parent of the outermost
declaration(s) that have private or fileprivate accessability. Once
LLDB supports this we can retire the existing hack of storing it as a
fake command line argument.

rdar://problem/18296829
2017-10-09 15:32:06 -07:00
Adrian Prantl
f7742121a5 Debug Info: Record the base name for inout types and fix tests for i386.
rdar://problem/33761763
2017-08-09 15:22:13 -07:00
Adrian Prantl
ff0397bdaa Update to upstream llvm changes (remove offset from llvm.dbg.value)
rdar://problem/33580047
2017-07-28 14:16:10 -07:00
Adrian Prantl
b85f1d679b Update for LLVM IR metadata changes (DIImportedEntity now needs a DIFile).
rdar://problem/32993231
2017-07-18 18:09:55 -07:00
Alex Hoppen
f8c2692f79 Introduce special decl names
Special DeclNames represent names that do not have an identifier in the
surface language. This implies serializing the information about whether
a name is special together with its identifier (if it is not special)
in both the module file and the swift lookup table.
2017-07-11 19:04:13 +02:00
Alex Hoppen
2078ec6f0a Remove getName from ValueDecl
Push the getName method from ValueDecl down to only those types that are
guaranteed to have a name that is backed by an identifier and that will
not be special.
2017-06-15 21:49:34 +02:00
Adrian Prantl
efc41d9153 Add a virtual destructor to avoid leaking the new private impl's memory.
rdar://problem/32520596
2017-06-01 15:53:58 -07:00
swift-ci
935535414d Merge pull request #9913 from adrian-prantl/32327266 2017-05-24 15:27:02 -07:00
Adrian Prantl
17496f3012 Simplify IRGenDebugInfo submodule creation and support homonymous submodules. 2017-05-24 14:00:07 -07:00
Adrian Prantl
84d9238315 Emit llvm.dbg.declare intrisics immediately after the described alloca.
This cleanup change doesn't change the semantics, but it makes the
resulting IR much easier to read and debug.
2017-05-24 09:13:41 -07:00
Adrian Prantl
0b2b0c036c Revert "Emit llvm.dbg.declare intrisics immediately after the described alloca."
This reverts commit 8660fd489a.
2017-05-23 11:42:13 -07:00
Adrian Prantl
8660fd489a Emit llvm.dbg.declare intrisics immediately after the described alloca.
This cleanup change doesn't change the semantics, but it makes the
resulting IR much easier to read and debug.
2017-05-23 09:23:41 -07:00
Adrian Prantl
f344e535f3 Debug info: Avoid emitting module imports twice when access path differs.
This fixes a recent regression from 68a5cadb90.
rdar://problem/32327266
2017-05-22 11:53:12 -07:00
swift-ci
f023fcefac Merge pull request #9732 from adrian-prantl/29793594 2017-05-18 11:24:43 -07:00
Adrian Prantl
78d6b8df7e Change DIFileCache from a DenseMap to a StringMap.
We have received crash reports indicating a crash in
DensMap::lookupBucketFor. This change avoids a crash caused by a
filename being a stale reference.

rdar://problem/29793594
2017-05-18 09:40:19 -07:00
Adrian Prantl
68a5cadb90 Debug Info: Generate imported entities for implicitly imported parent modules.
The Swift compiler uses an ugly hack that auto-imports a submodule's
top-level-module, even if we didn't ask for it. Reflect that in the
debug info.

<rdar://problem/31310320>
2017-05-17 12:58:04 -07:00
Slava Pestov
9c210247f5 Remove unused variables 2017-05-10 22:12:26 -07:00
practicalswift
0abf013452 [gardening] Remove unused method 2017-05-10 14:53:15 +02:00
swift-ci
e30c114f9e Merge pull request #9446 from adrian-prantl/31990102 2017-05-09 22:51:13 -07:00
Adrian Prantl
e2784cbb87 Represent Clang macro definitions from -Xcc options in the debug info.
Currently -Xcc options are serialized in Swift modules, but they are
not saved as attributes to the DW_TAG_module representing the imported
clang module. This patch saves all *user-specified* -D macros there,
but it does not save any macros that are added by the ClangImporter
itself.

<rdar://problem/31990102>
2017-05-09 16:46:22 -07:00
Adrian Prantl
e1566462a0 Fix the hash function for SILDebugScopes to handle the empty scopes
generated for artificial LLVM-only functions correctly.

This fixes an IR Verifier error that was introduced in LLVM r302576.
The bug itself was introduced together with the code in 5ea2d13f5e.

<rdar://problem/31926379>
2017-05-09 15:14:19 -07:00
practicalswift
492f5cd35a [gardening] Remove redundant repetition of type names (DRY): RepeatedTypeName foo = dyn_cast<RepeatedTypeName>(bar)
Replace `NameOfType foo = dyn_cast<NameOfType>(bar)` with DRY version `auto foo = dyn_cast<NameOfType>(bar)`.

The DRY auto version is by far the dominant form already used in the repo, so this PR merely brings the exceptional cases (redundant repetition form) in line with the dominant form (auto form).

See the [C++ Core Guidelines](https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md#es11-use-auto-to-avoid-redundant-repetition-of-type-names) for a general discussion on why to use `auto` to avoid redundant repetition of type names.
2017-05-05 09:45:53 +02:00
Adrian Prantl
0cb4a2865d Refactor/Cleanup IRGenDebugInfo to use a private implementation (NFC) 2017-05-03 08:34:06 -07:00
Adrian Prantl
c2b14dccd3 Debug info: Represent clang-imported submodules.
Previously an import of a submodule would emit debug info for
importing the root module.

<rdar://problem/17260802>
2017-05-03 08:33:55 -07:00
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