Commit Graph

1189 Commits

Author SHA1 Message Date
Slava Pestov
3e4b95f234 ASTMangler: Fix substitution round-tripping in the DWARF mangler
When mangling sugared types for DWARF debug info, we would
occassionally mix generic parameter types from different
generic environments. Since the mangling for a generic
parameter type only recorded the depth and the index, even
for distinct sugared forms, the remangler would produce a
more 'compact' mangling, by folding together generic parameters
that have the same depth/index, but distinct sugarings in the
AST.

Prevent this from happening by desugaring DWARF types the
correct amount, substituting away generic parameters while
preserving everything else.

Also, re-enable the round-trip verification with the remangler.

Fixes <rdar://problem/59496022>, <https://bugs.swift.org/browse/SR-12204>.
2020-04-06 18:19:57 -04:00
Tony Allevato
5284cb6f99 Add dependencies where targets depend on inclusions from unspecified targets.
A follow-up PR adds a flag to control an inline namespace that allows
symbols in libDemangling to be distinguished between the runtime and
the compiler. These dependencies ensure that the flag is plumbed
through for inclusions of Demangling headers that aren't already
covered by existing `target_link_libraries`.
2020-03-31 09:19:41 -07:00
Arnold Schwaighofer
a6c6ddccf1 arm64e does not back-deploy
rdar://60438869
2020-03-25 09:02:14 -07:00
Ben Langmuir
9e2d7ca053 [outputfilemap] Fix another StringRef -> std::string conversion
This fix affects master-next, but it's safe to put on master.
2020-03-17 11:11:23 -07:00
Fred Riss
259d78a350 Adapt to llvm.org StringRef API change 2020-03-13 19:08:22 +01:00
Kuba Mracek
acfc4a98b1 Fixup for 3904fe83f (AST: Centralize ABI-related deployment target checks) 2020-03-04 16:30:07 -08:00
Kuba (Brecka) Mracek
0d400ca310 Merge branch 'master' into mracek/arm64e 2020-03-04 09:36:25 -08:00
Slava Pestov
3904fe83fb AST: Centralize ABI-related deployment target checks
There were a couple of methods in LangOptions and some related ones in
Availability and ASTContext that were added more recently.

Refactor the three older checks to the newer scheme.
2020-03-03 22:49:19 -05:00
Visoiu Mistrih Francis
aaab1869af Merge pull request #29650 from francisvm/sil-remark-streamer
[Remarks] Add a specialized RemarkStreamer for SIL remarks
2020-03-03 09:30:17 -08:00
Kuba (Brecka) Mracek
5d918e5ee1 Merge branch 'master' into mracek/arm64e 2020-03-03 08:28:01 -08:00
Francis Visoiu Mistrih
e724ebab6b [Remarks] Add a specialized RemarkStreamer for SIL remarks
This allows the usage of the whole remark infrastructure developed in
LLVM, which includes a new binary format, metadata in object files, etc.

This gets rid of the YAMLTraits-based remark serialization and does the
plumbing for hooking to LLVM's main remark streamer.

For more about the idea behind LLVM's main remark streamer, see the
docs/Remarks.rst changes in https://reviews.llvm.org/D73676.

The flags are now:

* -save-optimization-record: enable remarks, defaults to YAML
* -save-optimization-record=<format>: enable remarks, use <format> for
serialization
* -save-optimization-record-passes <regex>: only serialize passes that
match <regex>.

The YAMLTraits in swift had a different `flow` setting for the debug
location, resulting in some test changes.
2020-03-02 18:33:20 -08:00
Robert Widmann
bd30df994b Merge pull request #30083 from 3405691582/OpenBSD_Port_BasicDriver
Swift Basic/Driver recognizes OpenBSD.
2020-02-28 17:00:37 -08:00
Kuba Mracek
84c4864911 [arm64e] Add Swift compiler support for arm64e pointer authentication 2020-02-27 16:10:31 -08:00
3405691582
0d3b92dfb1 Swift Basic/Driver recognizes OpenBSD.
Add the platform conditional and set up other basics for the toolchain.

