diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2017-06-03 15:20:48 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2017-06-03 15:20:48 +0000 |
commit | 551c698530debaae81139c7c76a29fb762793362 (patch) | |
tree | 547e0e59163c33f2142998714eb5f957e65d1a57 /include/clang/Lex | |
parent | 416ada0f75bab22b084a1776deb229cd4a669c4d (diff) |
Notes
Diffstat (limited to 'include/clang/Lex')
-rw-r--r-- | include/clang/Lex/ModuleMap.h | 45 |
1 files changed, 37 insertions, 8 deletions
diff --git a/include/clang/Lex/ModuleMap.h b/include/clang/Lex/ModuleMap.h index c05faa4a8201..11506939f9b1 100644 --- a/include/clang/Lex/ModuleMap.h +++ b/include/clang/Lex/ModuleMap.h @@ -26,6 +26,7 @@ #include "llvm/ADT/SmallVector.h" #include "llvm/ADT/StringMap.h" #include "llvm/ADT/StringRef.h" +#include "llvm/ADT/TinyPtrVector.h" #include "llvm/ADT/Twine.h" #include <algorithm> #include <memory> @@ -116,6 +117,11 @@ public: // Adjust ModuleMap::addHeader. }; + /// Convert a header kind to a role. Requires Kind to not be HK_Excluded. + static ModuleHeaderRole headerKindToRole(Module::HeaderKind Kind); + /// Convert a header role to a kind. + static Module::HeaderKind headerRoleToKind(ModuleHeaderRole Role); + /// \brief A header that is known to reside within a given module, /// whether it was included or excluded. class KnownHeader { @@ -165,7 +171,13 @@ private: /// \brief Mapping from each header to the module that owns the contents of /// that header. HeadersMap Headers; - + + /// Map from file sizes to modules with lazy header directives of that size. + mutable llvm::DenseMap<off_t, llvm::TinyPtrVector<Module*>> LazyHeadersBySize; + /// Map from mtimes to modules with lazy header directives with those mtimes. + mutable llvm::DenseMap<time_t, llvm::TinyPtrVector<Module*>> + LazyHeadersByModTime; + /// \brief Mapping from directories with umbrella headers to the module /// that is generated from the umbrella header. /// @@ -257,22 +269,30 @@ private: /// resolved. Module *resolveModuleId(const ModuleId &Id, Module *Mod, bool Complain) const; - /// Resolve the given header directive to an actual header file. + /// Add an unresolved header to a module. + void addUnresolvedHeader(Module *Mod, + Module::UnresolvedHeaderDirective Header); + + /// Look up the given header directive to find an actual header file. /// /// \param M The module in which we're resolving the header directive. /// \param Header The header directive to resolve. /// \param RelativePathName Filled in with the relative path name from the /// module to the resolved header. /// \return The resolved file, if any. - const FileEntry *resolveHeader(Module *M, - Module::UnresolvedHeaderDirective Header, - SmallVectorImpl<char> &RelativePathName); + const FileEntry *findHeader(Module *M, + const Module::UnresolvedHeaderDirective &Header, + SmallVectorImpl<char> &RelativePathName); + + /// Resolve the given header directive. + void resolveHeader(Module *M, + const Module::UnresolvedHeaderDirective &Header); /// Attempt to resolve the specified header directive as naming a builtin /// header. - const FileEntry * - resolveAsBuiltinHeader(Module *M, Module::UnresolvedHeaderDirective Header, - SmallVectorImpl<char> &BuiltinPathName); + /// \return \c true if a corresponding builtin header was found. + bool resolveAsBuiltinHeader(Module *M, + const Module::UnresolvedHeaderDirective &Header); /// \brief Looks up the modules that \p File corresponds to. /// @@ -368,6 +388,15 @@ public: /// the preferred module for the header. ArrayRef<KnownHeader> findAllModulesForHeader(const FileEntry *File) const; + /// Resolve all lazy header directives for the specified file. + /// + /// This ensures that the HeaderFileInfo on HeaderSearch is up to date. This + /// is effectively internal, but is exposed so HeaderSearch can call it. + void resolveHeaderDirectives(const FileEntry *File) const; + + /// Resolve all lazy header directives for the specified module. + void resolveHeaderDirectives(Module *Mod) const; + /// \brief Reports errors if a module must not include a specific file. /// /// \param RequestingModule The module including a file. |