diff options
Diffstat (limited to 'include/clang')
-rw-r--r-- | include/clang/Basic/SourceManager.h | 31 | ||||
-rw-r--r-- | include/clang/Frontend/DiagnosticRenderer.h | 12 | ||||
-rw-r--r-- | include/clang/Frontend/TextDiagnostic.h | 4 | ||||
-rw-r--r-- | include/clang/Lex/PreprocessorOptions.h | 9 |
4 files changed, 46 insertions, 10 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. /// diff --git a/include/clang/Frontend/DiagnosticRenderer.h b/include/clang/Frontend/DiagnosticRenderer.h index 086bb137d4..6ca8d89ec9 100644 --- a/include/clang/Frontend/DiagnosticRenderer.h +++ b/include/clang/Frontend/DiagnosticRenderer.h @@ -92,7 +92,10 @@ protected: virtual void emitIncludeLocation(SourceLocation Loc, PresumedLoc PLoc, const SourceManager &SM) = 0; - + virtual void emitBuildingModuleLocation(SourceLocation Loc, PresumedLoc PLoc, + StringRef ModuleName, + const SourceManager &SM) = 0; + virtual void beginDiagnostic(DiagOrStoredDiag D, DiagnosticsEngine::Level Level) {} virtual void endDiagnostic(DiagOrStoredDiag D, @@ -103,6 +106,7 @@ private: void emitIncludeStack(SourceLocation Loc, DiagnosticsEngine::Level Level, const SourceManager &SM); void emitIncludeStackRecursively(SourceLocation Loc, const SourceManager &SM); + void emitModuleBuildPath(const SourceManager &SM); void emitMacroExpansionsAndCarets(SourceLocation Loc, DiagnosticsEngine::Level Level, SmallVectorImpl<CharSourceRange>& Ranges, @@ -149,7 +153,11 @@ public: virtual void emitIncludeLocation(SourceLocation Loc, PresumedLoc PLoc, const SourceManager &SM); - + + virtual void emitBuildingModuleLocation(SourceLocation Loc, PresumedLoc PLoc, + StringRef ModuleName, + const SourceManager &SM); + virtual void emitNote(SourceLocation Loc, StringRef Message, const SourceManager *SM) = 0; }; diff --git a/include/clang/Frontend/TextDiagnostic.h b/include/clang/Frontend/TextDiagnostic.h index 51f841ddd3..859bec2cfe 100644 --- a/include/clang/Frontend/TextDiagnostic.h +++ b/include/clang/Frontend/TextDiagnostic.h @@ -103,6 +103,10 @@ protected: virtual void emitIncludeLocation(SourceLocation Loc, PresumedLoc PLoc, const SourceManager &SM); + virtual void emitBuildingModuleLocation(SourceLocation Loc, PresumedLoc PLoc, + StringRef ModuleName, + const SourceManager &SM); + private: void emitSnippetAndCaret(SourceLocation Loc, DiagnosticsEngine::Level Level, SmallVectorImpl<CharSourceRange>& Ranges, diff --git a/include/clang/Lex/PreprocessorOptions.h b/include/clang/Lex/PreprocessorOptions.h index 857161ddc0..a670267f02 100644 --- a/include/clang/Lex/PreprocessorOptions.h +++ b/include/clang/Lex/PreprocessorOptions.h @@ -10,6 +10,7 @@ #ifndef LLVM_CLANG_LEX_PREPROCESSOROPTIONS_H_ #define LLVM_CLANG_LEX_PREPROCESSOROPTIONS_H_ +#include "clang/Basic/SourceLocation.h" #include "llvm/ADT/IntrusiveRefCntPtr.h" #include "llvm/ADT/SmallVector.h" #include "llvm/ADT/StringRef.h" @@ -120,14 +121,6 @@ public: /// with support for lifetime-qualified pointers. ObjCXXARCStandardLibraryKind ObjCXXARCStandardLibrary; - /// \brief The path of modules being build, which is used to detect - /// cycles in the module dependency graph as modules are being built. - /// - /// 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::string, 2> ModuleBuildPath; - /// \brief Records the set of modules class FailedModulesSet : public llvm::RefCountedBase<FailedModulesSet> { llvm::StringSet<> Failed; |