diff options
author | Bruno Cardoso Lopes <bruno.cardoso@gmail.com> | 2016-10-21 01:41:56 +0000 |
---|---|---|
committer | Bruno Cardoso Lopes <bruno.cardoso@gmail.com> | 2016-10-21 01:41:56 +0000 |
commit | ed84df008f609f7245871a9b6d00b57cb19410aa (patch) | |
tree | f1023c080423e162cdcdc393264e04ad853ce7b0 /clang/include | |
parent | d15477b09d3142b4301f6e7bc8835ec04d639f59 (diff) | |
download | bcm5719-llvm-ed84df008f609f7245871a9b6d00b57cb19410aa.tar.gz bcm5719-llvm-ed84df008f609f7245871a9b6d00b57cb19410aa.zip |
[Modules] Add 'no_undeclared_includes' module map attribute
The 'no_undeclared_includes' attribute should be used in a module to
tell that only non-modular headers and headers from used modules are
accepted.
The main motivation behind this is to prevent dep cycles between system
libraries (such as darwin) and libc++.
Patch by Richard Smith!
llvm-svn: 284797
Diffstat (limited to 'clang/include')
-rw-r--r-- | clang/include/clang/Basic/Module.h | 4 | ||||
-rw-r--r-- | clang/include/clang/Lex/HeaderSearch.h | 6 | ||||
-rw-r--r-- | clang/include/clang/Lex/ModuleMap.h | 14 |
3 files changed, 20 insertions, 4 deletions
diff --git a/clang/include/clang/Basic/Module.h b/clang/include/clang/Basic/Module.h index 1702fb1114d..31c5c7ec9ca 100644 --- a/clang/include/clang/Basic/Module.h +++ b/clang/include/clang/Basic/Module.h @@ -201,6 +201,10 @@ public: /// built. unsigned ConfigMacrosExhaustive : 1; + /// \brief Whether files in this module can only include non-modular headers + /// and headers from used modules. + unsigned NoUndeclaredIncludes : 1; + /// \brief Describes the visibility of the various names within a /// particular module. enum NameVisibilityKind { diff --git a/clang/include/clang/Lex/HeaderSearch.h b/clang/include/clang/Lex/HeaderSearch.h index 800facbcebf..faba6619511 100644 --- a/clang/include/clang/Lex/HeaderSearch.h +++ b/clang/include/clang/Lex/HeaderSearch.h @@ -523,8 +523,10 @@ public: /// \brief Retrieve the module that corresponds to the given file, if any. /// /// \param File The header that we wish to map to a module. - ModuleMap::KnownHeader findModuleForHeader(const FileEntry *File) const; - + /// \param AllowTextual Whether we want to find textual headers too. + ModuleMap::KnownHeader findModuleForHeader(const FileEntry *File, + bool AllowTextual = false) const; + /// \brief Read the contents of the given module map file. /// /// \param File The module map file. diff --git a/clang/include/clang/Lex/ModuleMap.h b/clang/include/clang/Lex/ModuleMap.h index 8a704db2cda..4288a4f506c 100644 --- a/clang/include/clang/Lex/ModuleMap.h +++ b/clang/include/clang/Lex/ModuleMap.h @@ -171,7 +171,8 @@ private: /// \brief The set of attributes that can be attached to a module. struct Attributes { - Attributes() : IsSystem(), IsExternC(), IsExhaustive() {} + Attributes() + : IsSystem(), IsExternC(), IsExhaustive(), NoUndeclaredIncludes() {} /// \brief Whether this is a system module. unsigned IsSystem : 1; @@ -181,6 +182,10 @@ private: /// \brief Whether this is an exhaustive set of configuration macros. unsigned IsExhaustive : 1; + + /// \brief Whether files in this module can only include non-modular headers + /// and headers from used modules. + unsigned NoUndeclaredIncludes : 1; }; /// \brief A directory for which framework modules can be inferred. @@ -315,10 +320,15 @@ public: /// /// \param File The header file that is likely to be included. /// + /// \param AllowTextual If \c true and \p File is a textual header, return + /// its owning module. Otherwise, no KnownHeader will be returned if the + /// file is only known as a textual header. + /// /// \returns The module KnownHeader, which provides the module that owns the /// given header file. The KnownHeader is default constructed to indicate /// that no module owns this header file. - KnownHeader findModuleForHeader(const FileEntry *File); + KnownHeader findModuleForHeader(const FileEntry *File, + bool AllowTextual = false); /// \brief Retrieve all the modules that contain the given header file. This /// may not include umbrella modules, nor information from external sources, |