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.

llvm-svn: 127289
This commit is contained in:
Argyrios Kyrtzidis
2011-03-08 23:35:24 +00:00
parent 4bb6c6b37e
commit 97d3a38c3e
7 changed files with 28 additions and 13 deletions

View File

@@ -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