diff options
author | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2012-11-09 19:40:39 +0000 |
---|---|---|
committer | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2012-11-09 19:40:39 +0000 |
commit | 8616f9af65b9a3662f2c9dfed38eeabc509f8446 (patch) | |
tree | 39f559b5f8c3ff75153fcd01f7e1cdee0d8cbc6c /lib/Frontend/FrontendAction.cpp | |
parent | 8e1fbbc492bc1f4833136d9b55e1aaf478565d32 (diff) |
Turn FrontendInputFile into an immutable class and have it also accept
a memory buffer instead of only a filename.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167627 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Frontend/FrontendAction.cpp')
-rw-r--r-- | lib/Frontend/FrontendAction.cpp | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/lib/Frontend/FrontendAction.cpp b/lib/Frontend/FrontendAction.cpp index 8d153a39f0..2e9a791c30 100644 --- a/lib/Frontend/FrontendAction.cpp +++ b/lib/Frontend/FrontendAction.cpp @@ -161,17 +161,18 @@ ASTConsumer* FrontendAction::CreateWrappedASTConsumer(CompilerInstance &CI, bool FrontendAction::BeginSourceFile(CompilerInstance &CI, const FrontendInputFile &Input) { assert(!Instance && "Already processing a source file!"); - assert(!Input.File.empty() && "Unexpected empty filename!"); + assert(!Input.isEmpty() && "Unexpected empty filename!"); setCurrentInput(Input); setCompilerInstance(&CI); + StringRef InputFile = Input.getFile(); bool HasBegunSourceFile = false; if (!BeginInvocation(CI)) goto failure; // AST files follow a very different path, since they share objects via the // AST unit. - if (Input.Kind == IK_AST) { + if (Input.getKind() == IK_AST) { assert(!usesPreprocessorOnly() && "Attempt to pass AST file to preprocessor only action!"); assert(hasASTFileSupport() && @@ -179,7 +180,7 @@ bool FrontendAction::BeginSourceFile(CompilerInstance &CI, IntrusiveRefCntPtr<DiagnosticsEngine> Diags(&CI.getDiagnostics()); std::string Error; - ASTUnit *AST = ASTUnit::LoadFromASTFile(Input.File, Diags, + ASTUnit *AST = ASTUnit::LoadFromASTFile(InputFile, Diags, CI.getFileSystemOpts()); if (!AST) goto failure; @@ -194,11 +195,11 @@ bool FrontendAction::BeginSourceFile(CompilerInstance &CI, CI.setASTContext(&AST->getASTContext()); // Initialize the action. - if (!BeginSourceFileAction(CI, Input.File)) + if (!BeginSourceFileAction(CI, InputFile)) goto failure; /// Create the AST consumer. - CI.setASTConsumer(CreateWrappedASTConsumer(CI, Input.File)); + CI.setASTConsumer(CreateWrappedASTConsumer(CI, InputFile)); if (!CI.hasASTConsumer()) goto failure; @@ -212,7 +213,7 @@ bool FrontendAction::BeginSourceFile(CompilerInstance &CI, CI.createSourceManager(CI.getFileManager()); // IR files bypass the rest of initialization. - if (Input.Kind == IK_LLVM_IR) { + if (Input.getKind() == IK_LLVM_IR) { assert(hasIRSupport() && "This action does not have IR file support!"); @@ -221,7 +222,7 @@ bool FrontendAction::BeginSourceFile(CompilerInstance &CI, HasBegunSourceFile = true; // Initialize the action. - if (!BeginSourceFileAction(CI, Input.File)) + if (!BeginSourceFileAction(CI, InputFile)) goto failure; return true; @@ -275,7 +276,7 @@ bool FrontendAction::BeginSourceFile(CompilerInstance &CI, HasBegunSourceFile = true; // Initialize the action. - if (!BeginSourceFileAction(CI, Input.File)) + if (!BeginSourceFileAction(CI, InputFile)) goto failure; /// Create the AST context and consumer unless this is a preprocessor only @@ -284,7 +285,7 @@ bool FrontendAction::BeginSourceFile(CompilerInstance &CI, CI.createASTContext(); OwningPtr<ASTConsumer> Consumer( - CreateWrappedASTConsumer(CI, Input.File)); + CreateWrappedASTConsumer(CI, InputFile)); if (!Consumer) goto failure; |