forked from OSchip/llvm-project
Make CompilerInstance::InitializeSourceManager accept a FrontendInputFile,
no functionality change. llvm-svn: 167626
This commit is contained in:
parent
13d5562963
commit
1b3240b0aa
|
@ -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,
|
||||
|
|
|
@ -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());
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue