[clang] [Clang][Sema] Process warnings conditionally (PR #120591)

via cfe-commits cfe-commits at lists.llvm.org
Thu Dec 19 07:40:41 PST 2024


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 6f8afafd308d37d9abc4af0801dd5a4451c13718 5b61245bbdc9d1874684f29bba880f6b5a4cfe82 --extensions cpp -- clang/lib/Sema/SemaChecking.cpp
``````````

</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 a745250988..b0076c2686 100644
--- a/clang/lib/Sema/SemaChecking.cpp
+++ b/clang/lib/Sema/SemaChecking.cpp
@@ -6612,18 +6612,20 @@ void CheckFormatHandler::HandleNonStandardConversionSpecifier(
 
 void CheckFormatHandler::HandlePosition(const char *startPos,
                                         unsigned posLen) {
-  if (!S.getDiagnostics().isIgnored(diag::warn_format_non_standard_positional_arg, SourceLocation())) {
+  if (!S.getDiagnostics().isIgnored(
+          diag::warn_format_non_standard_positional_arg, SourceLocation())) {
     EmitFormatDiagnostic(S.PDiag(diag::warn_format_non_standard_positional_arg),
-                                getLocationOfByte(startPos),
-                                /*IsStringLocation*/true,
-                                getSpecifierRange(startPos, posLen));
+                         getLocationOfByte(startPos),
+                         /*IsStringLocation*/ true,
+                         getSpecifierRange(startPos, posLen));
   }
 }
 
 void CheckFormatHandler::HandleInvalidPosition(
     const char *startSpecifier, unsigned specifierLen,
     analyze_format_string::PositionContext p) {
-  if (!S.getDiagnostics().isIgnored(diag::warn_format_invalid_positional_specifier, SourceLocation())) {
+  if (!S.getDiagnostics().isIgnored(
+          diag::warn_format_invalid_positional_specifier, SourceLocation())) {
     EmitFormatDiagnostic(
         S.PDiag(diag::warn_format_invalid_positional_specifier) << (unsigned)p,
         getLocationOfByte(startSpecifier), /*IsStringLocation*/ true,
@@ -6633,11 +6635,12 @@ void CheckFormatHandler::HandleInvalidPosition(
 
 void CheckFormatHandler::HandleZeroPosition(const char *startPos,
                                             unsigned posLen) {
-  if (!S.getDiagnostics().isIgnored(diag::warn_format_zero_positional_specifier, SourceLocation())) {
+  if (!S.getDiagnostics().isIgnored(diag::warn_format_zero_positional_specifier,
+                                    SourceLocation())) {
     EmitFormatDiagnostic(S.PDiag(diag::warn_format_zero_positional_specifier),
-                                getLocationOfByte(startPos),
-                                /*IsStringLocation*/true,
-                                getSpecifierRange(startPos, posLen));
+                         getLocationOfByte(startPos),
+                         /*IsStringLocation*/ true,
+                         getSpecifierRange(startPos, posLen));
   }
 }
 

``````````

</details>


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


More information about the cfe-commits mailing list