diff options
Diffstat (limited to 'include/clang/Basic/SourceManager.h')
-rw-r--r-- | include/clang/Basic/SourceManager.h | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/include/clang/Basic/SourceManager.h b/include/clang/Basic/SourceManager.h index 5717816ff9..bd31c79ba2 100644 --- a/include/clang/Basic/SourceManager.h +++ b/include/clang/Basic/SourceManager.h @@ -40,6 +40,7 @@ #include "clang/Basic/SourceLocation.h" #include "llvm/Support/Allocator.h" #include "llvm/Support/DataTypes.h" +#include "llvm/ADT/ArrayRef.h" #include "llvm/ADT/PointerIntPair.h" #include "llvm/ADT/PointerUnion.h" #include "llvm/ADT/IntrusiveRefCntPtr.h" @@ -508,6 +509,11 @@ public: }; +/// \brief The path used when building modules on demand, which is used +/// to provide a link between the source managers of the different compiler +/// instances. +typedef llvm::ArrayRef<std::pair<std::string, FullSourceLoc> > ModuleBuildPath; + /// \brief This class handles loading and caching of source files into memory. /// /// This object owns the MemoryBuffer objects for all of the loaded @@ -645,6 +651,15 @@ class SourceManager : public RefCountedBase<SourceManager> { mutable llvm::DenseMap<FileID, MacroArgsMap *> MacroArgsCacheMap; + /// \brief The path of modules being built, which is used to detect + /// cycles in the module dependency graph as modules are being built, as + /// well as to describe + /// + /// There is no way to set this value from the command line. If we ever need + /// to do so (e.g., if on-demand module construction moves out-of-process), + /// we can add a cc1-level option to do so. + SmallVector<std::pair<std::string, FullSourceLoc>, 2> StoredModuleBuildPath; + // SourceManager doesn't support copy construction. explicit SourceManager(const SourceManager&) LLVM_DELETED_FUNCTION; void operator=(const SourceManager&) LLVM_DELETED_FUNCTION; @@ -669,6 +684,22 @@ public: /// (likely to change while trying to use them). bool userFilesAreVolatile() const { return UserFilesAreVolatile; } + /// \brief Retrieve the module build path. + ModuleBuildPath getModuleBuildPath() const { + return StoredModuleBuildPath; + } + + /// \brief Set the module build path. + void setModuleBuildPath(ModuleBuildPath path) { + StoredModuleBuildPath.clear(); + StoredModuleBuildPath.append(path.begin(), path.end()); + } + + /// \brief Append an entry to the module build path. + void appendModuleBuildPath(StringRef moduleName, FullSourceLoc importLoc) { + StoredModuleBuildPath.push_back(std::make_pair(moduleName.str(),importLoc)); + } + /// \brief Create the FileID for a memory buffer that will represent the /// FileID for the main source. /// |