Commit Graph

1759 Commits

Author SHA1 Message Date
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
swift-ci
578a684184 Merge remote-tracking branch 'origin/master' into master-next 2019-11-09 16:49:49 -08:00
pi1024e
47aa97708e Simplifying the flow (#28010)
* Simplified flow of Platform.cpp to reduce number of branches

* Update Platform.cpp

* Update Platform.cpp
2019-11-09 16:41:58 -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
Adrian Prantl
468b74bd70 Update Swift master-next for upstream llvm.org changes. 2019-10-21 13:31:31 -07:00
Xi Ge
7d600eb27a ABI/API checker: teach the tool to emit diagnostics to serialized source location for decls 2019-10-17 16:31:56 -07:00
Jordan Rose
9ecd9abc84 Merge pull request #27750 from jrose-apple/omit-more-needle-swords
Further simplifications to omitNeedlessWords
2019-10-17 10:33:43 -07:00
Jordan Rose
e24c9e755d omitNeedlessWords: Fix self-type-stripping regression (#27742)
Turns out self-type-stripping /always/ operates on a type without
prefixes rather than /never/. Neither of these behaviors are really
what we'd want, but we'll live with it!

rdar://problem/56334797
2019-10-17 09:46:56 -07:00
Jordan Rose
f93811ae24 omitNeedlessWords: use drop_back to simplify suffix stripping 2019-10-16 19:55:48 -07:00
Jordan Rose
2465f5c2c3 omitNeedlessWords: Remove dead code from base name splitting
"and" is not a preposition, so we'll never get a false preposition
match for "and return".
2019-10-16 19:55:48 -07:00
Jordan Rose
6db1e020c2 omitNeedlessWords: Avoid an extra temporary SmallString
Yeah, SmallVectorImpl<char> is less convenient to work with, but
that's no reason to write out a stack buffer and then do a copy.

No functionality change.
2019-10-16 19:55:47 -07:00
Jordan Rose
1ef99c533c omitNeedlessWords: don't bother lowercasing an intermediate name
All of the remaining name-matching logic is case-insensitive, and
the resulting name will have a stronger form of lowercasing applied
anyway, so we can leave the name with a leading uppercase letter in
its intermediate state. Slightly less pure, but also slightly less
code and slightly less memory use.
2019-10-16 19:55:47 -07:00
Jordan Rose
a5d521698c omitNeedlessWords: separate BaseName in trailing type name matching
Method base names are where the most complicated logic is, so let's
split it out from the other cases a bit. Also makes early returns more
explicit.

No intended functionality change.
2019-10-16 19:55:47 -07:00
Jordan Rose
0f071e28ea Simplify getPrepositionKind to isPreposition
No one was distinguishing directional and non-directional prepositions
anymore. No functionality change.
2019-10-16 19:55:46 -07:00
Xi Ge
76f269586b SourceManager: avoid using additional buffer Id map for external source buffers
SourceManager may outlive ASTContext where external source file paths are managed.
Therefore, we should use the identifier from the memory buffer as the key instead of
using a pointer from an ASTContext.
2019-10-15 16:48:20 -07:00
Xi Ge
c6035f68f0 AST: cache serialized source locations in Decl 2019-10-15 16:05:28 -07:00
Xi Ge
1e22e7c8aa AST: teach Decl::getLoc() to return serialized source loc.
When Decl::getLoc() is called upon a serialized AST and the
serialized source location is available, we lazily open the
external buffer and return a valid SourceLoc instance pointing
into the buffer.
2019-10-15 16:05:28 -07:00
swift-ci
4950d131b2 Merge remote-tracking branch 'origin/master' into master-next 2019-10-10 17:29:58 -07:00
Jordan Rose
171ff440fc Remove swift::reversed in favor of llvm::reverse (#27610)
The former predates the latter, but we don't need it anymore! The
latter has more features anyway.

No functionality change.
2019-10-10 17:16:09 -07:00
Jordan Rose
86de8b8257 omitNeedlessWords: Rename helper: omitTrailingTypeNameWithSpecialCases
Previously this was /also/ called 'omitNeedlessWords'. Rename it to
avoid confusion and better describe the particular step it's taking.

I don't love the "with special cases" but I think it's important to
note that this isn't an exact parallel of matchLeadingTypeName.
2019-10-10 10:48:14 -07:00
Jordan Rose
758e727e07 omitNeedlessWords: Use existing helpers getPriorStr and getRestOfStr
...rather than asking WordIterators for their position and then
immediately calling StringRef::substr.

No functionality change.
2019-10-10 10:48:13 -07:00
Jordan Rose
e1e885ed7d omitNeedlessWords: delete accidentally dead code
StringRef::drop_back returns a new string instead of mutating the
existing one, so this check would never actually make a
difference. Drat.
2019-10-10 10:48:13 -07:00
Jordan Rose
42f7a35c4d omitNeedlessWords: sink helper enum into .cpp file
No functionality change.
2019-10-10 10:48:12 -07:00
Jordan Rose
3fdbd1b154 omitNeedlessWords: split out BaseNameSelf omission
This is the only omission kind that needs to look in the middle of a
name rather than just at the start or the end. So, handle that
explicitly instead to simplify all the other code.
2019-10-10 10:48:12 -07:00
Jordan Rose
981d1a9fab omitNeedlessWords: Factor out matchTypeNameFromBackWithSpecialCases
Separate the functional searching bit from the actual "omitting" bit
once the type name is matched. This in turn provides a good place to
flip from reverse iterators back to forward iterators, making the
following code about omitting a fair bit clearer.

No functionality change. This is 90% moving things around and 10%
rephrasing.
2019-10-10 10:48:11 -07:00
Jordan Rose
e22d55d27b omitNeedlessWords: Early exit instead of using a big if
Also, use Optional instead of a value and a separate flag.

No functionality change.
2019-10-10 10:48:11 -07:00
swift-ci
b91537d1b4 Merge remote-tracking branch 'origin/master' into master-next 2019-10-02 16:09:39 -07:00
Joe Groff
8add25a6bc Misc spot fixes
- Ensure QuotedString prints characters as `char` and not as an integer-like `unsigned char`
- Assert when trying to add a null child node to a Demangle::Node
2019-10-01 12:36:55 -07:00
swift-ci
76e7b1d2eb Merge remote-tracking branch 'origin/master' into master-next 2019-09-24 20:50:21 -07:00