[clang-tools-extra] [clang-tidy] Add support for in-class initializers in readability-redundant-member-init (PR #77206)

Piotr Zegar via cfe-commits cfe-commits at lists.llvm.org
Sat Jan 13 23:49:43 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()};
----------------
PiotrZSL wrote:

I'm not sure what you mean.

https://github.com/llvm/llvm-project/pull/77206


More information about the cfe-commits mailing list