From 5e8a35ff84263fd2636595b2cb65054c538a78a2 Mon Sep 17 00:00:00 2001 From: Bruno Cardoso Lopes Date: Wed, 12 Apr 2017 21:46:16 +0000 Subject: [PATCH] [Modules] Enable local submodule visibility for ObjC/C Remove the restriction where this is only valid with C++ rdar://problem/29055656 Differential Revision: https://reviews.llvm.org/D31781 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@300108 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Frontend/CompilerInvocation.cpp | 6 ------ test/Modules/localsubmodulevis.m | 8 ++++++++ 2 files changed, 8 insertions(+), 6 deletions(-) create mode 100644 test/Modules/localsubmodulevis.m diff --git a/lib/Frontend/CompilerInvocation.cpp b/lib/Frontend/CompilerInvocation.cpp index 1ebaf8f4d8..ab9f20304c 100644 --- a/lib/Frontend/CompilerInvocation.cpp +++ b/lib/Frontend/CompilerInvocation.cpp @@ -2117,12 +2117,6 @@ static void ParseLangArgs(LangOptions &Opts, ArgList &Args, InputKind IK, Args.hasFlag(OPT_fdeclspec, OPT_fno_declspec, (Opts.MicrosoftExt || Opts.Borland || Opts.CUDA)); - // For now, we only support local submodule visibility in C++ (because we - // heavily depend on the ODR for merging redefinitions). - if (Opts.ModulesLocalVisibility && !Opts.CPlusPlus) - Diags.Report(diag::err_drv_argument_not_allowed_with) - << "-fmodules-local-submodule-visibility" << "C"; - if (Arg *A = Args.getLastArg(OPT_faddress_space_map_mangling_EQ)) { switch (llvm::StringSwitch(A->getValue()) .Case("target", LangOptions::ASMM_Target) diff --git a/test/Modules/localsubmodulevis.m b/test/Modules/localsubmodulevis.m new file mode 100644 index 0000000000..f8c4b3c755 --- /dev/null +++ b/test/Modules/localsubmodulevis.m @@ -0,0 +1,8 @@ +// RUN: rm -rf %t +// RUN: %clang_cc1 -fmodules -fmodules-local-submodule-visibility -fimplicit-module-maps -fmodules-cache-path=%t.a -I %S/Inputs/preprocess -verify %s +// RUN: %clang_cc1 -fmodules -fmodules-local-submodule-visibility -fimplicit-module-maps -fmodules-cache-path=%t.b -I %S/Inputs/preprocess -x c -verify -x c %s + +// expected-no-diagnostics + +#include "file.h" + -- 2.40.0