Commit Graph

1132 Commits

Author SHA1 Message Date
Arnold Schwaighofer
5b4e0566b9 [IRGen] Fix debug info for direct arguments/return values
Emit shadow copies in async functions and emit a load to get the value.
2021-03-17 07:41:10 -07:00
Adrian Prantl
3401f8ab93 Support local variables in virtual async backtraces.
rdar://75012612
2021-03-10 17:52:20 -08:00
Adrian Prantl
c2dc87cd6b Debug info support for let await result variables. 2021-02-24 12:55:24 -08:00
Holly Borla
11028350a7 Merge pull request #35589 from Jumhyn/placeholder-types
[AST, Sema] Replace HoleType with PlaceholderType
2021-02-22 08:35:37 -08:00
Adrian Prantl
582bbbdbd9 Add debug info support for direct async arguments.
rdar://74460135
2021-02-19 15:48:59 -08:00
Frederick Kellison-Linn
e4ea1678dc Rename HoleType to PlaceholderType
HoleType basically served the same purpose as PlaceholderType. This commit unifies the two.
2021-02-16 22:59:19 -05:00
Frederick Kellison-Linn
d78d95ef0d [AST] Introduce PlaceholderType and ThePlaceholderType singleton 2021-02-16 22:59:18 -05:00
Adrian Prantl
b3f5ac3281 Add debug info support for boxed arguments in async functions.
Usually debug info only ever describes the *result* of a projectBox
call. To display a boxed parameter of an async continuation object,
however, the debug info can only describe the box itself and thus also
needs to emit a box type for it so the debugger knows to call into
Remote Mirrors to unbox the value.

SR-14059
rdar://problem/73358988
2021-02-03 14:40:36 -08:00
Adrian Prantl
730af40841 Recover from an incorrect merge conflict resolution 2021-01-29 16:27:03 -08:00
Adrian Prantl
a9f05c8c30 Merge remote-tracking branch 'origin/main' into rebranch
Conflicts:
	lib/IRGen/IRGenDebugInfo.cpp
2021-01-29 16:17:10 -08:00
Erik Eckstein
462e58d3cb SILLocation: a big refactoring and reducing its size from 3 to 2 words
My goal was to reduce the size of SILLocation. It now contains only of a storage union, which is basically a pointer and a bitfield containing the Kind, StorageKind and flags. By far, most locations are only single pointers to an AST node. For the few cases where more data needs to be stored, this data is allocated separately: with the SILModule's bump pointer allocator.

While working on this, I couldn't resist to do a major refactoring to simplify the code:

* removed unused stuff
* The term "DebugLoc" was used for 3 completely different things:
    - for `struct SILLocation::DebugLoc` -> renamed it to `FilePosition`
    - for `hasDebugLoc()`/`getDebugSourceLoc()` -> renamed it to `hasASTNodeForDebugging()`/`getSourceLocForDebugging()`
    - for `class SILDebugLocation` -> kept it as it is (though, `SILScopedLocation` would be a better name, IMO)
* made SILLocation more "functional", i.e. replaced some setters with corresponding constructors
* replaced the hand-written bitfield `KindData` with C bitfields
* updated and improved comments
2021-01-29 20:28:21 +01:00
swift-ci
601af1352a Merge remote-tracking branch 'origin/main' into rebranch 2021-01-27 15:32:37 -08:00
Nate Chandler
e21550ad90 [SILGen] Enable alternative entry point name.
Previously, the name of the entry point function was always main.  Here,
a new frontend flag is added to enable an arbitrary name to be
specified.

rdar://58275758
2021-01-26 10:43:33 -08:00
swift-ci
eb13f804ff Merge remote-tracking branch 'origin/main' into rebranch 2021-01-19 20:52:19 -08:00
Slava Pestov
4c72128372 IRGen: Plumb through a GenericSignature when mangling types for debug info
The generic signature isn't used for a whole lot, so this all mostly
worked before; the test case I have hits the code path for mangling
a retroactive conformance.

Fixes <https://bugs.swift.org/browse/SR-14016> / <rdar://problem/72865083>.
2021-01-19 17:25:28 -05:00
Adrian Prantl
e19eb67bf4 Adapt to upstream changes in 41c3b271399229976d9885233db79ebbbe0383c6
DebugLoc has been replaced with DILocation.
2020-12-16 14:59:40 -08:00
John McCall
d68d406dae Merge pull request #35094 from rjmccall/actor-dynamic-layout
Do dynamic layout of generic/resilient default actors properly
2020-12-16 01:05:00 -05:00
John McCall
bad16fd105 Do dynamic layout of generic/resilient default actors properly.
Since these types have an implicit stored property, this requires
adding an abstraction over fields to IRGen, at least throughout
the class code.  In some ways I think this significantly improves
the code, especially in how we approach missing members.

