diff options
author | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2011-03-08 23:35:24 +0000 |
---|---|---|
committer | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2011-03-08 23:35:24 +0000 |
commit | 299a4a967b02c9f0d0d94ad8560e3ced893f9116 (patch) | |
tree | 977a7dbe9a61fe1329a0e7c014442ec963b3aa18 /lib/Frontend/InitPreprocessor.cpp | |
parent | cf333339615da345c2ed6e873d94a501810d9f3f (diff) |
Add 'OverridenFilesKeepOriginalName' field in SourceManager which if true the SourceManager
should report the original file name for contents of files that were overriden by other files,
otherwise it should report the name of the new file. Default is true.
Also add similar field in PreprocessorOptions and pass similar parameter in ASTUnit::LoadFromCommandLine.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127289 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Frontend/InitPreprocessor.cpp')
-rw-r--r-- | lib/Frontend/InitPreprocessor.cpp | 15 |
1 files changed, 4 insertions, 11 deletions
diff --git a/lib/Frontend/InitPreprocessor.cpp b/lib/Frontend/InitPreprocessor.cpp index 91b5280a87..d9a2ef66b9 100644 --- a/lib/Frontend/InitPreprocessor.cpp +++ b/lib/Frontend/InitPreprocessor.cpp @@ -531,20 +531,13 @@ static void InitializeFileRemapping(Diagnostic &Diags, continue; } - // Load the contents of the file we're mapping to. - std::string ErrorStr; - const llvm::MemoryBuffer *Buffer - = FileMgr.getBufferForFile(ToFile->getName(), &ErrorStr); - if (!Buffer) { - Diags.Report(diag::err_fe_error_opening) - << Remap->second << ErrorStr; - continue; - } - // Override the contents of the "from" file with the contents of // the "to" file. - SourceMgr.overrideFileContents(FromFile, Buffer); + SourceMgr.overrideFileContents(FromFile, ToFile); } + + SourceMgr.setOverridenFilesKeepOriginalName( + InitOpts.RemappedFilesKeepOriginalName); } /// InitializePreprocessor - Initialize the preprocessor getting it and the |