Commit Graph

1189 Commits

Author SHA1 Message Date
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
swift-ci
e010cb4cd4 Merge remote-tracking branch 'origin/master' into master-rebranch 2019-09-24 20:43:47 -07:00
Xi Ge
3103b5cec1 Frontend: set up output file .swiftsourceinfo
This patch will focus on teaching driver and frontend to emit this file.
The actual content and de-serialization parts will come later.

More details: https://forums.swift.org/t/proposal-emitting-source-information-file-during-compilation/28794
2019-09-24 13:52:17 -07:00
swift-ci
a9e39bdb21 Merge remote-tracking branch 'origin/master' into master-rebranch 2019-09-13 21:03:33 -07:00
swift-ci
0c440ff5ef Merge remote-tracking branch 'origin/master' into master-next 2019-09-13 20:49:32 -07:00
Harlan Haskins
8aa5caed71 Merge pull request #27175 from harlanhaskins/mods-are-asleep-post-cleanups
NFC: Excise ParseableInterface from code
2019-09-13 20:47:53 -07:00
Harlan Haskins
c82c9b8210 [ModuleInterfaces] Remove references to 'parseable' interfaces everywhere
Now that we've settled on Module Interface as the name, let's remove the
vestiges of "Parseable Interfaces"
2019-09-13 14:55:48 -07:00
swift-ci
1b531a3491 Merge remote-tracking branch 'origin/master' into master-next 2019-09-13 11:50:18 -07:00
swift-ci
f079ce868a Merge remote-tracking branch 'origin/master' into master-rebranch 2019-09-13 11:44:16 -07:00
Sasha Krassovsky
c5bfa450ee Fix warnings in Basic 2019-09-13 09:57:48 -07:00
Jordan Rose
eefb0d0644 Merge remote-tracking branch 'origin/master' into master-next 2019-09-04 14:01:43 -07:00
swift-ci
a6f4a4650b Merge remote-tracking branch 'origin/master' into master-rebranch 2019-09-04 12:43:45 -07:00
Joe Groff
0ae86c9c9d IRGen: Backward-deploy fix using open-coded accessors.
If we mangled an opaque associated type while targeting an older OS, we can use a \9
accessor reference string to instantiate the associated type.
2019-09-04 10:22:17 -07:00
Erik Eckstein
56ecda51fa Merge remote-tracking branch 'origin/master' into master-next 2019-09-03 20:42:28 +02:00
swift-ci
0e4feadfbc Merge remote-tracking branch 'origin/master' into master-rebranch 2019-09-03 10:23:48 -07:00
Doug Gregor
d7f6768a9d Eliminate DelayedParsingCallbacks.
DelayedParsingCallbacks only had one implementation, for code
completion, which is only used to determine which bodies to skip and
which to delay. Inline that logic into the parser's delay logic and
remove DelayedParsingCallbacks entirely.
2019-09-02 19:03:07 -07:00
Saleem Abdulrasool
8b4573e25b Basic: convert descriptors to FILE *
Ensure that convert the file descriptor to `FILE *` when passing the parameter
to `fs::mapped_file_region`'s constructor which takes a `FILE *`.  Repairs the
build for Windows.
2019-08-26 14:00:31 -07:00
Arnold Schwaighofer
2b41f8d8d5 Merge remote-tracking branch 'origin/master' into master-next 2019-08-26 08:57:42 -07:00
swift-ci
fbe8e56e8b Merge remote-tracking branch 'origin/master' into master-rebranch 2019-08-24 10:03:05 -07:00
Brent Royal-Gordon
cac979ac09 Merge pull request #25977 from roop/sr11037_fixit_platform_condition_kind
[Parser][QoI] Offer fixit for changing the platform condition kind
2019-08-24 09:46:55 -07:00
swift-ci
86e95c23aa Merge remote-tracking branch 'origin/master' into master-rebranch 2019-08-23 17:43:50 -07:00