diff options
Diffstat (limited to 'include/clang/Basic')
-rw-r--r-- | include/clang/Basic/DiagnosticLexKinds.td | 6 | ||||
-rw-r--r-- | include/clang/Basic/Module.h | 33 |
2 files changed, 39 insertions, 0 deletions
diff --git a/include/clang/Basic/DiagnosticLexKinds.td b/include/clang/Basic/DiagnosticLexKinds.td index ccfa3216c1..70951a6531 100644 --- a/include/clang/Basic/DiagnosticLexKinds.td +++ b/include/clang/Basic/DiagnosticLexKinds.td @@ -399,6 +399,12 @@ def err_mmap_umbrella_header_submodule : Error< "submodule '%0' can not have an umbrella header">; def err_mmap_umbrella_clash : Error< "umbrella header for module '%0' already covers this directory">; +def err_mmap_export_module_id : Error< + "expected an exported module name or '*'">; +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 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 4eaa1be291..43edcfacec 100644 --- a/include/clang/Basic/Module.h +++ b/include/clang/Basic/Module.h @@ -15,10 +15,12 @@ #define LLVM_CLANG_BASIC_MODULE_H #include "clang/Basic/SourceLocation.h" +#include "llvm/ADT/PointerIntPair.h" #include "llvm/ADT/SmallVector.h" #include "llvm/ADT/StringMap.h" #include "llvm/ADT/StringRef.h" #include <string> +#include <utility> namespace llvm { class raw_ostream; @@ -28,6 +30,10 @@ namespace clang { class FileEntry; +/// \brief Describes the name of a module. +typedef llvm::SmallVector<std::pair<std::string, SourceLocation>, 2> + ModuleId; + /// \brief Describes a module or submodule. class Module { public: @@ -73,6 +79,33 @@ public: ///\ brief The visibility of names within this particular module. NameVisibilityKind NameVisibility; + /// \brief Describes an exported module. + /// + /// The pointer is the module being re-exported, while the bit will be true + /// to indicate that this is a wildcard export. + typedef llvm::PointerIntPair<Module *, 1, bool> ExportDecl; + + /// \brief The set of export declarations. + llvm::SmallVector<ExportDecl, 2> Exports; + + /// \brief Describes an exported module that has not yet been resolved + /// (perhaps because the module it refers to has not yet been loaded). + struct UnresolvedExportDecl { + /// \brief The location of the 'export' keyword in the module map file. + SourceLocation ExportLoc; + + /// \brief The name of the module. + ModuleId Id; + + /// \brief Whether this export declaration ends in a wildcard, indicating + /// that all of its submodules should be exported (rather than the named + /// module itself). + bool Wildcard; + }; + + /// \brief The set of export declarations that have yet to be resolved. + llvm::SmallVector<UnresolvedExportDecl, 2> UnresolvedExports; + /// \brief Construct a top-level module. explicit Module(StringRef Name, SourceLocation DefinitionLoc, bool IsFramework) |