[clang] [clang][NFC] Change suppression mapping interfaces to use SourceLocation (PR #118960)

via cfe-commits cfe-commits at lists.llvm.org
Fri Dec 6 04:17:59 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 3dbff90b16b5964b9fa468438ff40985be5c1ade 4c52dda9a253d643ef52f1f5f294cd1fd5bcfa76 --extensions cpp,h -- clang/include/clang/Basic/Diagnostic.h clang/lib/Basic/Diagnostic.cpp clang/lib/Basic/DiagnosticIDs.cpp clang/unittests/Basic/DiagnosticTest.cpp
``````````

</details>

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

``````````diff
diff --git a/clang/lib/Basic/Diagnostic.cpp b/clang/lib/Basic/Diagnostic.cpp
index 682e02222a..ae71758bc8 100644
--- a/clang/lib/Basic/Diagnostic.cpp
+++ b/clang/lib/Basic/Diagnostic.cpp
@@ -623,7 +623,8 @@ bool WarningsSpecialCaseList::globsMatches(
 
 bool DiagnosticsEngine::isSuppressedViaMapping(diag::kind DiagId,
                                                SourceLocation DiagLoc) const {
-  if (!hasSourceManager() || !DiagSuppressionMapping) return false;
+  if (!hasSourceManager() || !DiagSuppressionMapping)
+    return false;
   return DiagSuppressionMapping(DiagId, DiagLoc, getSourceManager());
 }
 
diff --git a/clang/unittests/Basic/DiagnosticTest.cpp b/clang/unittests/Basic/DiagnosticTest.cpp
index 5c3d7934b2..e03d9a464d 100644
--- a/clang/unittests/Basic/DiagnosticTest.cpp
+++ b/clang/unittests/Basic/DiagnosticTest.cpp
@@ -268,8 +268,7 @@ TEST_F(SuppressionMappingTest, SuppressesGroup) {
   EXPECT_THAT(diags(), IsEmpty());
 
   SourceLocation FooLoc = locForFile("foo.cpp");
-  EXPECT_TRUE(
-      Diags.isSuppressedViaMapping(diag::warn_unused_function, FooLoc));
+  EXPECT_TRUE(Diags.isSuppressedViaMapping(diag::warn_unused_function, FooLoc));
   EXPECT_FALSE(Diags.isSuppressedViaMapping(diag::warn_deprecated, FooLoc));
 }
 

``````````

</details>


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


More information about the cfe-commits mailing list