From 653262162c8eb250106d062d99e040c4bea1b5a8 Mon Sep 17 00:00:00 2001
From: Brad King <brad.king@kitware.com>
Date: Thu, 16 Nov 2023 11:34:00 -0500
Subject: clang-tidy module: Update to build against LLVM/Clang 17

---
 Utilities/ClangTidyModule/Tests/RunClangTidy.cmake |   1 +
 .../cmake-ostringstream-use-cmstrcat-stdout.txt    |   8 +-
 ...ke-string-concatenation-use-cmstrcat-stdout.txt | 158 ++++++++---------
 .../Tests/cmake-use-bespoke-enum-class-stdout.txt  |  24 +--
 .../Tests/cmake-use-cmstrlen-stdout.txt            |  64 +++----
 .../Tests/cmake-use-cmsys-fstream-stdout.txt       | 186 ++++++++++-----------
 .../Tests/cmake-use-pragma-once-stdout.txt         |  51 ++++--
 Utilities/ClangTidyModule/UsePragmaOnceCheck.h     |  12 +-
 8 files changed, 268 insertions(+), 236 deletions(-)

diff --git a/Utilities/ClangTidyModule/Tests/RunClangTidy.cmake b/Utilities/ClangTidyModule/Tests/RunClangTidy.cmake
index 98770d7..813d184 100644
--- a/Utilities/ClangTidyModule/Tests/RunClangTidy.cmake
+++ b/Utilities/ClangTidyModule/Tests/RunClangTidy.cmake
@@ -47,6 +47,7 @@ if(NOT result EQUAL 0)
   string(APPEND RunClangTidy_TEST_FAILED "Expected result: 0, actual result: ${result}\n")
 endif()
 
+string(REGEX REPLACE " +\n" "\n" actual_stdout "${actual_stdout}")
 string(REGEX REPLACE "\n+$" "" actual_stdout "${actual_stdout}")
 if(NOT actual_stdout STREQUAL expect_stdout)
   string(REPLACE "\n" "\n  " expect_stdout_formatted "  ${expect_stdout}")
diff --git a/Utilities/ClangTidyModule/Tests/cmake-ostringstream-use-cmstrcat-stdout.txt b/Utilities/ClangTidyModule/Tests/cmake-ostringstream-use-cmstrcat-stdout.txt
index 1b2d6e7..9c4108c 100644
--- a/Utilities/ClangTidyModule/Tests/cmake-ostringstream-use-cmstrcat-stdout.txt
+++ b/Utilities/ClangTidyModule/Tests/cmake-ostringstream-use-cmstrcat-stdout.txt
@@ -1,6 +1,6 @@
 cmake-ostringstream-use-cmstrcat.cxx:5:3: warning: use strings and cmStrCat() instead of std::ostringstream [cmake-ostringstream-use-cmstrcat]
-  std::ostringstream test;
-  ^
+    5 |   std::ostringstream test;
+      |   ^
 cmake-ostringstream-use-cmstrcat.cxx:8:13: warning: use strings and cmStrCat() instead of std::ostringstream [cmake-ostringstream-use-cmstrcat]
-void check2(std::ostringstream& test2)
-            ^
+    8 | void check2(std::ostringstream& test2)
+      |             ^
diff --git a/Utilities/ClangTidyModule/Tests/cmake-string-concatenation-use-cmstrcat-stdout.txt b/Utilities/ClangTidyModule/Tests/cmake-string-concatenation-use-cmstrcat-stdout.txt
index 83b8d83..749ad45 100644
--- a/Utilities/ClangTidyModule/Tests/cmake-string-concatenation-use-cmstrcat-stdout.txt
+++ b/Utilities/ClangTidyModule/Tests/cmake-string-concatenation-use-cmstrcat-stdout.txt
@@ -1,124 +1,124 @@
 cmake-string-concatenation-use-cmstrcat.cxx:17:12: warning: use cmStrCat() instead of string concatenation [cmake-string-concatenation-use-cmstrcat]
-  concat = a + b;
-           ^ ~
-           cmStrCat( , )
+   17 |   concat = a + b;
+      |            ^ ~
+      |            cmStrCat( , )
 cmake-string-concatenation-use-cmstrcat.cxx:17:12: note: FIX-IT applied suggested code changes
 cmake-string-concatenation-use-cmstrcat.cxx:17:14: note: FIX-IT applied suggested code changes
-  concat = a + b;
-             ^
+   17 |   concat = a + b;
+      |              ^
 cmake-string-concatenation-use-cmstrcat.cxx:17:17: note: FIX-IT applied suggested code changes
-  concat = a + b;
-                ^
+   17 |   concat = a + b;
+      |                 ^
 cmake-string-concatenation-use-cmstrcat.cxx:18:12: warning: use cmStrCat() instead of string concatenation [cmake-string-concatenation-use-cmstrcat]
-  concat = a + " and this is a string literal";
-           ^ ~
-           cmStrCat( ,                        )
+   18 |   concat = a + " and this is a string literal";
+      |            ^ ~
+      |            cmStrCat( ,                        )
 cmake-string-concatenation-use-cmstrcat.cxx:18:12: note: FIX-IT applied suggested code changes
 cmake-string-concatenation-use-cmstrcat.cxx:18:14: note: FIX-IT applied suggested code changes
