diff options
Diffstat (limited to 'include/clang/Frontend/CompilerInstance.h')
-rw-r--r-- | include/clang/Frontend/CompilerInstance.h | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/include/clang/Frontend/CompilerInstance.h b/include/clang/Frontend/CompilerInstance.h index c503d7a09f..fb52383465 100644 --- a/include/clang/Frontend/CompilerInstance.h +++ b/include/clang/Frontend/CompilerInstance.h @@ -20,6 +20,8 @@ class LLVMContext; namespace clang { class Diagnostic; class DiagnosticClient; +class FileManager; +class SourceManager; class TargetInfo; /// CompilerInstance - Helper class for managing a single instance of the Clang @@ -57,6 +59,12 @@ class CompilerInstance { /// The target being compiled for. llvm::OwningPtr<TargetInfo> Target; + /// The file manager. + llvm::OwningPtr<FileManager> FileMgr; + + /// The source manager. + llvm::OwningPtr<SourceManager> SourceMgr; + public: /// Create a new compiler instance with the given LLVM context, optionally /// taking ownership of it. @@ -192,6 +200,44 @@ public: void setTarget(TargetInfo *Value) { Target.reset(Value); } /// } + /// @name File Manager + /// { + + FileManager &getFileManager() const { return *FileMgr; } + + /// takeFileManager - Remove the current file manager and give ownership to + /// the caller. + FileManager *takeFileManager() { return FileMgr.take(); } + + /// setFileManager - Replace the current file manager; the compiler instance + /// takes ownership of \arg Value. + void setFileManager(FileManager *Value) { FileMgr.reset(Value); } + + /// } + /// @name Source Manager + /// { + + SourceManager &getSourceManager() const { return *SourceMgr; } + + /// takeSourceManager - Remove the current source manager and give ownership + /// to the caller. + SourceManager *takeSourceManager() { return SourceMgr.take(); } + + /// setSourceManager - Replace the current source manager; the compiler + /// instance takes ownership of \arg Value. + void setSourceManager(SourceManager *Value) { SourceMgr.reset(Value); } + + /// } + /// @name Construction Utility Methods + /// { + + /// Create the file manager and replace any existing one with it. + void createFileManager(); + + /// Create the source manager and replace any existing one with it. + void createSourceManager(); + + /// } }; } // end namespace clang |