[clang] [clang-format] Option to ignore macro definitions (PR #70338)

Owen Pan via cfe-commits cfe-commits at lists.llvm.org
Wed Nov 29 16:21:42 PST 2023


================
@@ -1157,7 +1157,15 @@ void UnwrappedLineParser::parsePPDefine() {
   // guard processing above, and changes preprocessing nesting.
   FormatTok->Tok.setKind(tok::identifier);
   FormatTok->Tok.setIdentifierInfo(Keywords.kw_internal_ident_after_define);
-  nextToken();
+
+  if (Style.SkipMacroDefinitionBody) {
+    do {
+      nextToken();
+    } while (!eof());
+  } else {
+    nextToken();
+  }
----------------
owenca wrote:

Instead, we can simply mark the tokens `Finalized` (after `Line->InMacroBody` is set to `true` below) so that the continuation indenter can be left alone.

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


More information about the cfe-commits mailing list