Commit Graph

24 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
Evan Wilde
4f27bb28ba Add missing headers
Found a few more missing headers. Adding them in now.
2023-08-03 10:06:44 -07:00
Evan Wilde
250082df25 [NFC] Reformat all the LLVMs
Reformatting everything now that we have `llvm` namespaces. I've
separated this from the main commit to help manage merge-conflicts and
for making it a bit easier to read the mega-patch.
2023-06-27 09:03:52 -07: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
Ben Barham
3ec878d918 Update llvm::Optional API uses
Use the std-equivalent names as the LLVM ones are now deprecated
(eventually `llvm::Optional` will disappear):
  - `getValue` -> `value`
  - `getValueOr` -> `value_or`
  - `hasValue` -> `has_value`

Follow up from ab1b343dad and
7d8bf37e5e with some missing cases.
2023-01-25 16:28:10 -08:00
Erik Eckstein
ab1b343dad use new llvm::Optional API
`getValue` -> `value`
`getValueOr` -> `value_or`
`hasValue` -> `has_value`
`map` -> `transform`

The old API will be deprecated in the rebranch.
To avoid merge conflicts, use the new API already in the main branch.

rdar://102362022
2022-11-21 19:44:24 +01:00
Michael Gottesman
c5f6038a0a [blotmapvector] Add support for try_emplace.
I am going to use this in a forthcoming commit.
2020-03-25 14:24:56 -07:00
Adrian Prantl
ff63eaea6f Remove \brief commands from doxygen comments.
We've been running doxygen with the autobrief option for a couple of
years now. This makes the \brief markers into our comments
redundant. Since they are a visual distraction and we don't want to
encourage more \brief markers in new code either, this patch removes
them all.

Patch produced by

      for i in $(git grep -l '\\brief'); do perl -pi -e 's/\\brief //g' $i & done
2018-12-04 15:45:04 -08:00
Michael Gottesman
c59a1e5410 [gardening] Standardize indentation in BlotMapVector.h
Part of the file was following LLVM style for class indentation and other parts
were not. This commit makes it consistent.
2018-04-02 11:29:49 -07:00
Michael Gottesman
2007badf6b [blot-map-vector] Merge blot/erase => erase.
They do the same thing.
2018-04-02 11:29:49 -07:00
Andrew Trick
9923d5d9cf Fix usability issues with BlotVector.
- Add const getItems().

- Fix const find().

- erase() returns a boolean.

- Set erase() should not perform two lookups.

The implementation is covered by the unit tests with a small addition.

Other trivial API changes are trivially tested in upcoming commits.
2018-03-31 17:39:54 -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
Dmitri Gribenko
70e4354868 Merge pull request #1787 from danra/patch-13
Improve template typenames consistency
2016-03-25 00:51:06 -07:00
danra
f1e68696c9 Add missing comment after .h file #endif 2016-03-22 22:37:30 +02:00
danra
8aa1260622 Improve template typenames consistency
Rename BlotMapVector's template typenames: MapTy -> MapT and VectorTy -> VectorT. This is consistent both with BlotMapVector's other template typename KeyT and ValueT, and with SmallBlotMapVector's MapT and VectorT template typenames.
2016-03-22 22:26:34 +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
practicalswift
f91525a10f Consistent placement of "-*- [language] -*-===//" in header. 2016-01-04 09:46:20 +01:00
Zach Panzarino
e3a4147ac9 Update copyright date 2015-12-31 23:28:40 +00:00
Michael Gottesman
5f805b6db7 Add unittests for BlotMapVector and change it to use Optional<> in its internal representation to remove a leak. 2015-11-02 09:39:50 -08:00
Michael Gottesman
5e06d13685 Use a small blot map vector instead of a blot map vector to avoid using a dense map.
This drops the amount of memory allocated by ARC when compiling Swift.swiftmodule to
35% of its original value.

Swift SVN r32949
2015-10-28 21:53:01 +00:00
Dmitri Hrybenko
37a4335b88 Replace swift::Range with llvm::iterator_range
Due to inreased use of llvm::make_range in LLVM headers and ADL for
types defined in the swift namespace, some of the LLVM headers started
to trigger ambiguity errors between llvm::make_range and
swift::make_range.

Swift SVN r29700
2015-06-25 22:01:39 +00:00
Michael Gottesman
11ad8ff531 [enum-simplification] Make enum simplification global and teach it how to infer enum case from switch_enum.
With this change we now simplify 2192 retain, release operations on
enums an increase of ~56% over the previous stat, 1403 retain, release
operations.

The next step is to implement switch_enum simplification and pushing
releases on enums into switch regions (the real purpose of this pass).

rdar://17139960

Swift SVN r18740
2014-06-09 00:07:00 +00:00
Michael Gottesman
125c206d3b Move BlotMapVector -> include/swift/Basic/BlotMapVector so it can be used in SILAnalysis and SILPasses. NFC.
Swift SVN r18736
2014-06-07 22:20:26 +00:00