github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. 
:warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff HEAD~1 HEAD --extensions cpp -- 
clang/test/SemaCXX/wreturn-always-throws.cpp 
clang/lib/Sema/AnalysisBasedWarnings.cpp
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/clang/lib/Sema/AnalysisBasedWarnings.cpp 
b/clang/lib/Sema/AnalysisBasedWarnings.cpp
index 6d54282c9..67e379fdd 100644
--- a/clang/lib/Sema/AnalysisBasedWarnings.cpp
+++ b/clang/lib/Sema/AnalysisBasedWarnings.cpp
@@ -624,30 +624,30 @@ struct CheckFallThroughDiagnostics {
   }
 };
 
-  bool isKnownToAlwaysThrow(const FunctionDecl *FD) {
-    if (!FD->hasBody())
-      return false;
-    const Stmt *Body = FD->getBody();
-    const Stmt *OnlyStmt = nullptr;
-
-    if (const auto *Compound = dyn_cast<CompoundStmt>(Body)) {
-      if (Compound->size() != 1)
-        return false; // More than one statement, can't be known to always 
throw.
-      OnlyStmt = *Compound->body_begin();
-    } else {
-      OnlyStmt = Body;
-    }
+bool isKnownToAlwaysThrow(const FunctionDecl *FD) {
+  if (!FD->hasBody())
+    return false;
+  const Stmt *Body = FD->getBody();
+  const Stmt *OnlyStmt = nullptr;
 
-    // Unwrap ExprWithCleanups if necessary.
-    if (const auto *EWC = dyn_cast<ExprWithCleanups>(OnlyStmt)) {
-      OnlyStmt = EWC->getSubExpr();
-    }
-    // Check if the only statement is a throw expression.
-    if (isa<CXXThrowExpr>(OnlyStmt)) {
-      return true; // Known to always throw.
-    }
-    return false; // Not known to always throw.
+  if (const auto *Compound = dyn_cast<CompoundStmt>(Body)) {
+    if (Compound->size() != 1)
+      return false; // More than one statement, can't be known to always throw.
+    OnlyStmt = *Compound->body_begin();
+  } else {
+    OnlyStmt = Body;
+  }
+
+  // Unwrap ExprWithCleanups if necessary.
+  if (const auto *EWC = dyn_cast<ExprWithCleanups>(OnlyStmt)) {
+    OnlyStmt = EWC->getSubExpr();
   }
+  // Check if the only statement is a throw expression.
+  if (isa<CXXThrowExpr>(OnlyStmt)) {
+    return true; // Known to always throw.
+  }
+  return false; // Not known to always throw.
+}
 
 } // anonymous namespace
 /// CheckFallThroughForBody - Check that we don't fall off the end of a

``````````

</details>


https://github.com/llvm/llvm-project/pull/145166
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to