aboutsummaryrefslogtreecommitdiff
path: root/lib/Frontend/CompilerInstance.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2010-11-23 08:35:12 +0000
committerChris Lattner <sabre@nondot.org>2010-11-23 08:35:12 +0000
commit39b49bcaaddb1049234fca9500c0ac02c088e23d (patch)
tree4f7ac9da3cf2bcbad0aebfb781b7635462b431cf /lib/Frontend/CompilerInstance.cpp
parent458b5e25052a1052eb873f9145298e0f0aa75cd1 (diff)
now the FileManager has a FileSystemOpts ivar, stop threading
FileSystemOpts through a ton of apis, simplifying a lot of code. This also fixes a latent bug in ASTUnit where it would invoke methods on FileManager without creating one in some code paths in cindextext. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120010 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Frontend/CompilerInstance.cpp')
-rw-r--r--lib/Frontend/CompilerInstance.cpp26
1 files changed, 10 insertions, 16 deletions
diff --git a/lib/Frontend/CompilerInstance.cpp b/lib/Frontend/CompilerInstance.cpp
index 06917706be..125f271a62 100644
--- a/lib/Frontend/CompilerInstance.cpp
+++ b/lib/Frontend/CompilerInstance.cpp
@@ -153,9 +153,8 @@ void CompilerInstance::createFileManager() {
// Source Manager
-void CompilerInstance::createSourceManager(FileManager &FileMgr,
- const FileSystemOptions &FSOpts) {
- SourceMgr.reset(new SourceManager(getDiagnostics(), FileMgr, FSOpts));
+void CompilerInstance::createSourceManager(FileManager &FileMgr) {
+ SourceMgr.reset(new SourceManager(getDiagnostics(), FileMgr));
}
// Preprocessor
@@ -164,8 +163,8 @@ void CompilerInstance::createPreprocessor() {
PP.reset(createPreprocessor(getDiagnostics(), getLangOpts(),
getPreprocessorOpts(), getHeaderSearchOpts(),
getDependencyOutputOpts(), getTarget(),
- getFrontendOpts(), getFileSystemOpts(),
- getSourceManager(), getFileManager()));
+ getFrontendOpts(), getSourceManager(),
+ getFileManager()));
}
Preprocessor *
@@ -176,16 +175,15 @@ CompilerInstance::createPreprocessor(Diagnostic &Diags,
const DependencyOutputOptions &DepOpts,
const TargetInfo &Target,
const FrontendOptions &FEOpts,
- const FileSystemOptions &FSOpts,
SourceManager &SourceMgr,
FileManager &FileMgr) {
// Create a PTH manager if we are using some form of a token cache.
PTHManager *PTHMgr = 0;
if (!PPOpts.TokenCache.empty())
- PTHMgr = PTHManager::Create(PPOpts.TokenCache, FileMgr, FSOpts, Diags);
+ PTHMgr = PTHManager::Create(PPOpts.TokenCache, FileMgr, Diags);
// Create the Preprocessor.
- HeaderSearch *HeaderInfo = new HeaderSearch(FileMgr, FSOpts);
+ HeaderSearch *HeaderInfo = new HeaderSearch(FileMgr);
Preprocessor *PP = new Preprocessor(Diags, LangInfo, Target,
SourceMgr, *HeaderInfo, PTHMgr,
/*OwnsHeaderSearch=*/true);
@@ -201,7 +199,7 @@ CompilerInstance::createPreprocessor(Diagnostic &Diags,
if (PPOpts.DetailedRecord)
PP->createPreprocessingRecord();
- InitializePreprocessor(*PP, FSOpts, PPOpts, HSOpts, FEOpts);
+ InitializePreprocessor(*PP, PPOpts, HSOpts, FEOpts);
// Handle generating dependencies, if requested.
if (!DepOpts.OutputFile.empty())
@@ -278,8 +276,7 @@ static bool EnableCodeCompletion(Preprocessor &PP,
unsigned Column) {
// Tell the source manager to chop off the given file at a specific
// line and column.
- const FileEntry *Entry = PP.getFileManager().getFile(Filename,
- PP.getFileSystemOpts());
+ const FileEntry *Entry = PP.getFileManager().getFile(Filename);
if (!Entry) {
PP.getDiagnostics().Report(diag::err_fe_invalid_code_complete_file)
<< Filename;
@@ -469,19 +466,17 @@ CompilerInstance::createOutputFile(llvm::StringRef OutputPath,
bool CompilerInstance::InitializeSourceManager(llvm::StringRef InputFile) {
return InitializeSourceManager(InputFile, getDiagnostics(), getFileManager(),
- getFileSystemOpts(),
getSourceManager(), getFrontendOpts());
}
bool CompilerInstance::InitializeSourceManager(llvm::StringRef InputFile,
Diagnostic &Diags,
FileManager &FileMgr,
- const FileSystemOptions &FSOpts,
SourceManager &SourceMgr,
const FrontendOptions &Opts) {
// Figure out where to get and map in the main file.
if (InputFile != "-") {
- const FileEntry *File = FileMgr.getFile(InputFile, FSOpts);
+ const FileEntry *File = FileMgr.getFile(InputFile);
if (!File) {
Diags.Report(diag::err_fe_error_reading) << InputFile;
return false;
@@ -494,8 +489,7 @@ bool CompilerInstance::InitializeSourceManager(llvm::StringRef InputFile,
return false;
}
const FileEntry *File = FileMgr.getVirtualFile(SB->getBufferIdentifier(),
- SB->getBufferSize(), 0,
- FSOpts);
+ SB->getBufferSize(), 0);
SourceMgr.createMainFileID(File);
SourceMgr.overrideFileContents(File, SB);
}