From e166f7f908c171f5334637a58ae064555d9eb246 Mon Sep 17 00:00:00 2001 From: Ben Langmuir Date: Thu, 9 Jan 2014 20:53:49 +0000 Subject: [PATCH] Preserve -fretain-comments-from-system-headers in modules Preserves the setting of -fretain-comments-from-system-headers when building/saving/loading module files. This allows code completion to pick up documentation comments from system modules. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@198890 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/clang/Basic/LangOptions.def | 2 +- .../Inputs/retain-comments-from-system-headers-module.map | 4 ++++ test/Index/retain-comments-from-system-headers.c | 5 ++++- 3 files changed, 9 insertions(+), 2 deletions(-) create mode 100644 test/Index/Inputs/retain-comments-from-system-headers-module.map diff --git a/include/clang/Basic/LangOptions.def b/include/clang/Basic/LangOptions.def index 5a1025cba7..cbde6e27c2 100644 --- a/include/clang/Basic/LangOptions.def +++ b/include/clang/Basic/LangOptions.def @@ -178,7 +178,7 @@ VALUE_LANGOPT(MSCVersion, 32, 0, LANGOPT(ApplePragmaPack, 1, 0, "Apple gcc-compatible #pragma pack handling") -BENIGN_LANGOPT(RetainCommentsFromSystemHeaders, 1, 0, "retain documentation comments from system headers in the AST") +LANGOPT(RetainCommentsFromSystemHeaders, 1, 0, "retain documentation comments from system headers in the AST") #undef LANGOPT #undef VALUE_LANGOPT diff --git a/test/Index/Inputs/retain-comments-from-system-headers-module.map b/test/Index/Inputs/retain-comments-from-system-headers-module.map new file mode 100644 index 0000000000..0b77f3c1ab --- /dev/null +++ b/test/Index/Inputs/retain-comments-from-system-headers-module.map @@ -0,0 +1,4 @@ +module retain_comments_from_system_headers { + header "retain-comments-from-system-headers.h" + export * +} diff --git a/test/Index/retain-comments-from-system-headers.c b/test/Index/retain-comments-from-system-headers.c index 67a0fd05f5..bc6021ffbf 100644 --- a/test/Index/retain-comments-from-system-headers.c +++ b/test/Index/retain-comments-from-system-headers.c @@ -11,9 +11,12 @@ int user_function(int a); // RUN: c-index-test -test-load-source all %s -I %S/Inputs | FileCheck %s // RUN: c-index-test -test-load-source all %s -fretain-comments-from-system-headers -I %S/Inputs | FileCheck %s -check-prefix=CHECK-RETAIN +// Modules: +// RUN: c-index-test -test-load-source all %s -I %S/Inputs -fmodules -fmodules-cache-path=%t/cache -fmodule-map-file=%S/Inputs/retain-comments-from-system-headers-module.map | FileCheck %s -check-prefix=CHECK +// RUN: c-index-test -test-load-source all %s -fretain-comments-from-system-headers -I %S/Inputs -fmodules -fmodules-cache-path=%t/cache -fmodule-map-file=%S/Inputs/retain-comments-from-system-headers-module.map | FileCheck %s -check-prefix=CHECK-RETAIN + // CHECK: retain-comments-from-system-headers.h:7:5: FunctionDecl=system_function:7:5 Extent=[7:1 - 7:27] // CHECK: retain-comments-from-system-headers.c:9:5: FunctionDecl=user_function:9:5 RawComment=[/**\n * user_function\n * \param a Aaa.\n */] RawCommentRange=[5:1 - 8:4] BriefComment=[user_function] // CHECK-RETAIN: retain-comments-from-system-headers.h:7:5: FunctionDecl=system_function:7:5 RawComment=[/**\n * system_function\n * \param a Aaa.\n */] RawCommentRange=[3:1 - 6:4] BriefComment=[system_function] // CHECK-RETAIN: retain-comments-from-system-headers.c:9:5: FunctionDecl=user_function:9:5 RawComment=[/**\n * user_function\n * \param a Aaa.\n */] RawCommentRange=[5:1 - 8:4] BriefComment=[user_function] - -- 2.40.0