diff options
author | Daniel Dunbar <daniel@zuster.org> | 2009-09-01 16:57:46 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2009-09-01 16:57:46 +0000 |
commit | 5915fbf310e171c4cd3c2af05e9de360c0fa988a (patch) | |
tree | b394f6a3b9a74c0c9831e800732c6c363ce3a841 /lib/Driver/Tools.cpp | |
parent | 35f153f8ff4fd6a9b39c077026c3e5cc2c721a82 (diff) |
Add driver support for -emit-ast and AST compilation steps.
- <rdar://problem/7185031> Add 'clang' option '-emit-ast'
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80678 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Driver/Tools.cpp')
-rw-r--r-- | lib/Driver/Tools.cpp | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/lib/Driver/Tools.cpp b/lib/Driver/Tools.cpp index efd1917f4d..e93e6429eb 100644 --- a/lib/Driver/Tools.cpp +++ b/lib/Driver/Tools.cpp @@ -220,7 +220,12 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA, } else if (JA.getType() == types::TY_LLVMBC) { CmdArgs.push_back("-emit-llvm-bc"); } else if (JA.getType() == types::TY_PP_Asm) { - CmdArgs.push_back("-S"); + if (Inputs[0].getType() == types::TY_AST) + CmdArgs.push_back("-compile-ast"); + else + CmdArgs.push_back("-S"); + } else if (JA.getType() == types::TY_AST) { + CmdArgs.push_back("-emit-pch"); } } @@ -768,10 +773,13 @@ void gcc::Common::ConstructJob(Compilation &C, const JobAction &JA, it = Inputs.begin(), ie = Inputs.end(); it != ie; ++it) { const InputInfo &II = *it; - // Don't try to pass LLVM inputs to a generic gcc. + // Don't try to pass LLVM or AST inputs to a generic gcc. if (II.getType() == types::TY_LLVMBC) D.Diag(clang::diag::err_drv_no_linker_llvm_support) << getToolChain().getTripleString().c_str(); + else if (II.getType() == types::TY_AST) + D.Diag(clang::diag::err_drv_no_ast_support) + << getToolChain().getTripleString().c_str(); if (types::canTypeBeUserSpecified(II.getType())) { CmdArgs.push_back("-x"); @@ -1189,6 +1197,9 @@ void darwin::Compile::ConstructJob(Compilation &C, const JobAction &JA, CmdArgs.push_back("-emit-llvm"); else if (Output.getType() == types::TY_LLVMBC) CmdArgs.push_back("-emit-llvm-bc"); + else if (Output.getType() == types::TY_AST) + D.Diag(clang::diag::err_drv_no_ast_support) + << getToolChain().getTripleString().c_str(); ArgStringList OutputArgs; if (Output.getType() != types::TY_PCH) { @@ -1224,6 +1235,13 @@ void darwin::Compile::ConstructJob(Compilation &C, const JobAction &JA, it = Inputs.begin(), ie = Inputs.end(); it != ie; ++it) { const InputInfo &II = *it; + // Reject AST inputs. + if (II.getType() == types::TY_AST) { + D.Diag(clang::diag::err_drv_no_ast_support) + << getToolChain().getTripleString().c_str(); + return; + } + if (II.isPipe()) CmdArgs.push_back("-"); else |