-  concat = a + " and this is a string literal";
-             ^
+   18 |   concat = a + " and this is a string literal";
+      |              ^
 cmake-string-concatenation-use-cmstrcat.cxx:18:47: note: FIX-IT applied suggested code changes
-  concat = a + " and this is a string literal";
-                                              ^
+   18 |   concat = a + " and this is a string literal";
+      |                                               ^
 cmake-string-concatenation-use-cmstrcat.cxx:19:12: warning: use cmStrCat() instead of string concatenation [cmake-string-concatenation-use-cmstrcat]
-  concat = a + 'O';
-           ^ ~
-           cmStrCat( , )
+   19 |   concat = a + 'O';
+      |            ^ ~
+      |            cmStrCat( , )
 cmake-string-concatenation-use-cmstrcat.cxx:19:12: note: FIX-IT applied suggested code changes
 cmake-string-concatenation-use-cmstrcat.cxx:19:14: note: FIX-IT applied suggested code changes
-  concat = a + 'O';
-             ^
+   19 |   concat = a + 'O';
+      |              ^
 cmake-string-concatenation-use-cmstrcat.cxx:19:19: note: FIX-IT applied suggested code changes
-  concat = a + 'O';
-                  ^
+   19 |   concat = a + 'O';
+      |                   ^
 cmake-string-concatenation-use-cmstrcat.cxx:20:12: warning: use cmStrCat() instead of string concatenation [cmake-string-concatenation-use-cmstrcat]
-  concat = "This is a string literal" + b;
-           ^                          ~
-           cmStrCat(                  ,  )
+   20 |   concat = "This is a string literal" + b;
+      |            ^                          ~
+      |            cmStrCat(                  ,  )
 cmake-string-concatenation-use-cmstrcat.cxx:20:12: note: FIX-IT applied suggested code changes
 cmake-string-concatenation-use-cmstrcat.cxx:20:39: note: FIX-IT applied suggested code changes
-  concat = "This is a string literal" + b;
-                                      ^
+   20 |   concat = "This is a string literal" + b;
+      |                                       ^
 cmake-string-concatenation-use-cmstrcat.cxx:20:42: note: FIX-IT applied suggested code changes
-  concat = "This is a string literal" + b;
-                                         ^
+   20 |   concat = "This is a string literal" + b;
+      |                                          ^
 cmake-string-concatenation-use-cmstrcat.cxx:21:12: warning: use cmStrCat() instead of string concatenation [cmake-string-concatenation-use-cmstrcat]
-  concat = 'O' + a;
-           ^   ~
-           cmStrCat( , )
+   21 |   concat = 'O' + a;
+      |            ^   ~
+      |            cmStrCat( , )
 cmake-string-concatenation-use-cmstrcat.cxx:21:12: note: FIX-IT applied suggested code changes
 cmake-string-concatenation-use-cmstrcat.cxx:21:16: note: FIX-IT applied suggested code changes
-  concat = 'O' + a;
-               ^
+   21 |   concat = 'O' + a;
+      |                ^
 cmake-string-concatenation-use-cmstrcat.cxx:21:19: note: FIX-IT applied suggested code changes
-  concat = 'O' + a;
-                  ^
+   21 |   concat = 'O' + a;
+      |                   ^
 cmake-string-concatenation-use-cmstrcat.cxx:22:12: warning: use cmStrCat() instead of string concatenation [cmake-string-concatenation-use-cmstrcat]
-  concat = a + " and this is a string literal" + 'O' + b;
-           ^ ~                                 ~     ~
-           cmStrCat( ,                         ,     ,  )
+   22 |   concat = a + " and this is a string literal" + 'O' + b;
+      |            ^ ~                                 ~     ~
+      |            cmStrCat( ,                         ,     ,  )
 cmake-string-concatenation-use-cmstrcat.cxx:22:12: note: FIX-IT applied suggested code changes
 cmake-string-concatenation-use-cmstrcat.cxx:22:14: note: FIX-IT applied suggested code changes
-  concat = a + " and this is a string literal" + 'O' + b;
-             ^
+   22 |   concat = a + " and this is a string literal" + 'O' + b;
+      |              ^
 cmake-string-concatenation-use-cmstrcat.cxx:22:48: note: FIX-IT applied suggested code changes
-  concat = a + " and this is a string literal" + 'O' + b;
-                                               ^
+   22 |   concat = a + " and this is a string literal" + 'O' + b;
+      |                                                ^
 cmake-string-concatenation-use-cmstrcat.cxx:22:54: note: FIX-IT applied suggested code changes
-  concat = a + " and this is a string literal" + 'O' + b;
-                                                     ^
+   22 |   concat = a + " and this is a string literal" + 'O' + b;
+      |                                                      ^
 cmake-string-concatenation-use-cmstrcat.cxx:22:57: note: FIX-IT applied suggested code changes
-  concat = a + " and this is a string literal" + 'O' + b;
-                                                        ^
+   22 |   concat = a + " and this is a string literal" + 'O' + b;
+      |                                                         ^
 cmake-string-concatenation-use-cmstrcat.cxx:24:10: warning: use cmStrCat() instead of string append [cmake-string-concatenation-use-cmstrcat]
-  concat += b;
-         ^~
-         = cmStrCat(concat, )
+   24 |   concat += b;
+      |          ^~
+      |          = cmStrCat(concat, )
 cmake-string-concatenation-use-cmstrcat.cxx:24:10: note: FIX-IT applied suggested code changes
 cmake-string-concatenation-use-cmstrcat.cxx:24:14: note: FIX-IT applied suggested code changes
-  concat += b;
-             ^
+   24 |   concat += b;
+      |              ^
 cmake-string-concatenation-use-cmstrcat.cxx:25:10: warning: use cmStrCat() instead of string append [cmake-string-concatenation-use-cmstrcat]
-  concat += " and this is a string literal";
-         ^~
-         = cmStrCat(concat,                )
+   25 |   concat += " and this is a string literal";
+      |          ^~
+      |          = cmStrCat(concat,                )
 cmake-string-concatenation-use-cmstrcat.cxx:25:10: note: FIX-IT applied suggested code changes
 cmake-string-concatenation-use-cmstrcat.cxx:25:44: note: FIX-IT applied suggested code changes
-  concat += " and this is a string literal";
-                                           ^
+   25 |   concat += " and this is a string literal";
+      |                                            ^
 cmake-string-concatenation-use-cmstrcat.cxx:26:10: warning: use cmStrCat() instead of string append [cmake-string-concatenation-use-cmstrcat]
-  concat += 'o';
-         ^~
-         = cmStrCat(concat, )
+   26 |   concat += 'o';
+      |          ^~
+      |          = cmStrCat(concat, )
 cmake-string-concatenation-use-cmstrcat.cxx:26:10: note: FIX-IT applied suggested code changes
 cmake-string-concatenation-use-cmstrcat.cxx:26:16: note: FIX-IT applied suggested code changes
-  concat += 'o';
-               ^
+   26 |   concat += 'o';
+      |                ^
 cmake-string-concatenation-use-cmstrcat.cxx:27:10: warning: use cmStrCat() instead of string append [cmake-string-concatenation-use-cmstrcat]
-  concat += b + " and this is a string literal " + 'o' + b;
-         ^~   ~                                  ~     ~
-         = cmStrCat(concat, ,                    ,     ,  )
+   27 |   concat += b + " and this is a string literal " + 'o' + b;
+      |          ^~   ~                                  ~     ~
+      |          = cmStrCat(concat, ,                    ,     ,  )
 cmake-string-concatenation-use-cmstrcat.cxx:27:10: note: FIX-IT applied suggested code changes
 cmake-string-concatenation-use-cmstrcat.cxx:27:15: note: FIX-IT applied suggested code changes
-  concat += b + " and this is a string literal " + 'o' + b;
-              ^
+   27 |   concat += b + " and this is a string literal " + 'o' + b;
+      |               ^
 cmake-string-concatenation-use-cmstrcat.cxx:27:50: note: FIX-IT applied suggested code changes
-  concat += b + " and this is a string literal " + 'o' + b;
-                                                 ^
+   27 |   concat += b + " and this is a string literal " + 'o' + b;
+      |                                                  ^
 cmake-string-concatenation-use-cmstrcat.cxx:27:56: note: FIX-IT applied suggested code changes
-  concat += b + " and this is a string literal " + 'o' + b;
-                                                       ^
+   27 |   concat += b + " and this is a string literal " + 'o' + b;
+      |                                                        ^
 cmake-string-concatenation-use-cmstrcat.cxx:27:59: note: FIX-IT applied suggested code changes
-  concat += b + " and this is a string literal " + 'o' + b;
-                                                          ^
+   27 |   concat += b + " and this is a string literal " + 'o' + b;
+      |                                                           ^
 cmake-string-concatenation-use-cmstrcat.cxx:30:12: warning: use cmStrCat() instead of string concatenation [cmake-string-concatenation-use-cmstrcat]
-  concat = p.first + p.second;
-           ^       ~
-           cmStrCat( ,       )
+   30 |   concat = p.first + p.second;
+      |            ^       ~
+      |            cmStrCat( ,       )
 cmake-string-concatenation-use-cmstrcat.cxx:30:12: note: FIX-IT applied suggested code changes
 cmake-string-concatenation-use-cmstrcat.cxx:30:20: note: FIX-IT applied suggested code changes
-  concat = p.first + p.second;
-                   ^
+   30 |   concat = p.first + p.second;
+      |                    ^
 cmake-string-concatenation-use-cmstrcat.cxx:30:30: note: FIX-IT applied suggested code changes
-  concat = p.first + p.second;
-                             ^
+   30 |   concat = p.first + p.second;
+      |                              ^
diff --git a/Utilities/ClangTidyModule/Tests/cmake-use-bespoke-enum-class-stdout.txt b/Utilities/ClangTidyModule/Tests/cmake-use-bespoke-enum-class-stdout.txt
index 5e0acdd..cc72402 100644
--- a/Utilities/ClangTidyModule/Tests/cmake-use-bespoke-enum-class-stdout.txt
+++ b/Utilities/ClangTidyModule/Tests/cmake-use-bespoke-enum-class-stdout.txt
@@ -1,18 +1,18 @@
 cmake-use-bespoke-enum-class.cxx:3:16: warning: use a bespoke enum class instead of booleans as parameters [cmake-use-bespoke-enum-class]
-bool function1(bool i)
-               ^
+    3 | bool function1(bool i)
+      |                ^
 cmake-use-bespoke-enum-class.cxx:8:15: warning: use a bespoke enum class instead of booleans as parameters [cmake-use-bespoke-enum-class]
-int function2(bool i)
-              ^
+    8 | int function2(bool i)
+      |               ^
 cmake-use-bespoke-enum-class.cxx:13:16: warning: use a bespoke enum class instead of booleans as parameters [cmake-use-bespoke-enum-class]
-char function3(bool i)
-               ^
+   13 | char function3(bool i)
+      |                ^
 cmake-use-bespoke-enum-class.cxx:18:16: warning: use a bespoke enum class instead of booleans as parameters [cmake-use-bespoke-enum-class]
-void function4(bool i)
-               ^
+   18 | void function4(bool i)
+      |                ^
 cmake-use-bespoke-enum-class.cxx:22:17: warning: use a bespoke enum class instead of booleans as parameters [cmake-use-bespoke-enum-class]
-float function5(bool i)
-                ^
+   22 | float function5(bool i)
+      |                 ^
 cmake-use-bespoke-enum-class.cxx:27:18: warning: use a bespoke enum class instead of booleans as parameters [cmake-use-bespoke-enum-class]
-double function6(bool i)
-                 ^
+   27 | double function6(bool i)
+      |                  ^
diff --git a/Utilities/ClangTidyModule/Tests/cmake-use-cmstrlen-stdout.txt b/Utilities/ClangTidyModule/Tests/cmake-use-cmstrlen-stdout.txt
index d18822a..dada356 100644
--- a/Utilities/ClangTidyModule/Tests/cmake-use-cmstrlen-stdout.txt
+++ b/Utilities/ClangTidyModule/Tests/cmake-use-cmstrlen-stdout.txt
@@ -1,52 +1,52 @@
 cmake-use-cmstrlen.cxx:26:9: warning: use cmStrLen() for string literals [cmake-use-cmstrlen]
-  (void)strlen("Hello");
-        ^~~~~~
-        cmStrLen
+   26 |   (void)strlen("Hello");
+      |         ^~~~~~
+      |         cmStrLen
 cmake-use-cmstrlen.cxx:26:9: note: FIX-IT applied suggested code changes
 cmake-use-cmstrlen.cxx:27:9: warning: use cmStrLen() for string literals [cmake-use-cmstrlen]
-  (void)::strlen("Goodbye");
-        ^~~~~~~~
-        cmStrLen
+   27 |   (void)::strlen("Goodbye");
+      |         ^~~~~~~~
+      |         cmStrLen
 cmake-use-cmstrlen.cxx:27:9: note: FIX-IT applied suggested code changes
 cmake-use-cmstrlen.cxx:28:9: warning: use cmStrLen() for string literals [cmake-use-cmstrlen]
-  (void)std::strlen("Hola");
-        ^~~~~~~~~~~
-        cmStrLen
+   28 |   (void)std::strlen("Hola");
+      |         ^~~~~~~~~~~
+      |         cmStrLen
 cmake-use-cmstrlen.cxx:28:9: note: FIX-IT applied suggested code changes
 cmake-use-cmstrlen.cxx:29:9: warning: use cmStrLen() for string literals [cmake-use-cmstrlen]
-  (void)ns1::strlen("Bonjour");
-        ^~~~~~~~~~~
-        cmStrLen
+   29 |   (void)ns1::strlen("Bonjour");
+      |         ^~~~~~~~~~~
+      |         cmStrLen
 cmake-use-cmstrlen.cxx:29:9: note: FIX-IT applied suggested code changes
 cmake-use-cmstrlen.cxx:30:10: warning: use cmStrLen() for string literals [cmake-use-cmstrlen]
-  (void)(sizeof("Hallo") - 1);
-         ^~~~~~          ~~~
-         cmStrLen
+   30 |   (void)(sizeof("Hallo") - 1);
+      |          ^~~~~~          ~~~
+      |          cmStrLen
 cmake-use-cmstrlen.cxx:30:10: note: FIX-IT applied suggested code changes
 cmake-use-cmstrlen.cxx:30:26: note: FIX-IT applied suggested code changes
-  (void)(sizeof("Hallo") - 1);
-                         ^
+   30 |   (void)(sizeof("Hallo") - 1);
+      |                          ^
 cmake-use-cmstrlen.cxx:31:14: warning: use cmStrLen() for string literals [cmake-use-cmstrlen]
-  (void)(4 + sizeof("Hallo") - 1);
-             ^~~~~~          ~~~
-             cmStrLen
+   31 |   (void)(4 + sizeof("Hallo") - 1);
+      |              ^~~~~~          ~~~
+      |              cmStrLen
 cmake-use-cmstrlen.cxx:31:14: note: FIX-IT applied suggested code changes
 cmake-use-cmstrlen.cxx:31:30: note: FIX-IT applied suggested code changes
-  (void)(4 + sizeof("Hallo") - 1);
-                             ^
+   31 |   (void)(4 + sizeof("Hallo") - 1);
+      |                              ^
 cmake-use-cmstrlen.cxx:32:10: warning: use cmStrLen() for string literals [cmake-use-cmstrlen]
-  (void)(sizeof "Hallo" - 1);
-         ^~~~~~         ~~~
-         cmStrLen(      )
+   32 |   (void)(sizeof "Hallo" - 1);
+      |          ^~~~~~         ~~~
+      |          cmStrLen(      )
 cmake-use-cmstrlen.cxx:32:10: note: FIX-IT applied suggested code changes
 cmake-use-cmstrlen.cxx:32:25: note: FIX-IT applied suggested code changes
