[PATCH] D141892: Implement modernize-use-constraints
Chris Cotter via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Sat May 6 14:34:01 PDT 2023
ccotter marked an inline comment as done.
ccotter added inline comments.
================
Comment at: clang-tools-extra/clang-tidy/modernize/UseConstraintsCheck.cpp:247-248
+ ParamsRange.getEnd(), SM, LangOpts, tok::r_paren, tok::r_paren);
+ return utils::lexer::findNextAnyTokenKind(EndParens, SM, LangOpts,
+ tok::equal, tok::equal);
+ }
----------------
njames93 wrote:
> Super contrived, but looking for the `= delete` like this could be problematic
> ```lang=c++
> template<typename T>
> std::enable_if_t<std::is_const_v<T>> Foo() noexcept(requires (T a) { a = 4; }) = delete;
> ```
> Here I'd imagine it would return the `=` in the noexcept requires clause.
> I'd imagine the safest bet would be to work from the function end loc looking for the delete, then the equals.
Good catch. Added a test case for this. Looks like getSourceRange() returns the location after the parameter list and noexcept (if any), but before the `= delete`, so I went with that.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D141892/new/
https://reviews.llvm.org/D141892
More information about the cfe-commits
mailing list