[clang] [clang-format] Option to ignore PP directives (PR #70338)

via cfe-commits cfe-commits at lists.llvm.org
Fri Oct 27 05:10:33 PDT 2023


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 ba11d314a67638454989d4e0aebae64145d1a8ac 228301b783fe365bb01cc8b7ba122ed9845c9a37 -- clang/include/clang/Format/Format.h clang/lib/Format/Format.cpp clang/lib/Format/UnwrappedLineFormatter.cpp clang/lib/Format/UnwrappedLineParser.cpp clang/unittests/Format/ConfigParseTest.cpp clang/unittests/Format/FormatTest.cpp
``````````

</details>

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

``````````diff
diff --git a/clang/include/clang/Format/Format.h b/clang/include/clang/Format/Format.h
index 57880fc28c23..e59ac2407105 100644
--- a/clang/include/clang/Format/Format.h
+++ b/clang/include/clang/Format/Format.h
@@ -4647,7 +4647,7 @@ struct FormatStyle {
   /// For example: BOOST_PP_STRINGIZE
   /// \version 11
   std::vector<std::string> WhitespaceSensitiveMacros;
-    
+
   /// Ignore formatting in preprocessor definitions.
   /// \version 18
   bool IgnorePPDefinitions;
diff --git a/clang/lib/Format/UnwrappedLineParser.cpp b/clang/lib/Format/UnwrappedLineParser.cpp
index b9a41797a8b2..07cf966a08ff 100644
--- a/clang/lib/Format/UnwrappedLineParser.cpp
+++ b/clang/lib/Format/UnwrappedLineParser.cpp
@@ -1133,8 +1133,8 @@ void UnwrappedLineParser::parsePPDefine() {
     parsePPUnknown();
     return;
   }
-    
-  if(Style.IgnorePPDefinitions){
+
+  if (Style.IgnorePPDefinitions) {
     do {
       nextToken();
     } while (!eof());

``````````

</details>


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


More information about the cfe-commits mailing list