-  (void)(sizeof "Hallo" - 1);
-                        ^
+   32 |   (void)(sizeof "Hallo" - 1);
+      |                         ^
 cmake-use-cmstrlen.cxx:33:14: warning: use cmStrLen() for string literals [cmake-use-cmstrlen]
-  (void)(4 + sizeof "Hallo" - 1);
-             ^~~~~~         ~~~
-             cmStrLen(      )
+   33 |   (void)(4 + sizeof "Hallo" - 1);
+      |              ^~~~~~         ~~~
+      |              cmStrLen(      )
 cmake-use-cmstrlen.cxx:33:14: note: FIX-IT applied suggested code changes
 cmake-use-cmstrlen.cxx:33:29: note: FIX-IT applied suggested code changes
-  (void)(4 + sizeof "Hallo" - 1);
-                            ^
+   33 |   (void)(4 + sizeof "Hallo" - 1);
+      |                             ^
diff --git a/Utilities/ClangTidyModule/Tests/cmake-use-cmsys-fstream-stdout.txt b/Utilities/ClangTidyModule/Tests/cmake-use-cmsys-fstream-stdout.txt
index d2c45f2..edf79bc 100644
--- a/Utilities/ClangTidyModule/Tests/cmake-use-cmsys-fstream-stdout.txt
+++ b/Utilities/ClangTidyModule/Tests/cmake-use-cmsys-fstream-stdout.txt
@@ -1,155 +1,155 @@
 cmake-use-cmsys-fstream.cxx:24:20: warning: use cmsys::ifstream [cmake-use-cmsys-fstream]
-  using ifstream = std::ifstream;
-                   ^~~~~~~~~~~~~
-                   cmsys::ifstream
+   24 |   using ifstream = std::ifstream;
+      |                    ^~~~~~~~~~~~~
+      |                    cmsys::ifstream
 cmake-use-cmsys-fstream.cxx:24:20: note: FIX-IT applied suggested code changes
 cmake-use-cmsys-fstream.cxx:25:20: warning: use cmsys::ofstream [cmake-use-cmsys-fstream]
-  using ofstream = std::ofstream;
-                   ^~~~~~~~~~~~~
-                   cmsys::ofstream
+   25 |   using ofstream = std::ofstream;
+      |                    ^~~~~~~~~~~~~
+      |                    cmsys::ofstream
 cmake-use-cmsys-fstream.cxx:25:20: note: FIX-IT applied suggested code changes
 cmake-use-cmsys-fstream.cxx:26:19: warning: use cmsys::fstream [cmake-use-cmsys-fstream]
-  using fstream = std::fstream;
-                  ^~~~~~~~~~~~
-                  cmsys::fstream
+   26 |   using fstream = std::fstream;
+      |                   ^~~~~~~~~~~~
+      |                   cmsys::fstream
 cmake-use-cmsys-fstream.cxx:26:19: note: FIX-IT applied suggested code changes
 cmake-use-cmsys-fstream.cxx:29:13: warning: use cmsys::ifstream [cmake-use-cmsys-fstream]
-using ifs = std::ifstream;
-            ^~~~~~~~~~~~~
-            cmsys::ifstream
+   29 | using ifs = std::ifstream;
+      |             ^~~~~~~~~~~~~
+      |             cmsys::ifstream
 cmake-use-cmsys-fstream.cxx:29:13: note: FIX-IT applied suggested code changes
 cmake-use-cmsys-fstream.cxx:30:13: warning: use cmsys::ofstream [cmake-use-cmsys-fstream]
-using ofs = std::ofstream;
-            ^~~~~~~~~~~~~
-            cmsys::ofstream
+   30 | using ofs = std::ofstream;
+      |             ^~~~~~~~~~~~~
+      |             cmsys::ofstream
 cmake-use-cmsys-fstream.cxx:30:13: note: FIX-IT applied suggested code changes
 cmake-use-cmsys-fstream.cxx:31:12: warning: use cmsys::fstream [cmake-use-cmsys-fstream]
-using fs = std::fstream;
-           ^~~~~~~~~~~~
-           cmsys::fstream
+   31 | using fs = std::fstream;
+      |            ^~~~~~~~~~~~
+      |            cmsys::fstream
 cmake-use-cmsys-fstream.cxx:31:12: note: FIX-IT applied suggested code changes
 cmake-use-cmsys-fstream.cxx:41:3: warning: use cmsys::ifstream [cmake-use-cmsys-fstream]
-  ifstream ifsUnqual;
-  ^~~~~~~~
-  cmsys::ifstream
+   41 |   ifstream ifsUnqual;
+      |   ^~~~~~~~
+      |   cmsys::ifstream
 cmake-use-cmsys-fstream.cxx:41:3: note: FIX-IT applied suggested code changes
 cmake-use-cmsys-fstream.cxx:42:3: warning: use cmsys::ifstream [cmake-use-cmsys-fstream]
