================ @@ -230,139 +197,99 @@ void PreferMemberInitializerCheck::check( updateAssignmentLevel(Field, InitValue, Ctor, AssignedFields); if (!canAdvanceAssignment(AssignedFields[Field])) continue; - const bool IsInDefaultMemberInitializer = - IsUseDefaultMemberInitEnabled && getLangOpts().CPlusPlus11 && - Ctor->isDefaultConstructor() && - (getLangOpts().CPlusPlus20 || !Field->isBitField()) && - !Field->hasInClassInitializer() && - (!isa<RecordDecl>(Class->getDeclContext()) || - !cast<RecordDecl>(Class->getDeclContext())->isUnion()) && - shouldBeDefaultMemberInitializer(InitValue); - if (IsInDefaultMemberInitializer) { - bool InvalidFix = false; - SourceLocation FieldEnd = - Lexer::getLocForEndOfToken(Field->getSourceRange().getEnd(), 0, - *Result.SourceManager, getLangOpts()); - InvalidFix |= FieldEnd.isInvalid() || FieldEnd.isMacroID(); - SourceLocation SemiColonEnd; - if (auto NextToken = Lexer::findNextToken( - S->getEndLoc(), *Result.SourceManager, getLangOpts())) - SemiColonEnd = NextToken->getEndLoc(); - else - InvalidFix = true; - auto Diag = - diag(S->getBeginLoc(), "%0 should be initialized in an in-class" - " default member initializer") - << Field; - if (InvalidFix) - continue; - CharSourceRange StmtRange = - CharSourceRange::getCharRange(S->getBeginLoc(), SemiColonEnd); - SmallString<128> Insertion( - {UseAssignment ? " = " : "{", - Lexer::getSourceText(Result.SourceManager->getExpansionRange( - InitValue->getSourceRange()), - *Result.SourceManager, getLangOpts()), - UseAssignment ? "" : "}"}); - - Diag << FixItHint::CreateInsertion(FieldEnd, Insertion) - << FixItHint::CreateRemoval(StmtRange); - - } else { ---------------- carlosgalvezp wrote:
The diff is very unfortunate, but essentially there's no changes to the code inside this "else" block. It's just unindented 2 spaces. The main change is the removal of the "if" block. https://github.com/llvm/llvm-project/pull/80193 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits