[Modules] Enable local submodule visibility for ObjC/C
authorBruno Cardoso Lopes <bruno.cardoso@gmail.com>
Wed, 12 Apr 2017 21:46:16 +0000 (21:46 +0000)
committerBruno Cardoso Lopes <bruno.cardoso@gmail.com>
Wed, 12 Apr 2017 21:46:16 +0000 (21:46 +0000)
Remove the restriction where this is only valid with C++

rdar://problem/29055656

Differential Revision: https://reviews.llvm.org/D31781

llvm-svn: 300108

clang/lib/Frontend/CompilerInvocation.cpp
clang/test/Modules/localsubmodulevis.m [new file with mode: 0644]

index 1ebaf8f..ab9f203 100644 (file)
@@ -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<unsigned>(A->getValue())
       .Case("target", LangOptions::ASMM_Target)
diff --git a/clang/test/Modules/localsubmodulevis.m b/clang/test/Modules/localsubmodulevis.m
new file mode 100644 (file)
index 0000000..f8c4b3c
--- /dev/null
@@ -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"
+