Commit Graph

40 Commits

Author SHA1 Message Date
Tim Kientzle
1d961ba22d Add #include "swift/Basic/Assertions.h" to a lot of source files
Although I don't plan to bring over new assertions wholesale
into the current qualification branch, it's entirely possible
that various minor changes in main will use the new assertions;
having this basic support in the release branch will simplify that.
(This is why I'm adding the includes as a separate pass from
rewriting the individual assertions)
2024-06-05 19:37:30 -07:00
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
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
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
Saleem Abdulrasool
910fbee14e gardening: make c++98-compat-extra-semi an error
This cleans up 90 instances of this warning and reduces the build spew
when building on Linux.  This helps identify actual issues when
building which can get lost in the stream of warning messages.  It also
helps restore the ability to build the compiler with gcc.
2021-11-27 11:40:17 -08:00
shreyaa-sharmaa
2b11d7acc7 Task SR-14138 Replace std::transform with llvm::transform 2021-02-04 12:58:33 +05:30
Robert Widmann
6125d25cb4 [NFC] Silence Non-Exhaustive Switch Warnings on Windows 2020-10-14 13:26:09 -07:00
Xi Ge
950eb74e67 ABI Checker: use lower-cased decl keywords to be consistent with source. NFC 2020-09-12 10:35:03 -07:00
Fred Riss
259d78a350 Adapt to llvm.org StringRef API change 2020-03-13 19:08:22 +01:00
Saleem Abdulrasool
d281b98220 litter the tree with llvm_unreachable
This silences the instances of the warning from Visual Studio about not all
codepaths returning a value.  This makes the output more readable and less
likely to lose useful warnings.  NFC.
2018-09-13 15:26:14 -07:00
Xi Ge
e4388af6be swift-module-digester: refactor the ABI/API diagnostics to use DiagnosticEngine. NFC (#18957)
Before this patch, we used to define tooling-specific diagnostics. With adding more
checking logics, we found this mechanism hard to extend. This patch
eliminates the home-made diagnostics model to use the one from compiler, which provides
several benefits: less boiler-templates, better integration with DiagnosticConsumer,
and easy ordering of detected issues.
2018-08-24 13:11:32 -07:00
Brent Royal-Gordon
88ac6f11a2 Add error for invalid SDKNodeKind 2018-08-17 00:27:38 -07:00
Xi Ge
7312fea3b2 migrator: emit error messages when migration scripts are missing.
We used to assert migration scripts exist. This patch further
decouples these scripts and the compiler by treating missing scripts
as a regular compiler error.

Related: rdar://40538097
2018-05-25 11:25:32 -07:00
Xi Ge
343d84ba35 migrator: handle argument renames when a global function is hoisted to a static member function. rdar://40145590 2018-05-14 11:33:25 -07:00
Xi Ge
33e0570fda migrator: ignore return value rewritten for constructors. rdar://40041102 2018-05-08 11:26:25 -07:00
Xi Ge
82a2c2c644 migrator: ignore migration scripts with underscored new names. rdar://39877447
Updating something to underscored names is hardly correct. This patch
disallows picking up such migration scripts.
2018-05-01 16:06:06 -07:00
Xi Ge
53c9f1aaa9 swift-api-digester: add a new action to dump name correction template.
Rename detection in the tool may not reflect overlay additions; thus we
mistakes a new name to be an underscored one. This new action searches
migration scripts for suspicious ones and generates a template for us to
specify the correct names.
2018-04-19 18:01:01 -07:00
Xi Ge
e405bab9bf swift-api-digester: separate migration kind from the other node annotation kind. NFC 2018-04-09 16:18:24 -07:00
Xi Ge
72f49e2351 swift-api-digester: separate internal and external names for node kinds. NFC 2018-04-05 15:38:17 -07:00
Jordan Rose
c26f40b45b Fix some more misuses of LLVM's YAML parser. (#15119)
https://reviews.llvm.org/D44317 should prevent this from happening
again.
2018-03-10 17:47:14 -08:00
Xi Ge
55843a29be migrator: compare sub-kind when checking if two diff items are equivalent to avoid dropping information. rdar://32431567 2017-06-01 18:03:23 -07:00
Xi Ge
0b8b0207e6 migrator: teach the tool to handle qualified replacement. rdar://32466196 2017-06-01 13:15:12 -07:00
Xi Ge
824aaa11e2 swift-api-digester: detect the move of static members only.
This patch restricts the detection of moved members to be static members,
since only in this case we need to update qualified access to
them. The move of instance members will be either handled by rename or
we don't need to update anything at all.

Additionally, this patch introduces a sub-kind of type member diff item
called qualified replacement to describe the aforementioned case. However,
the migrator part has not started to honor this sub-kind yet.

rdar://32466196
2017-05-31 11:47:27 -07:00
Xi Ge
d1b0e67620 swift-api-digester: teach the tool do detect APINotes' moving one member variable/method to another type. (#9985)
Different from type hoist that moves global variables to static member
variables, we've also seen member variables being moved among different
types via apinotes. Swift-api-digester should be able to detect such
case so that migrator can handle them properly.

rdar://32466196
2017-05-30 14:23:32 -07:00
practicalswift
6fc2efbe49 Merge pull request #9572 from practicalswift/gardening-20170513
[gardening] Remove assert requirement from fixed crashers. Fix spacing. Remove unused variables.
2017-05-15 14:00:21 +02:00
Xi Ge
ff2622734e migrator: handle the special migration cases of NSOpenGLSetOption/NSOpenGLGetOption. rdar://32178753 (#9591) 2017-05-14 13:00:03 -07:00
Xi Ge
24de53fcdf migrator: Add an API diff kind for specially handled cases. (#9585)
This item is to associate a usr with a special case Id, however, it's
up to the migrator to interpret the special case Id and apply proper
transformations.
2017-05-14 10:43:06 -07:00
practicalswift
b1e5d85073 [gardening] Fix spacing 2017-05-13 10:58:00 +02:00
Xi Ge
65b9043eb1 migrator: handle function hoist API changes and several its varieties. rdar://31234806 (#9544) 2017-05-12 21:34:06 -07:00
practicalswift
d4b36a8949 [gardening] Fix spacing 2017-05-04 15:23:47 +02:00
Xi Ge
c6f8d4781d migrator: correct a misplaced assertion. rdar://31980368 2017-05-03 20:49:39 -07:00
Xi Ge
beb5347f95 [Migrator] During de-serialization, remove duplicated API diff items from the store. (#9239) 2017-05-03 16:48:44 -07:00
Xi Ge
7163a40ffb [Migrator] Support framework API function renames. rdar://31766131 (#9013) 2017-04-25 15:50:40 -07:00
Xi Ge
2a2731a797 migrator: add a flag to print incoming usrs to the API diff data store to facilitate testing. NFC (#8969) 2017-04-24 13:53:55 -07:00
Xi Ge
e57232dbe9 [migrator] Add a viewer utility for child indices to facilitate access. NFC (#8925) 2017-04-21 15:15:58 -07:00
practicalswift
431e5a1440 [gardening] Use consistent end of namespace comments 2017-04-20 13:47:10 +02:00
practicalswift
50ae5d1541 [gardening] Use consistent end-of-namespace comments 2017-04-18 19:21:26 +02:00
Xi Ge
ba33fd6236 swift-api-digester: Add a data structure APIDiffItemStore. (#8794)
This structure serves multiple purposes:
	a. Allow migrator to speak in the same language with swift-api-digester in terms of API changes.
	b. Serialize/Deserialize detected API change items in JSON format.
	c. Manage memory after deserializing API change items.
	d. Facilitate look up by USRs of APIs under migration.
The structure is tested by round-trip serialization and deserialization.
2017-04-17 13:04:02 -07:00
Xi Ge
dbb71698e9 swift-api-digester: Extract/Expose API change descriptors to libIDE to allow visibility from libMigrator. NFC (#8766) 2017-04-13 18:31:41 -07:00