-  std::ifstream ifsQual;
-  ^~~~~~~~~~~~~
-  cmsys::ifstream
+   42 |   std::ifstream ifsQual;
+      |   ^~~~~~~~~~~~~
+      |   cmsys::ifstream
 cmake-use-cmsys-fstream.cxx:42:3: note: FIX-IT applied suggested code changes
 cmake-use-cmsys-fstream.cxx:43:3: warning: use cmsys::ifstream [cmake-use-cmsys-fstream]
-  ns::ifstream ifsNS;
-  ^~~~~~~~~~~~
-  cmsys::ifstream
+   43 |   ns::ifstream ifsNS;
+      |   ^~~~~~~~~~~~
+      |   cmsys::ifstream
 cmake-use-cmsys-fstream.cxx:43:3: note: FIX-IT applied suggested code changes
 cmake-use-cmsys-fstream.cxx:44:3: warning: use cmsys::ifstream [cmake-use-cmsys-fstream]
-  ns::ns::ifstream ifsNested;
-  ^~~~~~~~~~~~~~~~
-  cmsys::ifstream
+   44 |   ns::ns::ifstream ifsNested;
+      |   ^~~~~~~~~~~~~~~~
+      |   cmsys::ifstream
 cmake-use-cmsys-fstream.cxx:44:3: note: FIX-IT applied suggested code changes
 cmake-use-cmsys-fstream.cxx:45:3: warning: use cmsys::ifstream [cmake-use-cmsys-fstream]
-  ns::cl::ifstream ifsClass;
-  ^~~~~~~~~~~~~~~~
-  cmsys::ifstream
+   45 |   ns::cl::ifstream ifsClass;
+      |   ^~~~~~~~~~~~~~~~
+      |   cmsys::ifstream
 cmake-use-cmsys-fstream.cxx:45:3: note: FIX-IT applied suggested code changes
 cmake-use-cmsys-fstream.cxx:46:3: warning: use cmsys::ifstream [cmake-use-cmsys-fstream]
-  ns::ifs ifsRenamed;
-  ^~~~~~~
-  cmsys::ifstream
+   46 |   ns::ifs ifsRenamed;
+      |   ^~~~~~~
+      |   cmsys::ifstream
 cmake-use-cmsys-fstream.cxx:46:3: note: FIX-IT applied suggested code changes
 cmake-use-cmsys-fstream.cxx:48:3: warning: use cmsys::ofstream [cmake-use-cmsys-fstream]
-  ofstream ofsUnqual;
-  ^~~~~~~~
-  cmsys::ofstream
+   48 |   ofstream ofsUnqual;
+      |   ^~~~~~~~
+      |   cmsys::ofstream
 cmake-use-cmsys-fstream.cxx:48:3: note: FIX-IT applied suggested code changes
 cmake-use-cmsys-fstream.cxx:49:3: warning: use cmsys::ofstream [cmake-use-cmsys-fstream]
-  std::ofstream ofsQual;
-  ^~~~~~~~~~~~~
-  cmsys::ofstream
+   49 |   std::ofstream ofsQual;
+      |   ^~~~~~~~~~~~~
+      |   cmsys::ofstream
 cmake-use-cmsys-fstream.cxx:49:3: note: FIX-IT applied suggested code changes
 cmake-use-cmsys-fstream.cxx:50:3: warning: use cmsys::ofstream [cmake-use-cmsys-fstream]
-  ns::ofstream ofsNS;
-  ^~~~~~~~~~~~
-  cmsys::ofstream
+   50 |   ns::ofstream ofsNS;
+      |   ^~~~~~~~~~~~
+      |   cmsys::ofstream
 cmake-use-cmsys-fstream.cxx:50:3: note: FIX-IT applied suggested code changes
 cmake-use-cmsys-fstream.cxx:51:3: warning: use cmsys::ofstream [cmake-use-cmsys-fstream]
-  ns::ns::ofstream ofsNested;
-  ^~~~~~~~~~~~~~~~
-  cmsys::ofstream
+   51 |   ns::ns::ofstream ofsNested;
+      |   ^~~~~~~~~~~~~~~~
+      |   cmsys::ofstream
 cmake-use-cmsys-fstream.cxx:51:3: note: FIX-IT applied suggested code changes
 cmake-use-cmsys-fstream.cxx:52:3: warning: use cmsys::ofstream [cmake-use-cmsys-fstream]
-  ns::cl::ofstream ofsClass;
-  ^~~~~~~~~~~~~~~~
-  cmsys::ofstream
+   52 |   ns::cl::ofstream ofsClass;
+      |   ^~~~~~~~~~~~~~~~
+      |   cmsys::ofstream
 cmake-use-cmsys-fstream.cxx:52:3: note: FIX-IT applied suggested code changes
 cmake-use-cmsys-fstream.cxx:53:3: warning: use cmsys::ofstream [cmake-use-cmsys-fstream]
-  ns::ofs ofsRenamed;
-  ^~~~~~~
-  cmsys::ofstream
+   53 |   ns::ofs ofsRenamed;
+      |   ^~~~~~~
+      |   cmsys::ofstream
 cmake-use-cmsys-fstream.cxx:53:3: note: FIX-IT applied suggested code changes
 cmake-use-cmsys-fstream.cxx:55:3: warning: use cmsys::fstream [cmake-use-cmsys-fstream]
