Make CompilerInstance::InitializeSourceManager accept a FrontendInputFile,

no functionality change.

llvm-svn: 167626
This commit is contained in:
Argyrios Kyrtzidis 2012-11-09 19:40:33 +00:00
parent 13d5562963
commit 1b3240b0aa
4 changed files with 13 additions and 16 deletions

View File

@ -631,15 +631,13 @@ public:
/// as the main file.
///
/// \return True on success.
bool InitializeSourceManager(StringRef InputFile,
SrcMgr::CharacteristicKind Kind = SrcMgr::C_User);
bool InitializeSourceManager(const FrontendInputFile &Input);
/// InitializeSourceManager - Initialize the source manager to set InputFile
/// as the main file.
///
/// \return True on success.
static bool InitializeSourceManager(StringRef InputFile,
SrcMgr::CharacteristicKind Kind,
static bool InitializeSourceManager(const FrontendInputFile &Input,
DiagnosticsEngine &Diags,
FileManager &FileMgr,
SourceManager &SourceMgr,

View File

@ -86,8 +86,8 @@ ChainedIncludesSource *ChainedIncludesSource::create(CompilerInstance &CI) {
CInvok->getPreprocessorOpts().Macros.clear();
CInvok->getFrontendOpts().Inputs.clear();
CInvok->getFrontendOpts().Inputs.push_back(FrontendInputFile(includes[i],
IK));
FrontendInputFile InputFile(includes[i], IK);
CInvok->getFrontendOpts().Inputs.push_back(InputFile);
TextDiagnosticPrinter *DiagClient =
new TextDiagnosticPrinter(llvm::errs(), new DiagnosticOptions());
@ -147,7 +147,7 @@ ChainedIncludesSource *ChainedIncludesSource::create(CompilerInstance &CI) {
Clang->getASTContext().setExternalSource(Reader);
}
if (!Clang->InitializeSourceManager(includes[i]))
if (!Clang->InitializeSourceManager(InputFile))
return 0;
ParseAST(Clang->getSema());

View File

@ -589,19 +589,21 @@ CompilerInstance::createOutputFile(StringRef OutputPath,
// Initialization Utilities
bool CompilerInstance::InitializeSourceManager(StringRef InputFile,
SrcMgr::CharacteristicKind Kind){
return InitializeSourceManager(InputFile, Kind, getDiagnostics(),
bool CompilerInstance::InitializeSourceManager(const FrontendInputFile &Input){
return InitializeSourceManager(Input, getDiagnostics(),
getFileManager(), getSourceManager(),
getFrontendOpts());
}
bool CompilerInstance::InitializeSourceManager(StringRef InputFile,
SrcMgr::CharacteristicKind Kind,
bool CompilerInstance::InitializeSourceManager(const FrontendInputFile &Input,
DiagnosticsEngine &Diags,
FileManager &FileMgr,
SourceManager &SourceMgr,
const FrontendOptions &Opts) {
StringRef InputFile = Input.File;
SrcMgr::CharacteristicKind
Kind = Input.IsSystem ? SrcMgr::C_System : SrcMgr::C_User;
// Figure out where to get and map in the main file.
if (InputFile != "-") {
const FileEntry *File = FileMgr.getFile(InputFile);

View File

@ -369,10 +369,7 @@ bool FrontendAction::Execute() {
// Initialize the main file entry. This needs to be delayed until after PCH
// has loaded.
if (!isCurrentFileAST()) {
if (!CI.InitializeSourceManager(getCurrentFile(),
getCurrentInput().IsSystem
? SrcMgr::C_System
: SrcMgr::C_User))
if (!CI.InitializeSourceManager(getCurrentInput()))
return false;
}