[clang-tools-extra] [clang-tidy] improve robustness of the member initializer detection in modernize-use-default-member-init (PR #159392)

Yanzuo Liu via cfe-commits cfe-commits at lists.llvm.org
Wed Sep 17 09:47:57 PDT 2025


================
@@ -8,17 +8,52 @@
 
 #include "UseDefaultMemberInitCheck.h"
 #include "clang/AST/ASTContext.h"
+#include "clang/AST/Expr.h"
 #include "clang/ASTMatchers/ASTMatchFinder.h"
+#include "clang/ASTMatchers/ASTMatchers.h"
 #include "clang/Lex/Lexer.h"
 
 using namespace clang::ast_matchers;
 
 namespace clang::tidy::modernize {
 
+static bool isExprAllowedInMemberInit(const Expr *E) {
+  if (E == nullptr)
+    return false;
----------------
zwuis wrote:

When the condition is `true`?

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


More information about the cfe-commits mailing list