[clang] d5cdc26 - [Clang] Mark RetainCommentsFromSystemHeaders as compatible language options
Chuanqi Xu via cfe-commits
cfe-commits at lists.llvm.org
Thu Oct 31 00:52:38 PDT 2024
Author: Chuanqi Xu
Date: 2024-10-31T15:52:18+08:00
New Revision: d5cdc26f555918e6f292f16ac3800afc97093aac
URL: https://github.com/llvm/llvm-project/commit/d5cdc26f555918e6f292f16ac3800afc97093aac
DIFF: https://github.com/llvm/llvm-project/commit/d5cdc26f555918e6f292f16ac3800afc97093aac.diff
LOG: [Clang] Mark RetainCommentsFromSystemHeaders as compatible language options
Motivated by comments in https://github.com/clangd/clangd/issues/1293
And RetainCommentsFromSystemHeaders shouldn't affect the compatibleness
anyway.
Added:
clang/test/Modules/diff-retain-comments-from-system-headers-flag.cppm
Modified:
clang/include/clang/Basic/LangOptions.def
Removed:
################################################################################
diff --git a/clang/include/clang/Basic/LangOptions.def b/clang/include/clang/Basic/LangOptions.def
index 942fc557c5b949..39e4851dd3814c 100644
--- a/clang/include/clang/Basic/LangOptions.def
+++ b/clang/include/clang/Basic/LangOptions.def
@@ -430,7 +430,7 @@ LANGOPT(ApplePragmaPack, 1, 0, "Apple gcc-compatible #pragma pack handling")
LANGOPT(XLPragmaPack, 1, 0, "IBM XL #pragma pack handling")
-LANGOPT(RetainCommentsFromSystemHeaders, 1, 0, "retain documentation comments from system headers in the AST")
+COMPATIBLE_LANGOPT(RetainCommentsFromSystemHeaders, 1, 0, "retain documentation comments from system headers in the AST")
LANGOPT(APINotes, 1, 0, "use external API notes")
LANGOPT(APINotesModules, 1, 0, "use module-based external API notes")
diff --git a/clang/test/Modules/
diff -retain-comments-from-system-headers-flag.cppm b/clang/test/Modules/
diff -retain-comments-from-system-headers-flag.cppm
new file mode 100644
index 00000000000000..5ea896d6ae268c
--- /dev/null
+++ b/clang/test/Modules/
diff -retain-comments-from-system-headers-flag.cppm
@@ -0,0 +1,13 @@
+// RUN: rm -rf %t
+// RUN: mkdir %t
+// RUN: split-file %s %t
+//
+// RUN: %clang_cc1 -std=c++20 %t/a.cppm -emit-module-interface -o %t/a.pcm -fretain-comments-from-system-headers
+// RUN: %clang_cc1 -std=c++20 %t/b.cpp -fmodule-file=a=%t/a.pcm -verify -fsyntax-only
+
+//--- a.cppm
+export module a;
+
+//--- b.cpp
+// expected-no-diagnostics
+import a;
More information about the cfe-commits
mailing list