-  fstream fsUnqual;
-  ^~~~~~~
-  cmsys::fstream
+   55 |   fstream fsUnqual;
+      |   ^~~~~~~
+      |   cmsys::fstream
 cmake-use-cmsys-fstream.cxx:55:3: note: FIX-IT applied suggested code changes
 cmake-use-cmsys-fstream.cxx:56:3: warning: use cmsys::fstream [cmake-use-cmsys-fstream]
-  std::fstream fsQual;
-  ^~~~~~~~~~~~
-  cmsys::fstream
+   56 |   std::fstream fsQual;
+      |   ^~~~~~~~~~~~
+      |   cmsys::fstream
 cmake-use-cmsys-fstream.cxx:56:3: note: FIX-IT applied suggested code changes
 cmake-use-cmsys-fstream.cxx:57:3: warning: use cmsys::fstream [cmake-use-cmsys-fstream]
-  ns::fstream fsNS;
-  ^~~~~~~~~~~
-  cmsys::fstream
+   57 |   ns::fstream fsNS;
+      |   ^~~~~~~~~~~
+      |   cmsys::fstream
 cmake-use-cmsys-fstream.cxx:57:3: note: FIX-IT applied suggested code changes
 cmake-use-cmsys-fstream.cxx:58:3: warning: use cmsys::fstream [cmake-use-cmsys-fstream]
-  ns::ns::fstream fsNested;
-  ^~~~~~~~~~~~~~~
-  cmsys::fstream
+   58 |   ns::ns::fstream fsNested;
+      |   ^~~~~~~~~~~~~~~
+      |   cmsys::fstream
 cmake-use-cmsys-fstream.cxx:58:3: note: FIX-IT applied suggested code changes
 cmake-use-cmsys-fstream.cxx:59:3: warning: use cmsys::fstream [cmake-use-cmsys-fstream]
-  ns::ns::fstream fsClass;
-  ^~~~~~~~~~~~~~~
-  cmsys::fstream
+   59 |   ns::ns::fstream fsClass;
+      |   ^~~~~~~~~~~~~~~
+      |   cmsys::fstream
 cmake-use-cmsys-fstream.cxx:59:3: note: FIX-IT applied suggested code changes
 cmake-use-cmsys-fstream.cxx:60:3: warning: use cmsys::fstream [cmake-use-cmsys-fstream]
-  ns::fs fsRenamed;
-  ^~~~~~
-  cmsys::fstream
+   60 |   ns::fs fsRenamed;
+      |   ^~~~~~
+      |   cmsys::fstream
 cmake-use-cmsys-fstream.cxx:60:3: note: FIX-IT applied suggested code changes
 cmake-use-cmsys-fstream.cxx:62:3: warning: use cmsys::ifstream [cmake-use-cmsys-fstream]
-  std::ifstream::off_type offsetQual = 0;
-  ^~~~~~~~~~~~~
-  cmsys::ifstream
+   62 |   std::ifstream::off_type offsetQual = 0;
+      |   ^~~~~~~~~~~~~
+      |   cmsys::ifstream
 cmake-use-cmsys-fstream.cxx:62:3: note: FIX-IT applied suggested code changes
 cmake-use-cmsys-fstream.cxx:63:3: warning: use cmsys::ifstream [cmake-use-cmsys-fstream]
-  ifstream::off_type offsetUnqual = 0;
-  ^~~~~~~~
-  cmsys::ifstream
+   63 |   ifstream::off_type offsetUnqual = 0;
+      |   ^~~~~~~~
+      |   cmsys::ifstream
 cmake-use-cmsys-fstream.cxx:63:3: note: FIX-IT applied suggested code changes
 cmake-use-cmsys-fstream.cxx:64:3: warning: use cmsys::ifstream [cmake-use-cmsys-fstream]
-  ns::ifstream::off_type offsetNS = 0;
-  ^~~~~~~~~~~~
-  cmsys::ifstream
+   64 |   ns::ifstream::off_type offsetNS = 0;
+      |   ^~~~~~~~~~~~
+      |   cmsys::ifstream
 cmake-use-cmsys-fstream.cxx:64:3: note: FIX-IT applied suggested code changes
 cmake-use-cmsys-fstream.cxx:65:3: warning: use cmsys::ifstream [cmake-use-cmsys-fstream]
-  ns::ns::ifstream::off_type offsetNested = 0;
-  ^~~~~~~~~~~~~~~~
-  cmsys::ifstream
+   65 |   ns::ns::ifstream::off_type offsetNested = 0;
+      |   ^~~~~~~~~~~~~~~~
+      |   cmsys::ifstream
 cmake-use-cmsys-fstream.cxx:65:3: note: FIX-IT applied suggested code changes
 cmake-use-cmsys-fstream.cxx:66:3: warning: use cmsys::ifstream [cmake-use-cmsys-fstream]
-  ns::ns::ifstream::traits_type::off_type offsetTraitsNested = 0;
-  ^~~~~~~~~~~~~~~~
-  cmsys::ifstream
+   66 |   ns::ns::ifstream::traits_type::off_type offsetTraitsNested = 0;
+      |   ^~~~~~~~~~~~~~~~
+      |   cmsys::ifstream
 cmake-use-cmsys-fstream.cxx:66:3: note: FIX-IT applied suggested code changes
 cmake-use-cmsys-fstream.cxx:67:3: warning: use cmsys::ifstream [cmake-use-cmsys-fstream]
