summaryrefslogtreecommitdiffstats
path: root/clang/lib/Lex/PTHLexer.cpp
diff options
context:
space:
mode:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>2010-11-03 22:45:23 +0000
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>2010-11-03 22:45:23 +0000
commit71731d6b05db0fd5ff6c2e0641b050599706ae02 (patch)
tree662dbb298a9ba35a0e003756388af16da7f753f6 /clang/lib/Lex/PTHLexer.cpp
parentef43990bb89741d779777bebd75e0bbb2c4172bf (diff)
downloadbcm5719-llvm-71731d6b05db0fd5ff6c2e0641b050599706ae02.tar.gz
bcm5719-llvm-71731d6b05db0fd5ff6c2e0641b050599706ae02.zip
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. llvm-svn: 118203
Diffstat (limited to 'clang/lib/Lex/PTHLexer.cpp')
-rw-r--r--clang/lib/Lex/PTHLexer.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/clang/lib/Lex/PTHLexer.cpp b/clang/lib/Lex/PTHLexer.cpp
index 63b4823cf19..3d52159fa3b 100644
--- a/clang/lib/Lex/PTHLexer.cpp
+++ b/clang/lib/Lex/PTHLexer.cpp
@@ -434,10 +434,12 @@ static void InvalidPTH(Diagnostic &Diags, const char *Msg) {
Diags.Report(Diags.getCustomDiagID(Diagnostic::Error, Msg));
}
-PTHManager* PTHManager::Create(const std::string& file, Diagnostic &Diags) {
+PTHManager* PTHManager::Create(const std::string& file, FileManager &FileMgr,
+ const FileSystemOptions &FSOpts,
+ Diagnostic &Diags) {
// Memory map the PTH file.
llvm::OwningPtr<llvm::MemoryBuffer>
- File(llvm::MemoryBuffer::getFile(file.c_str()));
+ File(FileMgr.getBufferForFile(file, FSOpts));
if (!File) {
Diags.Report(diag::err_invalid_pth_file) << file;
OpenPOWER on IntegriCloud