diff options
author | Ben Langmuir <blangmuir@apple.com> | 2014-07-23 15:30:23 +0000 |
---|---|---|
committer | Ben Langmuir <blangmuir@apple.com> | 2014-07-23 15:30:23 +0000 |
commit | ad4bdd534b6c441428bea75bc3d0c0cdf655c083 (patch) | |
tree | 720ef992d4300bb4e6844c95dedf2845f26f88da /include | |
parent | d33130402939b8fec404b8b34ad3377594e26352 (diff) |
Add stopgap option -fmodule-implementation-of <name>
This flag specifies that we are building an implementation file of the
module <name>, preventing importing <name> as a module. This does not
consider this to be the 'current module' for the purposes of doing
modular checks like decluse or non-modular-include warnings, unlike
-fmodule-name.
This is needed as a stopgap until:
1) we can resolve relative includes to a VFS-mapped module (or can
safely import a header textually and as part of a module)
and ideally
2) we can safely do incremental rebuilding when implementation files
import submodules.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@213767 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r-- | include/clang/Basic/DiagnosticFrontendKinds.td | 4 | ||||
-rw-r--r-- | include/clang/Basic/DiagnosticSemaKinds.td | 2 | ||||
-rw-r--r-- | include/clang/Basic/LangOptions.h | 5 | ||||
-rw-r--r-- | include/clang/Driver/CC1Options.td | 3 |
4 files changed, 14 insertions, 0 deletions
diff --git a/include/clang/Basic/DiagnosticFrontendKinds.td b/include/clang/Basic/DiagnosticFrontendKinds.td index ab0c6cfb1b..bbe0fa730e 100644 --- a/include/clang/Basic/DiagnosticFrontendKinds.td +++ b/include/clang/Basic/DiagnosticFrontendKinds.td @@ -178,6 +178,10 @@ def note_module_def_undef_here : Note< def remark_module_build : Remark<"building module '%0' as '%1'">, InGroup<DiagGroup<"module-build">>, DefaultIgnore; +def err_conflicting_module_names : Error< + "conflicting module names specified: '-fmodule-name=%0' and " + "'-fmodule-implementation-of %1'">; + def err_missing_vfs_overlay_file : Error< "virtual filesystem overlay file '%0' not found">, DefaultFatal; def err_invalid_vfs_overlay : Error< diff --git a/include/clang/Basic/DiagnosticSemaKinds.td b/include/clang/Basic/DiagnosticSemaKinds.td index 6d781f9714..85072f1d15 100644 --- a/include/clang/Basic/DiagnosticSemaKinds.td +++ b/include/clang/Basic/DiagnosticSemaKinds.td @@ -7212,6 +7212,8 @@ def err_module_import_not_at_top_level : Error< def note_module_import_not_at_top_level : Note<"%0 begins here">; def err_module_self_import : Error< "import of module '%0' appears within same top-level module '%1'">; +def err_module_import_in_implementation : Error< + "@import of module '%0' in implementation of '%1'; use #import">; } let CategoryName = "Documentation Issue" in { diff --git a/include/clang/Basic/LangOptions.h b/include/clang/Basic/LangOptions.h index 9bffc7cb18..fb406a2ed3 100644 --- a/include/clang/Basic/LangOptions.h +++ b/include/clang/Basic/LangOptions.h @@ -88,6 +88,11 @@ public: /// \brief The name of the current module. std::string CurrentModule; + /// \brief The name of the module that the translation unit is an + /// implementation of. Prevents semantic imports, but does not otherwise + /// treat this as the CurrentModule. + std::string ImplementationOfModule; + /// \brief Options for parsing comments. CommentOptions CommentOpts; diff --git a/include/clang/Driver/CC1Options.td b/include/clang/Driver/CC1Options.td index d25560c9f3..c3685e0f30 100644 --- a/include/clang/Driver/CC1Options.td +++ b/include/clang/Driver/CC1Options.td @@ -327,6 +327,9 @@ def fno_modules_global_index : Flag<["-"], "fno-modules-global-index">, HelpText<"Do not automatically generate or update the global module index">; def fno_modules_error_recovery : Flag<["-"], "fno-modules-error-recovery">, HelpText<"Do not automatically import modules for error recovery">; +def fmodule_implementation_of : Separate<["-"], "fmodule-implementation-of">, + MetaVarName<"<name>">, + HelpText<"Specify the name of the module whose implementation file this is">; let Group = Action_Group in { |