aboutsummaryrefslogtreecommitdiff
path: root/include/clang/Basic
diff options
context:
space:
mode:
Diffstat (limited to 'include/clang/Basic')
-rw-r--r--include/clang/Basic/DiagnosticLexKinds.td14
-rw-r--r--include/clang/Basic/Module.h43
2 files changed, 51 insertions, 6 deletions
diff --git a/include/clang/Basic/DiagnosticLexKinds.td b/include/clang/Basic/DiagnosticLexKinds.td
index 70951a6531..286a7ef40e 100644
--- a/include/clang/Basic/DiagnosticLexKinds.td
+++ b/include/clang/Basic/DiagnosticLexKinds.td
@@ -384,7 +384,7 @@ def err_mmap_expected_lbrace : Error<"expected '{' to start module '%0'">;
def err_mmap_expected_rbrace : Error<"expected '}'">;
def note_mmap_lbrace_match : Note<"to match this '{'">;
def err_mmap_expected_member : Error<
- "expected umbrella header, header, or submodule">;
+ "expected umbrella header, header, submodule, or module export">;
def err_mmap_expected_header : Error<"expected a header name after '%0'">;
def err_mmap_module_redefinition : Error<
"redefinition of module '%0'">;
@@ -405,6 +405,18 @@ def err_mmap_missing_module_unqualified : Error<
"no module named '%0' visible from '%1'">;
def err_mmap_missing_module_qualified : Error<
"no module named '%0' in '%1'">;
+def err_mmap_top_level_inferred_submodule : Error<
+ "only submodules may be inferred with wildcard syntax">;
+def err_mmap_inferred_no_umbrella : Error<
+ "inferred submodules require a module with an umbrella header">;
+def err_mmap_inferred_redef : Error<
+ "redefinition of inferred submodule">;
+def err_mmap_expected_lbrace_wildcard : Error<
+ "expected '{' to start inferred submodule">;
+def err_mmap_expected_wildcard_member : Error<
+ "expected module export wildcard">;
+def err_mmap_expected_export_wildcard : Error<
+ "only '*' can be exported from an inferred submodule">;
def warn_auto_module_import : Warning<
"treating #%select{include|import|include_next|__include_macros}0 as an "
diff --git a/include/clang/Basic/Module.h b/include/clang/Basic/Module.h
index af41d69adf..26a0b28182 100644
--- a/include/clang/Basic/Module.h
+++ b/include/clang/Basic/Module.h
@@ -59,10 +59,24 @@ public:
llvm::SmallVector<const FileEntry *, 2> Headers;
/// \brief Whether this is a framework module.
- bool IsFramework;
+ unsigned IsFramework : 1;
/// \brief Whether this is an explicit submodule.
- bool IsExplicit;
+ unsigned IsExplicit : 1;
+
+ /// \brief Whether we should infer submodules for this module based on
+ /// the headers.
+ ///
+ /// Submodules can only be inferred for modules with an umbrella header.
+ unsigned InferSubmodules : 1;
+
+ /// \brief Whether, when inferring submodules, the inferred submodules
+ /// should be explicit.
+ unsigned InferExplicitSubmodules : 1;
+
+ /// \brief Whether, when inferring submodules, the inferr submodules should
+ /// export all modules they import (e.g., the equivalent of "export *").
+ unsigned InferExportWildcard : 1;
/// \brief Describes the visibility of the various names within a
/// particular module.
@@ -79,6 +93,9 @@ public:
///\ brief The visibility of names within this particular module.
NameVisibilityKind NameVisibility;
+ /// \brief The location of the inferred submodule.
+ SourceLocation InferredSubmoduleLoc;
+
/// \brief The set of modules imported by this module, and on which this
/// module depends.
llvm::SmallVector<Module *, 2> Imports;
@@ -114,14 +131,17 @@ public:
explicit Module(StringRef Name, SourceLocation DefinitionLoc,
bool IsFramework)
: Name(Name), DefinitionLoc(DefinitionLoc), Parent(0), UmbrellaHeader(0),
- IsFramework(IsFramework), IsExplicit(false), NameVisibility(Hidden) { }
+ IsFramework(IsFramework), IsExplicit(false), InferSubmodules(false),
+ InferExplicitSubmodules(false), InferExportWildcard(false),
+ NameVisibility(Hidden) { }
/// \brief Construct a new module or submodule.
Module(StringRef Name, SourceLocation DefinitionLoc, Module *Parent,
bool IsFramework, bool IsExplicit)
: Name(Name), DefinitionLoc(DefinitionLoc), Parent(Parent),
UmbrellaHeader(0), IsFramework(IsFramework), IsExplicit(IsExplicit),
- NameVisibility(Hidden) { }
+ InferSubmodules(false), InferExplicitSubmodules(false),
+ InferExportWildcard(false),NameVisibility(Hidden) { }
~Module();
@@ -146,10 +166,23 @@ public:
/// \brief Retrieve the full name of this module, including the path from
/// its top-level module.
std::string getFullModuleName() const;
+
+ /// \brief Retrieve the top-level module for this (sub)module, which may
+ /// be this module.
+ Module *getTopLevelModule() {
+ return const_cast<Module *>(
+ const_cast<const Module *>(this)->getTopLevelModule());
+ }
+
+ /// \brief Retrieve the top-level module for this (sub)module, which may
+ /// be this module.
+ const Module *getTopLevelModule() const;
/// \brief Retrieve the name of the top-level module.
///
- StringRef getTopLevelModuleName() const;
+ StringRef getTopLevelModuleName() const {
+ return getTopLevelModule()->Name;
+ }
/// \brief Print the module map for this module to the given stream.
///