Commit Graph

1132 Commits

Author SHA1 Message Date
Adrian Prantl
8ef2178f96 Make data members of DebugTypeInfo private (NFC) 2020-04-20 16:17:48 -07:00
Adrian Prantl
3bc9d43d12 Store the type parameters of bound generics in the debug info.
This is needed to anchor any typedefs that appear in bound generic parameters so
they can be resolved in the typeref-based part of the debugger without needing
to query the Swift module.
2020-04-20 14:45:58 -07:00
swift_jenkins
7d10d9ae85 Merge remote-tracking branch 'origin/master' into master-next 2020-04-10 20:40:58 -07:00
Slava Pestov
f12b0d4977 IRGen: Type reconstruction supports opaque result types now 2020-04-10 15:05:54 -04:00
swift_jenkins
14a14a232b Merge remote-tracking branch 'origin/master' into master-next 2020-04-01 09:00:36 -07:00
Anthony Latsis
d0ae3ee580 [AST] Replace FuncDecl::getName & EnumElementDecl::getName with ValueDecl::getBaseIdentifier 2020-03-29 00:35:51 +03:00
swift_jenkins
3d4661d060 Merge remote-tracking branch 'origin/master' into master-next 2020-03-13 15:44:30 -07:00
Adrian Prantl
56309f6b49 Debug Info: Store the SDK in the DICompileUnit.
This an intermediate step for PR44213
(https://bugs.llvm.org/show_bug.cgi?id=44213).

This stores the SDK *name* in the debug info, to make it possible to
`-fdebug-prefix-map`-replace the sysroot with a recognizable string and allowing
the debugger to find a fitting SDK relative to itself, not the machine the
executable was compiled on.

rdar://problem/51645582
2020-03-13 13:25:39 -07:00
Raphael Isemann
404cc48475 Adapt to API change that moved Sysroot attribute to CompileUnit
Commit 7b30370e5bcf569fcdc15204d4c592163fd78cb3 changed the Sysroot
attribute to the CompileUnit which broke the build.

(cherry picked from commit 728e8a1bde)
2020-03-11 15:58:46 -07:00
Adrian Prantl
1bd6a0a371 Adapt to upstream header file reshuffling in c915cb957dc37275ce1ca1a0b993239c82f12692. 2020-03-11 15:46:37 -07:00
swift_jenkins
4a1fa9b42c Merge remote-tracking branch 'origin/master' into master-next 2020-02-25 10:20:13 -08:00
Joe Groff
19770e6471 IRGen: Keep substituted function types out of debug info for now. 2020-02-24 12:14:21 -08:00
Raphael Isemann
728e8a1bde Adapt to API change that moved Sysroot attribute to CompileUnit
Commit 7b30370e5bcf569fcdc15204d4c592163fd78cb3 changed the Sysroot
attribute to the CompileUnit which broke the build.
2020-02-14 13:52:27 +01:00
Robert Widmann
86ea1912c4 Merge remote-tracking branch 'upstream/master' into HEAD 2020-02-11 23:03:59 -08:00
Fred Riss
4a4a5fabb0 Adapt the llvm.org DIBuilder API change. 2020-01-31 15:34:11 -08:00
Vedant Kumar
d1e6438cbb Revert "IRGenDebugInfo: Pass Sysroot to DIBuilder::createModule (#29524)" (#29572)
This reverts commit 06a829c72e.
2020-01-31 13:08:04 -08:00
Vedant Kumar
06a829c72e IRGenDebugInfo: Pass Sysroot to DIBuilder::createModule (#29524) 2020-01-28 19:32:52 -08:00
swift-ci
70fa9f3288 Merge remote-tracking branch 'origin/master' into master-rebranch 2020-01-28 16:23:20 -08:00
swift_jenkins
11cd86daa3 Merge remote-tracking branch 'origin/master' into master-next 2020-01-28 16:17:55 -08:00
Med Ismail Bennani
bf41881bcd Move swift runtime failure from linkage name to function name
Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
2020-01-28 22:56:05 +01:00
Alex Langford
5b5d2f600f Adjust to upstream changes
Commit 7b30370e5bcf569fcdc15204d4c592163fd78cb3 from llvm-project changed
DIBuilder::createModule. Adjust accordingly.
2020-01-22 14:34:23 -08:00
Erik Eckstein
1b312a85bd Merge remote-tracking branch 'origin/master' into master-rebranch 2020-01-16 10:39:20 +01:00
Arnold Schwaighofer
ddafd383b5 Merge remote-tracking branch 'upstream/master' into master-next 2020-01-15 07:45:24 -08:00
Robert Widmann
eb61931012 [NFC] Grab the private discriminator for a file in IRGenDebugInfo
This was being done at an odd point in the frontend presumably because by that point the private discriminator had been fully computed.  Instead, push the conditions for generating the prefix data down to debug info generation and stop mutating IRGenOptions::DebugFlag in the frontend.
2020-01-13 22:01:41 -08:00
Adrian Prantl
10cd0fc1b7 Adapt to upstream LLVM changes.
(cherry picked from commit 06906ab6b9)
2020-01-10 09:59:56 -08:00
Adrian Prantl
06906ab6b9 Adapt to upstream LLVM changes. 2020-01-10 09:58:57 -08:00
Joe Groff
fb34044408 Merge remote-tracking branch 'origin/master' into master-next 2019-12-10 12:46:41 -08:00
Vedant Kumar
f67b9cbbdd Rename CompilerInstance::ModuleManager to match D70583 (#28625)
See: https://reviews.llvm.org/D70583
2019-12-06 14:33:05 -08:00
Joe Groff
0926d2380b SIL: Sink GenericContextScope into IRGen.
All the context dependencies in SIL type lowering have been eradicated, but IRGen's
type info lowering is still context-dependent and doesn't systemically pass generic
contexts around. Sink GenericContextScope bookkeeping entirely into IRGen for now.
2019-12-02 12:20:05 -08:00
swift-ci
6996cae94c Merge remote-tracking branch 'origin/master' into master-next 2019-11-05 08:49:43 -08:00
swift-ci
d162cc1258 Merge remote-tracking branch 'origin/master' into master-next 2019-11-04 13:50:06 -08:00
Adrian Prantl
8e9b02839b Debug Info: Avoid type uniquing clashes for bound generic structs.
This patch changes the DWARF representation of bound generic struct to a nested
struct where the (sized) outer struct is anonymous and thus distinct and the
inner struct in uniqued and sizeless.

This is anologous the the previous commit that did the same thing for bound
generic enums.

rdar://problem/56521648
2019-11-04 13:36:49 -08:00
adrian-prantl
b6b0046be2 Merge pull request #28020 from adrian-prantl/56521648
Debug Info: Avoid type uniquing clashes for bound generic enums.
2019-11-04 13:36:09 -08:00
Adrian Prantl
e881168d5e Debug Info: Avoid type uniquing clashes for bound generic enums.
This patch changes the DWARF representation of bound generic enums to a nested
struct where the (sized) outer struct is anonymous and thus distinct and the
inner struct in uniqued and sizeless.

BoundGenericEnums may have different sizes depending on what they are bound to,
but still share a mangled name.

rdar://problem/56521648
2019-11-04 08:22:00 -08:00
swift-ci
0b41d02a4d Merge remote-tracking branch 'origin/master' into master-next 2019-10-31 20:49:50 -07:00
Brent Royal-Gordon
99faa033fc [NFC] Standardize dump() methods in frontend
By convention, most structs and classes in the Swift compiler include a `dump()` method which prints debugging information. This method is meant to be called only from the debugger, but this means they’re often unused and may be eliminated from optimized binaries. On the other hand, some parts of the compiler call `dump()` methods directly despite them being intended as a pure debugging aid. clang supports attributes which can be used to avoid these problems, but they’re used very inconsistently across the compiler.

This commit adds `SWIFT_DEBUG_DUMP` and `SWIFT_DEBUG_DUMPER(<name>(<params>))` macros to declare `dump()` methods with the appropriate set of attributes and adopts this macro throughout the frontend. It does not pervasively adopt this macro in SILGen, SILOptimizer, or IRGen; these components use `dump()` methods in a different way where they’re frequently called from debugging code. Nor does it adopt it in runtime components like swiftRuntime and swiftReflection, because I’m a bit worried about size.

Despite the large number of files and lines affected, this change is NFC.
2019-10-31 18:37:42 -07:00
Xi Ge
64c0680686 Merge remote-tracking branch 'apple/master' into master-next 2019-10-28 10:19:36 -07:00
Joe Groff
03c7919b4a SIL: Add fields to SILFunctionType for substituted function types.
https://forums.swift.org/t/improving-the-representation-of-polymorphic-interfaces-in-sil-with-substituted-function-types/29711

This prepares SIL to be able to more accurately preserve the calling convention of
polymorphic generic interfaces by letting the type system represent "substituted function types".
We add a couple of fields to SILFunctionType to support this:

- A substitution map, accessed by `getSubstitutions()`, which maps the generic signature
  of the function to its concrete implementation. This will allow, for instance, a protocol
  witness for a requirement of type `<Self: P> (Self, ...) -> ...` for a concrete conforming
  type `Foo` to express its type as `<Self: P> (Self, ...) -> ... for <Foo>`, preserving the relation
  to the protocol interface without relying on the pile of hacks that is the `witness_method`
  protocol.

- A bool for whether the generic signature of the function is "implied" by the substitutions.
  If true, the generic signature isn't really part of the calling convention of the function.
  This will allow closure types to distinguish a closure being passed to a generic function, like
  `<T, U> in (*T, *U) -> T for <Int, String>`, from the concrete type `(*Int, *String) -> Int`,
  which will make it easier for us to differentiate the representation of those as types, for
  instance by giving them different pointer authentication discriminators to harden arm64e
  code.

This patch is currently NFC, it just introduces the new APIs and takes a first pass at updating
code to use them. Much more work will need to be done once we start exercising these new
fields.

This does bifurcate some existing APIs:

- SILFunctionType now has two accessors to get its generic signature.
  `getSubstGenericSignature` gets the generic signature that is used to apply its
  substitution map, if any. `getInvocationGenericSignature` gets the generic signature
  used to invoke the function at apply sites. These differ if the generic signature is
  implied.
- SILParameterInfo and SILResultInfo values carry the unsubstituted types of the parameters
  and results of the function. They now have two APIs to get that type. `getInterfaceType`
  returns the unsubstituted type of the generic interface, and
  `getArgumentType`/`getReturnValueType` produce the substituted type that is used at
  apply sites.
2019-10-25 13:38:51 -07:00
Arnold Schwaighofer
064d85b75a IRGen: Fix a non null terminated string error
Just use the StringRef as index to a string map. Using data() will fail
if the StringRef does not contain a null terminated string.

The problem is that we get the data of a StringRef (which is not null
terminated) to intialize a StringRef with char* which expects a null
terminated string.

Found by a ASAN bot.

rdar://56340563
2019-10-17 09:09:27 -07:00
swift-ci
71e9fc221b Merge remote-tracking branch 'origin/master' into master-next 2019-10-11 22:09:52 -07:00
Slava Pestov
6974448b1e Sema: Fold TypeAliasDecl::computeType() into validateDecl() 2019-10-10 19:55:02 -04:00
swift-ci
31004db03c Merge remote-tracking branch 'origin/master' into master-next 2019-10-03 18:29:24 -07:00
Slava Pestov
6702d38d87 Sema: Remove most calls to Decl::setValidationToChecked() 2019-10-03 17:11:45 -04:00
Mishal Shah
6b33f225eb Merge branch 'master' into master-next 2019-10-01 13:10:07 -07:00
adrian-prantl
00c64e7959 Merge pull request #27345 from adrian-prantl/16042546
Debug Info: Encode let-bindings using DW_TAG_const_type.
2019-09-27 14:39:56 -07:00
Harlan Haskins
d4247942c4 Merge remote-tracking branch 'upstream/master' into master-next 2019-09-26 20:19:25 -07:00
Harlan Haskins
e349b7b123 Merge branch 'master' into master-rebranch 2019-09-26 20:16:05 -07:00
Jordan Rose
a6dd630ca3 Eliminate Builtin.UnknownObject as an AST type (#27378)
This removes it from the AST and largely replaces it with AnyObject
at the SIL and IRGen layers. Some notes:

- Reflection still uses the notion of "unknown object" to mean an
  object with unknown refcounting. There's no real reason to make
  this different from AnyObject (an existential containing a
  single object with unknown refcounting), but this way nothing
  changes for clients of Reflection, and it's consistent with how
  native objects are represented.

- The value witness table and reflection descriptor for AnyObject
  use the mangling "BO" instead of "yXl".

- The demangler and remangler continue to support "BO" because it's
  still in use as a type encoding, even if it's not an AST-level
  Type anymore.

- Type-based alias analysis for Builtin.UnknownObject was incorrect,
  so it's a good thing we weren't using it.

- Same with enum layout. (This one assumed UnknownObject never
  referred to an Objective-C tagged pointer. That certainly wasn't how
  we were using it!)
2019-09-26 17:48:04 -07:00
Adrian Prantl
ff22da20c3 Debug Info: Encode let-bindings using DW_TAG_const_type.
This allows the debugger to distinguish constant "let" values from
mutable "var" variables.

rdar://problem/16042546
2019-09-25 08:51:05 -07:00
swift-ci
8ce5b01307 Merge remote-tracking branch 'origin/master' into master-next 2019-09-18 15:09:47 -07:00