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 | 873c8583e0f660ee0831751a9d105a57994159e1 (patch) | |
tree | dfb1b3c8888377ba4fb9f00b42f3c340cfa151d9 /clang/lib/Frontend/FrontendAction.cpp | |
parent | 1b3240b0aafa9bcef3918dfbaf60e412f474d276 (diff) | |
download | bcm5719-llvm-873c8583e0f660ee0831751a9d105a57994159e1.tar.gz bcm5719-llvm-873c8583e0f660ee0831751a9d105a57994159e1.zip |
Turn FrontendInputFile into an immutable class and have it also accept
a memory buffer instead of only a filename.
llvm-svn: 167627
Diffstat (limited to 'clang/lib/Frontend/FrontendAction.cpp')
-rw-r--r-- | clang/lib/Frontend/FrontendAction.cpp | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/clang/lib/Frontend/FrontendAction.cpp b/clang/lib/Frontend/FrontendAction.cpp index 8d153a39f09..2e9a791c303 100644 --- a/clang/lib/Frontend/FrontendAction.cpp +++ b/clang/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; |