[clang] [clang][analyzer] Don't warn about virtual calls in final class destructors (PR #178654)

via cfe-commits cfe-commits at lists.llvm.org
Thu Jan 29 08:46:16 PST 2026


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 origin/main HEAD --extensions cpp -- clang/lib/StaticAnalyzer/Checkers/VirtualCallChecker.cpp clang/test/Analysis/virtualcall.cpp --diff_from_common_commit
``````````

:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:

</details>

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

``````````diff
diff --git a/clang/lib/StaticAnalyzer/Checkers/VirtualCallChecker.cpp b/clang/lib/StaticAnalyzer/Checkers/VirtualCallChecker.cpp
index 2b22f323e..27f65fe37 100644
--- a/clang/lib/StaticAnalyzer/Checkers/VirtualCallChecker.cpp
+++ b/clang/lib/StaticAnalyzer/Checkers/VirtualCallChecker.cpp
@@ -133,7 +133,8 @@ void VirtualCallChecker::checkPreCall(const CallEvent &Call,
   if (const auto *CurCtor = dyn_cast_or_null<CXXConstructorDecl>(CurDecl)) {
     if (CurCtor->getParent()->hasAttr<FinalAttr>())
       return;
-  } else if (const auto *CurDtor = dyn_cast_or_null<CXXDestructorDecl>(CurDecl)) {
+  } else if (const auto *CurDtor =
+                 dyn_cast_or_null<CXXDestructorDecl>(CurDecl)) {
     if (CurDtor->getParent()->hasAttr<FinalAttr>())
       return;
   }

``````````

</details>


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


More information about the cfe-commits mailing list