diff options
author | Daniel Dunbar <daniel@zuster.org> | 2010-06-07 23:26:47 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2010-06-07 23:26:47 +0000 |
commit | faddc3e53a95c68f2c3a966e0f1e6eba110dafd6 (patch) | |
tree | a63ec2f16986e5109568e36dc85c28970e6c8ad7 /lib/Frontend/FrontendAction.cpp | |
parent | 685ac6665a3f91f9a66a9f44b6bf755a0cd929ea (diff) |
Frontend: Add FrontendAction support for handling LLVM IR inputs.
- These inputs follow an abbreviated execution path, but are still worth handling by FrontendAction so they reuse all the other clang -cc1 features.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@105582 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Frontend/FrontendAction.cpp')
-rw-r--r-- | lib/Frontend/FrontendAction.cpp | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/lib/Frontend/FrontendAction.cpp b/lib/Frontend/FrontendAction.cpp index 56676e1ef9..b761f30adf 100644 --- a/lib/Frontend/FrontendAction.cpp +++ b/lib/Frontend/FrontendAction.cpp @@ -75,11 +75,28 @@ bool FrontendAction::BeginSourceFile(CompilerInstance &CI, return true; } - // Setup the file and source managers, if needed, and the preprocessor. + // Set up the file and source managers, if needed. if (!CI.hasFileManager()) CI.createFileManager(); if (!CI.hasSourceManager()) CI.createSourceManager(); + + // IR files bypass the rest of initialization. + if (InputKind == IK_LLVM_IR) { + assert(hasIRSupport() && + "This action does not have IR file support!"); + + // Inform the diagnostic client we are processing a source file. + CI.getDiagnosticClient().BeginSourceFile(CI.getLangOpts(), 0); + + // Initialize the action. + if (!BeginSourceFileAction(CI, Filename)) + goto failure; + + return true; + } + + // Set up the preprocessor. CI.createPreprocessor(); // Inform the diagnostic client we are processing a source file. |