From 389db16c63eec6ecfa9b235155252d8da766e94e Mon Sep 17 00:00:00 2001 From: Argyrios Kyrtzidis Date: Wed, 3 Nov 2010 22:45:23 +0000 Subject: Implement -working-directory. When -working-directory is passed in command line, file paths are resolved relative to the specified directory. This helps both when using libclang (where we can't require the user to actually change the working directory) and to help reproduce test cases when the reproduction work comes along. --FileSystemOptions is introduced which controls how file system operations are performed (currently it just contains the working directory value if set). --FileSystemOptions are passed around to various interfaces that perform file operations. --Opening & reading the content of files should be done only through FileManager. This is useful in general since file operations will be abstracted in the future for the reproduction mechanism. FileSystemOptions is independent of FileManager so that we can have multiple translation units sharing the same FileManager but with different FileSystemOptions. Addresses rdar://8583824. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@118203 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/clang/Frontend/CompilerInstance.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'include/clang/Frontend/CompilerInstance.h') diff --git a/include/clang/Frontend/CompilerInstance.h b/include/clang/Frontend/CompilerInstance.h index e5121e1bf9..3db6077029 100644 --- a/include/clang/Frontend/CompilerInstance.h +++ b/include/clang/Frontend/CompilerInstance.h @@ -220,6 +220,10 @@ public: return Invocation->getDiagnosticOpts(); } + const FileSystemOptions &getFileSystemOpts() const { + return Invocation->getFileSystemOpts(); + } + FrontendOptions &getFrontendOpts() { return Invocation->getFrontendOpts(); } @@ -499,7 +503,8 @@ public: void createFileManager(); /// Create the source manager and replace any existing one with it. - void createSourceManager(); + void createSourceManager(FileManager &FileMgr, + const FileSystemOptions &FSOpts); /// Create the preprocessor, using the invocation, file, and source managers, /// and replace any existing one with it. @@ -517,6 +522,7 @@ public: const DependencyOutputOptions &, const TargetInfo &, const FrontendOptions &, + const FileSystemOptions &, SourceManager &, FileManager &); /// Create the AST context. @@ -617,6 +623,7 @@ public: static bool InitializeSourceManager(llvm::StringRef InputFile, Diagnostic &Diags, FileManager &FileMgr, + const FileSystemOptions &FSOpts, SourceManager &SourceMgr, const FrontendOptions &Opts); -- cgit v1.2.3-18-g5258