Fixes rdar://72202671.
2020-12-15 20:10:46 -05:00
Adrian Prantl
0e6a0b84d1 Add debug info support for function arguments in async functions.
This commit depends on changes to the coroutine-splitting pass in LLVM.  Shadow
copies are also turned off for async function arguments, because they make it
impossible to track debug info during coroutine splitting. Instead we are
relying on LLVM's CoroSplit.cpp to emit shadow copies. The Swift frontend gives
CoroSplit license to move do this by describing the arguments using a
dbg.declare intrinsic, even though it points to chain of load/GEP/bitcase
instructions into the Swift context function argument.

rdar://71866936
2020-12-11 16:59:09 -08:00
John McCall
ee0bb0a2d5 Freeze PartialAsyncTask as a Job*.
Also fix the extra inhabitants of Builtin.RawUnsafeContinuation
and try to make adding types like this a little less boiler-plate
in the future.
2020-12-04 01:06:29 -05:00
Slava Pestov
1a89813bf5 AST: Introduce Builtin.RawUnsafeContinuation type
This is otherwise identical to Builtin.RawPointer, but has the spare
bits of a heap object pointer.
2020-12-01 20:03:22 -05:00
Brent Royal-Gordon
b440ab7331 [NFC] Move several types/functions to Import.h
To help consolidate our various types describing imports, this commit moves the following types and methods to Import.h:

* ImplicitImports
* ImplicitStdlibKind
* ImplicitImportInfo
* ModuleDecl::ImportedModule
* ModuleDecl::OrderImportedModules (as ImportedModule::Order)
* ModuleDecl::removeDuplicateImports() (as ImportedModule::removeDuplicates())
* SourceFile::ImportFlags
* SourceFile::ImportOptions
* SourceFile::ImportedModuleDesc

This commit is large and intentionally kept mechanical—nothing interesting to see here.
2020-10-09 18:57:07 -07:00
adrian-prantl
e7871c5584 Merge pull request #34037 from adrian-prantl/69393097
Store Clang module imports in addition to Swift overlay.
2020-09-24 08:39:55 -07:00
Varun Gandhi
734b8a2533 Merge pull request #33986 from varungandhi-apple/vg-import-filter-cleanup
[NFC] Clarify import filtering logic and naming.
2020-09-23 18:23:11 -07:00
Adrian Prantl
ba4c82d87e Store Clang module imports in addition to Swift overlay.
This helps the debugger resolve types in the underlying Clang module.

<rdar://problem/69393097>
2020-09-23 13:53:55 -07:00
Varun Gandhi
d3369f7711 [NFC] Rename ImportFilterKind cases to be clearer. 2020-09-23 12:50:20 -07:00
Varun Gandhi
7b967a8030 Merge pull request #33085 from varungandhi-apple/vg-clang-types-in-sil-retry
Propagate Clang function types through SIL
2020-09-22 08:48:34 -07:00
Varun Gandhi
5e9bf1f7c6 [SIL] Store ClangTypeInfo in SILFunctionType.
This patch includes a large number of changes to make sure that:
1. When ExtInfo values are created, we store a ClangTypeInfo if applicable.
2. We reduce dependence on storing SIL representations in ASTExtInfo values.
3. Reduce places where we sloppily create ASTExtInfo values which should
   store a Clang type but don't. In certain places, this is unavoidable;
   see [NOTE: ExtInfo-Clang-type-invariant].

Ideally, we would check that the appropriate SILExtInfo does always store
a ClangTypeInfo. However, the presence of the HasClangFunctionTypes option
means that we would need to condition that assertion based on a dynamic check.
Plumbing the setting down to SILExtInfoBuilder's checkInvariants would be too
much work. So we weaken the check for now; we should strengthen it once we
"turn on" HasClangFunctionTypes and remove the dynamic feature switch.
2020-09-16 10:34:42 -07:00
Brent Royal-Gordon
6da428a38e [NFC] Rename “DeclPath” -> “AccessPath”
To avoid ambiguity, ImportResolution and a few other things used the term “decl path” instead of “access path”. Switch back to the correct terminology now that the compiler is becoming more consistent about it.
2020-09-10 19:08:29 -07:00
Brent Royal-Gordon
cff4ddf13a [NFC] Adopt new ImportPath types and terminology
# Conflicts:
#	lib/IDE/CodeCompletion.cpp
2020-09-10 19:07:49 -07:00
swift_jenkins
fb946baf59 Merge remote-tracking branch 'origin/master' into master-rebranch 2020-08-28 11:08:22 -07:00
Pavel Yaskevich
78ea3de8e4 [AST] Introduce a new type to represent a type hole in constraint system
Instead of using `UnresolvedType` as a placeholder for a type hole,
let's switch over to a dedicated "rich" `HoleType` which is capable
of storing "originator" type - type variable or dependent member
type which couldn't be resolved.

