[llvm] [clang] [clang-tools-extra] [clang-tidy] Add support for in-class initializers in readability-redundant-member-init (PR #77206)
via llvm-commits
llvm-commits at lists.llvm.org
Sun Jan 14 04:36:44 PST 2024
================
@@ -18,52 +19,80 @@ using namespace clang::tidy::matchers;
namespace clang::tidy::readability {
+static SourceRange
+getFullInitRangeInclWhitespaces(SourceRange Range, const SourceManager &SM,
+ const LangOptions &LangOpts) {
+ const Token PrevToken =
+ utils::lexer::getPreviousToken(Range.getBegin(), SM, LangOpts, false);
+ if (PrevToken.is(tok::unknown))
+ return Range;
+
+ if (PrevToken.isNot(tok::equal))
+ return {PrevToken.getEndLoc(), Range.getEnd()};
----------------
phyBrackets wrote:
Yeah that's how I was thinking. Thanks for explaining!
https://github.com/llvm/llvm-project/pull/77206
More information about the llvm-commits
mailing list