Skip to content

cherry picks to Stable/20221013 #4#5906

Merged
ziqingluo-90 merged 12 commits intoswiftlang:stable/20221013from
ziqingluo-90:stable/20221013-cherrypick-4
Jan 12, 2023
Merged

cherry picks to Stable/20221013 #4#5906
ziqingluo-90 merged 12 commits intoswiftlang:stable/20221013from
ziqingluo-90:stable/20221013-cherrypick-4

Conversation

@ziqingluo-90
Copy link

No description provided.

jensmassberg and others added 8 commits January 5, 2023 12:24
…decls in modernize-use-nullptr

The check has produced false positives when checking the default implementation of the spaceship operator.
The default implementation should be skipped by the check.

Modified the existing test so that the check runs into the bug without this fix and add another test case.

Fixes llvm#53961.

Patch by Jens Massberg.

Reviewed By: ilya-biryukov

Differential Revision: https://reviews.llvm.org/D138701

(cherry picked from commit db335d0)
Note that std::optional does not offer create().

This is part of an effort to migrate from llvm::Optional to
std::optional:

https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716
(cherry picked from commit 20ba079)
This patch mechanically replaces None with std::nullopt where the
compiler would warn if None were deprecated.  The intent is to reduce
the amount of manual work required in migrating from Optional to
std::optional.

This is part of an effort to migrate from llvm::Optional to
std::optional:

https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716
(cherry picked from commit 1806006)
This patch mechanically replaces None with std::nullopt where the
compiler would warn if None were deprecated.  The intent is to reduce
the amount of manual work required in migrating from Optional to
std::optional.

This is part of an effort to migrate from llvm::Optional to
std::optional:

https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716
(cherry picked from commit 34e0d05)
This patch mechanically replaces None with std::nullopt where the
compiler would warn if None were deprecated.  The intent is to reduce
the amount of manual work required in migrating from Optional to
std::optional.

This is part of an effort to migrate from llvm::Optional to
std::optional:

https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716
(cherry picked from commit cd8702e)
kazutakahirata and others added 4 commits January 6, 2023 16:05
This patch adds interpretation of the overloaded equality and inequality
operators available for the optional types.

Fixes issue llvm#57253.

Differential Revision: https://reviews.llvm.org/D139360

(cherry picked from commit 390029b)
…-namespace

The same functionality is already implemented in the
readability-static-definition-in-anonymous-namespace
check, including automatic fixes.

Differential Revision: https://reviews.llvm.org/D139197

(cherry picked from commit 7fd8387)
@ziqingluo-90 ziqingluo-90 force-pushed the stable/20221013-cherrypick-4 branch from e36cf9e to 724795d Compare January 7, 2023 00:05
@ziqingluo-90
Copy link
Author

I removed -Wunsafe-buffer-usage commits. Let me politely ping @haoNoQ and @jkorous-apple

Copy link

@haoNoQ haoNoQ left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@haoNoQ
Copy link

haoNoQ commented Jan 10, 2023

Wait a sec, I don't see any std::nullopt in this branch yet, and I suspect this isn't because we didn't cherry-pick any, but because we're still compiling downstream with c++14 which doesn't have optionals yet.

@haoNoQ
Copy link

haoNoQ commented Jan 10, 2023

Yeah indeed, I tried it manually and I'm getting errors on this branch:

/Users/artemdergachev/github/llvm-project/clang/lib/StaticAnalyzer/Checkers/SimpleStreamChecker.cpp:239:3: error: no template named 'optional' in namespace 'std'; did you mean 'Optional'?
  std::optional<int> Opt = std::nullopt;
  ^~~~~~~~~~~~~
  Optional
/Users/artemdergachev/github/llvm-project/clang/include/clang/Basic/LLVM.h:78:15: note: 'Optional' declared here
  using llvm::Optional;
              ^
/Users/artemdergachev/github/llvm-project/clang/lib/StaticAnalyzer/Checkers/SimpleStreamChecker.cpp:239:33: error: no member named 'nullopt' in namespace 'std'
  std::optional<int> Opt = std::nullopt;
                           ~~~~~^
2 errors generated.

Did these cherry-picks compile locally for you? I suspect that they rely on another patch that bumps the C++ standard version in CMake configs, and we probably don't have the authority to cherry-pick them.

@haoNoQ
Copy link

haoNoQ commented Jan 11, 2023

Never mind, I looked at the wrong branch. This compiles perfectly, please merge!

@ziqingluo-90 ziqingluo-90 merged commit 03bfb4f into swiftlang:stable/20221013 Jan 12, 2023
@ziqingluo-90
Copy link
Author

Never mind, I looked at the wrong branch. This compiles perfectly, please merge!

Thank you! :)

@ziqingluo-90 ziqingluo-90 deleted the stable/20221013-cherrypick-4 branch November 30, 2023 19:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants