diff options
Diffstat (limited to 'include/clang/Lex/HeaderSearch.h')
-rw-r--r-- | include/clang/Lex/HeaderSearch.h | 30 |
1 files changed, 21 insertions, 9 deletions
diff --git a/include/clang/Lex/HeaderSearch.h b/include/clang/Lex/HeaderSearch.h index 4334db7..8a5a798 100644 --- a/include/clang/Lex/HeaderSearch.h +++ b/include/clang/Lex/HeaderSearch.h @@ -18,10 +18,10 @@ #include "clang/Lex/ModuleMap.h" #include "llvm/ADT/ArrayRef.h" #include "llvm/ADT/IntrusiveRefCntPtr.h" +#include "llvm/ADT/OwningPtr.h" #include "llvm/ADT/StringMap.h" #include "llvm/ADT/StringSet.h" #include "llvm/Support/Allocator.h" -#include "llvm/ADT/OwningPtr.h" #include <vector> namespace clang { @@ -50,6 +50,9 @@ struct HeaderFileInfo { /// \brief Whether this header file info was supplied by an external source. unsigned External : 1; + + /// \brief Whether this header is part of a module. + unsigned isModuleHeader : 1; /// \brief Whether this structure is considered to already have been /// "resolved", meaning that it was loaded from the external source. @@ -90,7 +93,8 @@ struct HeaderFileInfo { HeaderFileInfo() : isImport(false), isPragmaOnce(false), DirInfo(SrcMgr::C_User), - External(false), Resolved(false), IndexHeaderMapHeader(false), + External(false), isModuleHeader(false), Resolved(false), + IndexHeaderMapHeader(false), NumIncludes(0), ControllingMacroID(0), ControllingMacro(0) {} /// \brief Retrieve the controlling macro for this header file, if @@ -134,7 +138,7 @@ class HeaderSearch { }; /// \brief Header-search options used to initialize this header search. - llvm::IntrusiveRefCntPtr<HeaderSearchOptions> HSOpts; + IntrusiveRefCntPtr<HeaderSearchOptions> HSOpts; FileManager &FileMgr; /// \#include search path information. Requests for \#include "x" search the @@ -189,7 +193,7 @@ class HeaderSearch { std::vector<std::pair<const FileEntry*, const HeaderMap*> > HeaderMaps; /// \brief The mapping between modules and headers. - ModuleMap ModMap; + mutable ModuleMap ModMap; /// \brief Describes whether a given directory has a module map in it. llvm::DenseMap<const DirectoryEntry *, bool> DirectoryHasModuleMap; @@ -217,7 +221,7 @@ class HeaderSearch { friend class DirectoryLookup; public: - HeaderSearch(llvm::IntrusiveRefCntPtr<HeaderSearchOptions> HSOpts, + HeaderSearch(IntrusiveRefCntPtr<HeaderSearchOptions> HSOpts, FileManager &FM, DiagnosticsEngine &Diags, const LangOptions &LangOpts, const TargetInfo *Target); ~HeaderSearch(); @@ -363,7 +367,8 @@ public: StringRef Filename, const FileEntry *RelativeFileEnt, SmallVectorImpl<char> *SearchPath, - SmallVectorImpl<char> *RelativePath); + SmallVectorImpl<char> *RelativePath, + Module **SuggestedModule); /// \brief Look up the specified framework name in our framework cache. /// \returns The DirectoryEntry it is in if we know, null otherwise. @@ -399,6 +404,9 @@ public: getFileInfo(File).DirInfo = SrcMgr::C_System; } + /// \brief Mark the specified file as part of a module. + void MarkFileModuleHeader(const FileEntry *File); + /// \brief Increment the count for the number of times the specified /// FileEntry has been entered. void IncrementIncludeCount(const FileEntry *File) { @@ -468,7 +476,7 @@ 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. - Module *findModuleForHeader(const FileEntry *File); + Module *findModuleForHeader(const FileEntry *File) const; /// \brief Read the contents of the given module map file. /// @@ -480,7 +488,7 @@ public: /// \brief Collect the set of all known, top-level modules. /// /// \param Modules Will be filled with the set of known, top-level modules. - void collectAllModules(llvm::SmallVectorImpl<Module *> &Modules); + void collectAllModules(SmallVectorImpl<Module *> &Modules); private: /// \brief Retrieve a module with the given name, which may be part of the @@ -497,7 +505,11 @@ private: Module *loadFrameworkModule(StringRef Name, const DirectoryEntry *Dir, bool IsSystem); - + + /// \brief Load all of the module maps within the immediate subdirectories + /// of the given search directory. + void loadSubdirectoryModuleMaps(DirectoryLookup &SearchDir); + public: /// \brief Retrieve the module map. ModuleMap &getModuleMap() { return ModMap; } |