[SERVER-68246] change calls to `boost::optional` members `is_initialized` and `get` (via clang-tidy) Created: 23/Jul/22 Updated: 06/Dec/23 Resolved: 28/Jul/22 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | 6.1.0-rc0 |
| Type: | Improvement | Priority: | Major - P3 |
| Reporter: | Billy Donahue | Assignee: | Billy Donahue |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||||||||||||||||||
| Backwards Compatibility: | Fully Compatible | ||||||||||||||||||||||||
| Sprint: | Service Arch 2022-08-08 | ||||||||||||||||||||||||
| Participants: | |||||||||||||||||||||||||
| Description |
|
Update all occurrences of boost::optional's is_initialized or get members. (comes out of Skunkworks July 2022) We should prefer using the API that's common between boost::optional and std::optional where we can, and we can in these cases.
Future recurrences will be hard to lint on, but easy to clang-tidy on when we can load plugins into clang-tidy. This conversion is done by a clang-tidy plugin in the first place. In the meantime, the clang-tidy plugin can be compiled in. The plugin: https://github.com/BillyDonahue/mongo_std_optional_migration |
| Comments |
| Comment by Billy Donahue [ 03/Aug/22 ] |
|
The tool was pretty effective but actually missed a number of cases. Don't know why yet. |
| Comment by Billy Donahue [ 27/Jul/22 ] |
|
Well, I've mowed the lawn once, pretty much. |
| Comment by Githook User [ 27/Jul/22 ] |
|
Author: {'name': 'Billy Donahue', 'email': 'billy.donahue@gmail.com', 'username': 'BillyDonahue'}Message: |
| Comment by Githook User [ 27/Jul/22 ] |
|
Author: {'name': 'Billy Donahue', 'email': 'BillyDonahue@users.noreply.github.com', 'username': 'BillyDonahue'}Message: |
| Comment by Billy Donahue [ 27/Jul/22 ] |
|
Woot! Finally got it. Thanks to the guy on the LLVM Discord #clang-tidy chat room who gave me some tips. This is pretty damn elegant considering what it's doing under the hood. Using it to generate a PR now. |