This makes it easier for the solver to determine origins of
a hole which helps to diagnose certain problems better. It also
helps code completion to locate "expected type" of the context
even when it couldn't be completely resolved.
2020-08-26 16:55:39 -07:00
swift-ci
a0a181159c Merge remote-tracking branch 'origin/master' into master-rebranch 2020-07-31 16:07:19 -07:00
Slava Pestov
adb7bf541a IRGen: Replace some calls to getDeclaredType() with getDeclaredInterfaceType() 2020-07-31 13:39:02 -04:00
swift-ci
bca6fff39e Merge remote-tracking branch 'origin/master' into master-rebranch 2020-07-23 14:44:17 -07:00
zoecarver
5c3ccf5050 [cxx-interop] Temporarily disable emitting debug info for C++ types.
When we try to emit debug info from C++ types we crash because we can't deserialize them. This is a temporary fix to circumnavigate the crash before a real fix can be created.
2020-07-23 12:10:06 -07:00
swift_jenkins
99fd5e81c6 Merge remote-tracking branch 'origin/master' into master-next 2020-07-01 00:59:07 -07:00
Keith Smiley
8e886ab2f9 Apply -debug-prefix-map to isysroot (#32580)
* Apply -debug-prefix-map to isysroot

Previously the absolute path to the sysroot, which could differ across
machines in remote build scenarios, was included in the debug info of
object files:

```
!11 = distinct !DICompileUnit(language: DW_LANG_Swift, file: !12, producer: "Swift version 5.3-dev (LLVM 93caf26adb68d37, Swift 58b2ddc65afbd60)", isOptimized: false, runtimeVersion: 5, emissionKind: FullDebug, enums: !13, imports: !14, sysroot: "/Applications/Xcode-11.5.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk", sdk: "MacOSX.sdk")
```

With this change these are included in the remapping done by
`-debug-prefix-map`.

* Fix test
2020-07-01 00:40:30 -07:00
swift_jenkins
75bea14185 Merge remote-tracking branch 'origin/master' into master-next 2020-06-23 10:39:14 -07:00
Martin Boehme
d806ba53f6 Give OptionSet an initializer_list constructor.
This makes it easier to specify OptionSet arguments.

Also modify appropriate uses of ModuleDecl::ImportFilter to take
advantage of the new constructor.
2020-06-22 06:57:29 +02:00
Karoy Lorentey
68351d2110 Revert "Merge remote-tracking branch 'origin/master-next'"
This reverts commit 1c9b0908e6, reversing
changes made to 3eb82c1836.
2020-06-08 16:48:38 -07:00
Erik Eckstein
bdd337cd17 Merge remote-tracking branch 'origin/master' into master-next 2020-05-15 20:13:50 +02:00
Adrian Prantl
633f9e1a3d clang-format IRGenDebugInfo. 2020-05-13 16:58:28 -07:00
Adrian Prantl
248ba6236a Don't emit debug line numbers for Swift type forward declarations
These line numbers are consumed by LLDB and stored in the Declaration object,
but as far as I can tell no user-facing feature relies on this.

Removing the line number can reduce the churn for incremental builds
significantly, since whitespace changes in one file may trigger a recompilation
of any file that uses a type declared below the whitespace change.

<rdar://problem/63156560>
2020-05-13 16:57:44 -07:00
swift_jenkins
c60a485196 Merge remote-tracking branch 'origin/master' into master-next 2020-05-06 12:35:16 -07:00
Arnold Schwaighofer
147144baa6 SIL: Thread type expansion context through to function convention apis
This became necessary after recent function type changes that keep
substituted generic function types abstract even after substitution to
correctly handle automatic opaque result type substitution.

Instead of performing the opaque result type substitution as part of
substituting the generic args the underlying type will now be reified as
part of looking at the parameter/return types which happens as part of
the function convention apis.

rdar://62560867
2020-05-04 13:53:30 -07:00
swift_jenkins
9b6f01b6d9 Merge remote-tracking branch 'origin/master' into master-next 2020-04-30 20:37:34 -07:00
Daniel Sweeney
ea526c6383 Converting ModuleDecl::ImportedModule from std::pair to a dedicated struct. (#31360) 2020-04-30 20:26:03 -07:00
Michael Forster
01096b6a61 Fix the master-next build 2020-04-24 06:43:53 +02:00
swift_jenkins
3355318fb5 Merge remote-tracking branch 'origin/master' into master-next 2020-04-21 13:57:18 -07:00