The ConditionalCompilation tests are updated to match, since otherwise
they seem to trip when building on non-OpenBSD platforms. The
Driver/linker test is updated to ensure lld is passed on this platform.
Note that OpenBSD calls "x86_64" as "amd64", so we use that name for the
architecture instead of trying to alias one to the other, as this makes
things simpler.
2020-02-27 17:14:22 -05:00
Erik Eckstein
4845d81c64 Temporarily disable mangler verification.
I still need to investigate the failures.
To unblock CI I'm disabling the verification for now.

Failing to correctly remangle a symbol should work, but failing so will not cause any severe damage (miscompile, etc.) in most cases.

rdar://problem/59813007
rdar://problem/59496022
https://bugs.swift.org/browse/SR-12204
2020-02-27 10:26:54 +01:00
Alexis Laferrière
901392896d [Frontend] Output the private module interface with the SPI info 2020-02-19 14:17:14 -08:00
Brent Royal-Gordon
6cce3d374e Add swiftcrossimport and swiftoverlays file_types 2020-02-18 11:06:12 -08:00
swift-ci
f876517857 Merge remote-tracking branch 'origin/master' into master-rebranch 2020-02-01 14:23:00 -08:00
Saleem Abdulrasool
ab5c682683 Revert "Revert "build: simplify version tracking logic""
This reverts commit be37141b0f.  Add a
small fix in the dereferencing.
2020-01-31 16:20:11 -08:00
swift-ci
34faf49a83 Merge remote-tracking branch 'origin/master' into master-rebranch 2020-01-30 12:43:13 -08:00
Mishal Shah
be37141b0f Revert "build: simplify version tracking logic" 2020-01-29 23:56:09 -08:00
swift-ci
efbfd13426 Merge remote-tracking branch 'origin/master' into master-rebranch 2020-01-29 12:04:19 -08:00
Meghana Gupta
b8960133ff Add source annotation to SILPrinter under flag -sil-print-sourceinfo (#29444)
* Add source annotation to SILPrinter under flag -sil-print-sourceinfo

rdar://58365252
2020-01-29 11:45:58 -08:00
Mike Ash
cd2b54f74e Merge branch 'master' into master-rebranch 2020-01-24 11:30:32 -05:00
Hamish Knight
fe906574cd [Basic] Avoid reentrant stat collection
Currently `UnifiedStatsReporter::flushTracesAndProfiles`
can kick off requests when computing the source
ranges for collected entities, which will try to
record additional stats about the requests.

This currently happens to work without issue,
but #29289 bumped the counters down slightly such
that the vector storing the stats now performs a
re-allocation when we do a reentrant stat entry.
This then caused a use-after-free as we try to
continue iterating over the old buffer.

Fix this issue by refusing to record any new stats
while we're flushing out the ones we've already
recorded.
2020-01-23 16:43:18 -08:00
Erik Eckstein
bbfaccda4b Merge remote-tracking branch 'origin/master' into master-rebranch 2020-01-22 08:25:23 +01:00
Devin Coughlin
8c5c5ec802 [Parse] Support macCatalyst conditional compilation
Add support for conditional compilation under macCatalyst

Developers can now detect whether they are compiling for macCatalyst at
compile time with:

  #if targetEnvironment(macCatalyst)
    // Code only compiled under macCatalyst.
  #end
2020-01-21 18:28:17 -08:00
Devin Coughlin
655d89b146 [Driver/Frontend] Add Driver support for macCatalyst and library search paths
Add support in the driver and frontend for macCatalyst target
targets and library search paths.

The compiler now adds two library search paths for overlays when compiling
for macCatalyst: one for macCatalyst libraries and one for zippered macOS
libraries. The macCatalyst path must take priority over the normal macOS path
so that in the case of 'unzippered twins' the macCatalyst library is
found instead of the macOS library.

To support 'zippered' builds, also add support for a new -target-variant
flag. For zippered libraries, the driver invocation takes both a -target and a
-target-variant flag passes them along to the frontend. We support builds both
when the target is a macOS triple and the target variant is macCatalyst and
also the 'reverse zippered' configuration where the target is macCatalyst and the
target-variant is macOS.
2020-01-21 18:28:17 -08:00
swift_jenkins
cba5df3a90 Merge remote-tracking branch 'origin/master' into master-next 2020-01-08 08:57:29 -08:00
Saleem Abdulrasool
9c4d0c0f53 Merge pull request #29040 from compnerd/version-control
build: simplify version tracking logic
2020-01-08 08:42:03 -08:00
Arnold Schwaighofer
43c24be5cd Merge remote-tracking branch 'upstream/master' into master-next 2020-01-08 06:41:34 -08:00
David Zarzycki
0dca08f1a6 [Basic] Disable body of broken Located<T>::dump() method
Newer clangs are more reliable about emitting templated methods that are
marked "used".
2020-01-07 14:23:49 -05:00
Saleem Abdulrasool
b5c02ee9e8 build: simplify version tracking logic 2020-01-07 08:58:15 -08:00
Varun Gandhi
022314a640 Merge pull request #28643 from kitaisreal/using-located-instead-of-pair
[Compiler]: Using Located<T> instead of std::pair<SourceLoc, T>
2020-01-06 14:22:29 -08:00
swift_jenkins
81c0ed297a Merge remote-tracking branch 'origin/master' into master-next 2020-01-02 10:19:08 -08:00
Saleem Abdulrasool
ff5ab0b7ce Basic: adjust aliasing annotation (NFCI)
GCC `-fpermissive` flagged this annotation as being discarded as it is
being applied after the definition.  Move the annotation to the
re-definition to which it appertains.
2019-12-23 12:07:58 -08:00
Kita, Maksim
c70bd2b2c9 SR-11889: Located added dump methods 2019-12-20 17:19:00 +03:00
swift_jenkins
f898b2bd5e Merge remote-tracking branch 'origin/master' into master-next 2019-12-19 11:19:56 -08:00
Doug Gregor
3a9b8bc658 [Driver] Add unversioned triple to the output of -print-target-info.
SwiftPM wants to use the unversioned triple to know where to put
results. Vend this as part of -print-target-info.
2019-12-19 09:10:58 -08:00
Joe Groff
fb34044408 Merge remote-tracking branch 'origin/master' into master-next 2019-12-10 12:46:41 -08:00
Saleem Abdulrasool
a526cb086d Merge pull request #28584 from compnerd/wasi-wasm-target
wasm: add support for `wasm32-unknown-wasi`
2019-12-05 10:22:39 -08:00
David Ungar
86a76cb2ea Merge pull request #28566 from davidungar/renaming-dependencies-2
Rename older dependency graph to "CoarseGrainedDependencyGraph"
2019-12-05 09:35:33 -08:00
Saleem Abdulrasool
15869aceaa wasm: add support for wasm32-unknown-wasi
This adds the initial conditional compilation support for the WASM32
"architecture" assuming that WASI is used as the "OS".  Support for
baremetal targets in Swift needs more work still, but this gives enough
infrastructure to start playing with WASM.
2019-12-04 22:31:53 -08:00
Saleem Abdulrasool
23b1a6b87a Driver: add support for WASI/WASM toolchain
Treat WASM/WASI as a generic Unix toolchain.  This adds the necessary
support to build a toolchain for WASM/WASI.
2019-12-04 20:14:08 -08:00
David Ungar
200b181eb3 Renaming files -> CoarseGrained 2019-12-04 10:51:18 -08:00
Saleem Abdulrasool
98dcc5ed25 Merge pull request #28457 from compnerd/basic-cleanup
cleanup LangOptions
2019-12-03 08:27:11 -08:00
Saleem Abdulrasool
13eb4813ea Basic: simplify runtime type selection (NFC)
Rather than an if repeating the condition, simplify using a ternary for
the value.  NFC.
2019-11-24 10:12:07 -08:00
Saleem Abdulrasool
108630d209 Basic: simplify endianness classification (NFC)
Collapse the cases into a single set rather than adding a case for each
entry.  This is easier to read/follow.  NFC.
2019-11-24 10:12:07 -08:00
Saleem Abdulrasool
b6db7844e9 Basic: convert cascading ifs to switch (NFC)
Switch over `Triple::getOS` instead of a series of cascading `if`s.
This simplifies the handling of adding new entries.  It also makes the
precedence ordering more explicit.
2019-11-24 10:12:07 -08:00
David Ungar
742c3985bd Source-range-based dependencies
Frontend outputs source-as-compiled, and source-ranges file with function body ranges and ranges that were unparsed in secondaries.
Driver computes diffs for each source file. If diffs are in function bodies, only recompiles that one file. Else if diffs are in what another file did not parse, then the other file need not be rebuilt.
2019-11-12 20:41:02 -08:00