[clang] [Sema] Suggest missing format attributes (PR #166738)

via cfe-commits cfe-commits at lists.llvm.org
Thu Nov 27 00:02:59 PST 2025


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 c,h,cpp -- clang/test/Sema/format-attr-missing-gnu.c clang/test/Sema/format-attr-missing.c clang/test/Sema/format-attr-missing.cpp clang/include/clang/Sema/Sema.h clang/lib/Sema/SemaChecking.cpp clang/lib/Sema/SemaDeclAttr.cpp clang/test/Sema/format-strings-scanf.c clang/test/Sema/format-strings.c clang/test/SemaCXX/format-strings.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/Sema/SemaChecking.cpp b/clang/lib/Sema/SemaChecking.cpp
index a06e5876f..4e3d99ee3 100644
--- a/clang/lib/Sema/SemaChecking.cpp
+++ b/clang/lib/Sema/SemaChecking.cpp
@@ -7110,8 +7110,7 @@ static bool CheckMissingFormatAttribute(
     StringLiteral *ReferenceFormatString, unsigned FormatIdx,
     unsigned FirstDataArg, FormatStringType FormatType, unsigned CallerParamIdx,
     SourceLocation Loc) {
-  if (S->getDiagnostics().isIgnored(diag::warn_missing_format_attribute,
-                                    Loc))
+  if (S->getDiagnostics().isIgnored(diag::warn_missing_format_attribute, Loc))
     return false;
 
   DeclContext *DC = S->CurContext;

``````````

</details>


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


More information about the cfe-commits mailing list