================
@@ -720,18 +720,41 @@ bool SimplifyBooleanExprCheck::issueDiag(const ASTContext 
&Context,
 void SimplifyBooleanExprCheck::replaceWithThenStatement(
     const ASTContext &Context, const IfStmt *IfStatement,
     const Expr *BoolLiteral) {
+  std::string Replacement = getText(Context, *IfStatement->getThen()).str();
+
+  // Fix: Ensure the body statement ends with a semicolon if it's not a block.
+  if (!Replacement.empty() && Replacement.back() != ';' &&
+      Replacement.back() != '}')
+    Replacement += ";";
+
+  if (const Stmt *Init = IfStatement->getInit()) {
+    // Fix: Add a space between the init statement and the body.
----------------
zeyi2 wrote:

```suggestion
```

https://github.com/llvm/llvm-project/pull/172220
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to