-  ns::cl::ifstream::traits_type::off_type offsetTraitsClass = 0;
-  ^~~~~~~~~~~~~~~~
-  cmsys::ifstream
+   67 |   ns::cl::ifstream::traits_type::off_type offsetTraitsClass = 0;
+      |   ^~~~~~~~~~~~~~~~
+      |   cmsys::ifstream
 cmake-use-cmsys-fstream.cxx:67:3: note: FIX-IT applied suggested code changes
 cmake-use-cmsys-fstream.cxx:69:15: warning: use cmsys::ifstream [cmake-use-cmsys-fstream]
-  std::vector<ifstream> ifsVectorUnqual;
-              ^~~~~~~~
-              cmsys::ifstream
+   69 |   std::vector<ifstream> ifsVectorUnqual;
+      |               ^~~~~~~~
+      |               cmsys::ifstream
 cmake-use-cmsys-fstream.cxx:69:15: note: FIX-IT applied suggested code changes
diff --git a/Utilities/ClangTidyModule/Tests/cmake-use-pragma-once-stdout.txt b/Utilities/ClangTidyModule/Tests/cmake-use-pragma-once-stdout.txt
index e80e4a4..17c1345 100644
--- a/Utilities/ClangTidyModule/Tests/cmake-use-pragma-once-stdout.txt
+++ b/Utilities/ClangTidyModule/Tests/cmake-use-pragma-once-stdout.txt
@@ -1,25 +1,46 @@
 cmake-use-pragma-once/cmake-use-pragma-once-both.h:1:1: warning: use #pragma once [cmake-use-pragma-once]
-#ifndef BOTH_H
-^~~~~~~~~~~~~~
+    1 | #ifndef BOTH_H
+      | ^~~~~~~~~~~~~~
+    2 | #define BOTH_H
+      | ~~~~~~~~~~~~~~
+    3 | #pragma once
+    4 |
+    5 | int both()
+    6 | {
+    7 |   return 0;
+    8 | }
+    9 |
+   10 | #endif
+      | ~~~~~~
 cmake-use-pragma-once/cmake-use-pragma-once-both.h:1:1: note: FIX-IT applied suggested code changes
 cmake-use-pragma-once/cmake-use-pragma-once-both.h:2:1: note: FIX-IT applied suggested code changes
-#define BOTH_H
-^
+    2 | #define BOTH_H
+      | ^
 cmake-use-pragma-once/cmake-use-pragma-once-both.h:10:1: note: FIX-IT applied suggested code changes
-#endif
-^
+   10 | #endif
+      | ^
 cmake-use-pragma-once/cmake-use-pragma-once-include-guards.h:1:1: warning: use #pragma once [cmake-use-pragma-once]
-#ifndef INCLUDE_GUARDS_H
-^~~~~~~~~~~~~~~~~~~~~~~~
-#pragma once
+    1 | #ifndef INCLUDE_GUARDS_H
+      | ^~~~~~~~~~~~~~~~~~~~~~~~
+      | #pragma once
+    2 | #define INCLUDE_GUARDS_H
+      | ~~~~~~~~~~~~~~~~~~~~~~~~
+    3 |
+    4 | int includeGuards()
+    5 | {
+    6 |   return 0;
+    7 | }
+    8 |
+    9 | #endif
+      | ~~~~~~
 cmake-use-pragma-once/cmake-use-pragma-once-include-guards.h:1:1: note: FIX-IT applied suggested code changes
 cmake-use-pragma-once/cmake-use-pragma-once-include-guards.h:2:1: note: FIX-IT applied suggested code changes
-#define INCLUDE_GUARDS_H
-^
+    2 | #define INCLUDE_GUARDS_H
+      | ^
 cmake-use-pragma-once/cmake-use-pragma-once-include-guards.h:9:1: note: FIX-IT applied suggested code changes
-#endif
-^
+    9 | #endif
+      | ^
 cmake-use-pragma-once/cmake-use-pragma-once-neither.h:1:1: warning: use #pragma once [cmake-use-pragma-once]
-int neither()
-^
+    1 | int neither()
+      | ^
 cmake-use-pragma-once/cmake-use-pragma-once-neither.h:1:1: note: FIX-IT applied suggested code changes
diff --git a/Utilities/ClangTidyModule/UsePragmaOnceCheck.h b/Utilities/ClangTidyModule/UsePragmaOnceCheck.h
index 08c2099..325f643 100644
--- a/Utilities/ClangTidyModule/UsePragmaOnceCheck.h
+++ b/Utilities/ClangTidyModule/UsePragmaOnceCheck.h
@@ -18,6 +18,16 @@
 #include <clang-tidy/ClangTidyCheck.h>
 #include <clang-tidy/utils/FileExtensionsUtils.h>
 
+#if LLVM_VERSION_MAJOR >= 17
+#  include <clang-tidy/FileExtensionsSet.h>
+#else
+namespace clang {
+namespace tidy {
+using utils::FileExtensionsSet;
+} // namespace tidy
+} // namespace clang
+#endif
+
 namespace clang {
 namespace tidy {
 namespace cmake {
@@ -52,7 +62,7 @@ public:
 
 private:
   std::string RawStringHeaderFileExtensions;
-  utils::FileExtensionsSet HeaderFileExtensions;
+  FileExtensionsSet HeaderFileExtensions;
 };
 
 } // namespace cmake
-- 
cgit v0.12