22 Commits

Author SHA1 Message Date
Ben Barham
ef8825bfe6 Migrate llvm::Optional to std::optional
LLVM has removed llvm::Optional, move over to std::optional. Also
clang-format to fix up all the renamed #includes.
2024-02-21 11:20:06 -08:00
Alex Hoppen
62ffdf29e0 Move OptionSet to its own namespace
The type was colliding with the `OptionSet` type in the Swift stdlib when using Swift from C++.
2023-11-13 14:26:38 -08:00
Evan Wilde
f3ff561c6f [NFC] add llvm namespace to Optional and None
This is phase-1 of switching from llvm::Optional to std::optional in the
next rebranch. llvm::Optional was removed from upstream LLVM, so we need
to migrate off rather soon. On Darwin, std::optional, and llvm::Optional
have the same layout, so we don't need to be as concerned about ABI
beyond the name mangling. `llvm::Optional` is only returned from one
function in
```
getStandardTypeSubst(StringRef TypeName,
                     bool allowConcurrencyManglings);
```
It's the return value, so it should not impact the mangling of the
function, and the layout is the same as `std::optional`, so it should be
mostly okay. This function doesn't appear to have users, and the ABI was
already broken 2 years ago for concurrency and no one seemed to notice
so this should be "okay".

I'm doing the migration incrementally so that folks working on main can
cherry-pick back to the release/5.9 branch. Once 5.9 is done and locked
away, then we can go through and finish the replacement. Since `None`
and `Optional` show up in contexts where they are not `llvm::None` and
`llvm::Optional`, I'm preparing the work now by going through and
removing the namespace unwrapping and making the `llvm` namespace
explicit. This should make it fairly mechanical to go through and
replace llvm::Optional with std::optional, and llvm::None with
std::nullopt. It's also a change that can be brought onto the
release/5.9 with minimal impact. This should be an NFC change.
2023-06-27 09:03:52 -07:00
Varun Gandhi
1f479896f4 Revert "[NFC] Clarify semantics of getImportedModules."
This reverts commit 4b5d885114.
2020-10-23 10:01:35 -07:00
Varun Gandhi
4b5d885114 [NFC] Clarify semantics of getImportedModules.
The lack of clarity manifested as unexpected behavior when using
getImportedModules to create the module import graph. The new behavior
makes SPI-ness and Shadowing-ness behave similarly in terms of
filtering. We also check if a filter is well-formed to avoid
accidental empty import lists.
2020-09-23 12:50:37 -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
Robert Widmann
581d0076f2 [NFC] Mark The OptionSet API constexpr
All of these bit manipulation primitives have been constexpr-able for
a while now.
2020-02-26 16:59:42 -08:00
Brent Royal-Gordon
03832cbc9b [NFC] Allow ImportedModuleDesc to be a DenseMap key 2020-02-18 11:07:12 -08:00
Jordan Rose
0ba6c495ba Add @_implementationOnly
This is an attribute that gets put on an import in library FooKit to
keep it from being a requirement to import FooKit. It's not checked at
all, meaning that in this form it is up to the author of FooKit to
make sure nothing in its API or ABI depends on the implementation-only
dependency. There's also no debugging support here (debugging FooKit
/should/ import the implementation-only dependency if it's present).

The goal is to get to a point where it /can/ be checked, i.e. FooKit
developers are prevented from writing code that would rely on FooKit's
implementation-only dependency being present when compiling clients of
FooKit. But right now it's not.

rdar://problem/48985979
2019-03-28 15:57:53 -07:00
practicalswift
6d1ae2a39c [gardening] 2016 → 2017 2017-01-06 16:41:22 +01:00
practicalswift
797b80765f [gardening] Use the correct base URL (https://swift.org) in references to the Swift website
Remove all references to the old non-TLS enabled base URL (http://swift.org)
2016-11-20 17:36:03 +01:00
Dan Raviv
29d76f3b68 Canonize swift header files headers and footers
- Added missing ifdef guard in PointerIntEnum header
- Consistent naming convention for ifdef guards
- Consistent 'end namespace swift'
- Consistent single EOL at end of header files
2016-03-23 09:04:12 +02:00
practicalswift
1339b5403b Consistent use of header comment format.
Correct format:
//===--- Name of file - Description ----------------------------*- Lang -*-===//
2016-01-04 13:26:31 +01:00
Zach Panzarino
e3a4147ac9 Update copyright date 2015-12-31 23:28:40 +00:00
Jordan Rose
6cf9576a05 Use preferred pattern for operator| on the enum used in a swift::OptionSet.
...and add a static_assert to OptionSet to enforce it. There are two holes
allowed: if it's not an enum class, the default operator| is acceptable, and
if it /is/ an enum class, not defining operator| is also acceptable. We may
want to tighten this up later.

No functionality change.

Swift SVN r30207
2015-07-15 00:48:53 +00:00
Jordan Rose
e618ac37f7 Conditionally give OptionSet a conversion to intptr_t.
...so that OptionSet can be used as the "integer" in a PointerIntPair.

Swift SVN r24528
2015-01-19 23:08:52 +00:00
Jordan Rose
2170a02b16 Fix implementation of OptionSet::contains.
AFAIK no functionality change because no one's been using OptionSet::contains
for anything but single flags.

Swift SVN r24527
2015-01-19 23:08:48 +00:00
Chris Lattner
9db2d73e46 fix the first-line comment.
Swift SVN r12595
2014-01-20 18:22:18 +00:00
Doug Gregor
9f75013056 Eliminate OptionSet's not-technically-correct operator~.
Swift SVN r12594
2014-01-20 18:17:55 +00:00
Doug Gregor
11656c9798 Introduce the ParseDeclOptions option set in the Parser. NFC.
Swift SVN r12588
2014-01-20 17:38:12 +00:00
Doug Gregor
810bb07852 Switch some "unsigned options" over to TypeResolutionOptions.
OptionSet gets construction from "None" and a difference computation. NFC.


Swift SVN r12582
2014-01-20 16:42:20 +00:00
Doug Gregor
da879baa12 Introduce a typed option set template, OptionSet.
Use it to replace the error-prone use of "unsigned" to pass flags
through type resolution.


Swift SVN r12580
2014-01-20 16:20:21 +00:00