diff options
| author | Ben Langmuir <blangmuir@apple.com> | 2014-02-06 18:53:25 +0000 |
|---|---|---|
| committer | Ben Langmuir <blangmuir@apple.com> | 2014-02-06 18:53:25 +0000 |
| commit | 9b9a8d330c142f1c445446ab7053a5bb1bf581c1 (patch) | |
| tree | 9af42b786289bb1d238c47216a3a709ae827c6a1 | |
| parent | 91f205bfc4faedcf3b8221cc59b7be60190a0c62 (diff) | |
| download | bcm5719-llvm-9b9a8d330c142f1c445446ab7053a5bb1bf581c1.tar.gz bcm5719-llvm-9b9a8d330c142f1c445446ab7053a5bb1bf581c1.zip | |
Move -verify-pch to use VerifyJobAction
Use the verify hook rather than the compile hook to represent the
-verify-pch action, and move the exising --verify-debug-info action
into its own subclass of VerifyJobAction. Incidentally change the name
printed by -ccc-print-phases for --verify-debug-info.
llvm-svn: 200938
| -rw-r--r-- | clang/include/clang/Driver/Action.h | 29 | ||||
| -rw-r--r-- | clang/lib/Driver/Action.cpp | 30 | ||||
| -rw-r--r-- | clang/lib/Driver/Driver.cpp | 11 | ||||
| -rw-r--r-- | clang/lib/Driver/ToolChain.cpp | 3 | ||||
| -rw-r--r-- | clang/lib/Driver/ToolChains.cpp | 2 | ||||
| -rw-r--r-- | clang/lib/Driver/Tools.cpp | 7 | ||||
| -rw-r--r-- | clang/test/Driver/darwin-verify-debug.c | 2 |
7 files changed, 64 insertions, 20 deletions
diff --git a/clang/include/clang/Driver/Action.h b/clang/include/clang/Driver/Action.h index 289dbe3ee4f..ea3da304ca1 100644 --- a/clang/include/clang/Driver/Action.h +++ b/clang/include/clang/Driver/Action.h @@ -50,10 +50,11 @@ public: LinkJobClass, LipoJobClass, DsymutilJobClass, - VerifyJobClass, + VerifyDebugInfoJobClass, + VerifyPCHJobClass, JobClassFirst=PreprocessJobClass, - JobClassLast=VerifyJobClass + JobClassLast=VerifyPCHJobClass }; static const char *getClassName(ActionClass AC); @@ -233,9 +234,29 @@ public: class VerifyJobAction : public JobAction { virtual void anchor(); public: - VerifyJobAction(ActionList &Inputs, types::ID Type); + VerifyJobAction(ActionClass Kind, Action *Input, types::ID Type); + VerifyJobAction(ActionClass Kind, ActionList &Inputs, types::ID Type); static bool classof(const Action *A) { - return A->getKind() == VerifyJobClass; + return A->getKind() == VerifyDebugInfoJobClass || + A->getKind() == VerifyPCHJobClass; + } +}; + +class VerifyDebugInfoJobAction : public VerifyJobAction { + virtual void anchor(); +public: + VerifyDebugInfoJobAction(Action *Input, types::ID Type); + static bool classof(const Action *A) { + return A->getKind() == VerifyDebugInfoJobClass; + } +}; + +class VerifyPCHJobAction : public VerifyJobAction { + virtual void anchor(); +public: + VerifyPCHJobAction(Action *Input, types::ID Type); + static bool classof(const Action *A) { + return A->getKind() == VerifyPCHJobClass; } }; diff --git a/clang/lib/Driver/Action.cpp b/clang/lib/Driver/Action.cpp index ddd2d599da0..86a48fd8b7f 100644 --- a/clang/lib/Driver/Action.cpp +++ b/clang/lib/Driver/Action.cpp @@ -33,7 +33,8 @@ const char *Action::getClassName(ActionClass AC) { case LinkJobClass: return "linker"; case LipoJobClass: return "lipo"; case DsymutilJobClass: return "dsymutil"; - case VerifyJobClass: return "verify"; + case VerifyDebugInfoJobClass: return "verify-debug-info"; + case VerifyPCHJobClass: return "verify-pch"; } llvm_unreachable("invalid class"); @@ -117,6 +118,29 @@ DsymutilJobAction::DsymutilJobAction(ActionList &Inputs, types::ID Type) void VerifyJobAction::anchor() {} -VerifyJobAction::VerifyJobAction(ActionList &Inputs, types::ID Type) - : JobAction(VerifyJobClass, Inputs, Type) { +VerifyJobAction::VerifyJobAction(ActionClass Kind, Action *Input, + types::ID Type) + : JobAction(Kind, Input, Type) { + assert((Kind == VerifyDebugInfoJobClass || Kind == VerifyPCHJobClass) && + "ActionClass is not a valid VerifyJobAction"); +} + +VerifyJobAction::VerifyJobAction(ActionClass Kind, ActionList &Inputs, + types::ID Type) + : JobAction(Kind, Inputs, Type) { + assert((Kind == VerifyDebugInfoJobClass || Kind == VerifyPCHJobClass) && + "ActionClass is not a valid VerifyJobAction"); +} + +void VerifyDebugInfoJobAction::anchor() {} + +VerifyDebugInfoJobAction::VerifyDebugInfoJobAction(Action *Input, + types::ID Type) + : VerifyJobAction(VerifyDebugInfoJobClass, Input, Type) { +} + +void VerifyPCHJobAction::anchor() {} + +VerifyPCHJobAction::VerifyPCHJobAction(Action *Input, types::ID Type) + : VerifyJobAction(VerifyPCHJobClass, Input, Type) { } diff --git a/clang/lib/Driver/Driver.cpp b/clang/lib/Driver/Driver.cpp index 270c3a701b0..898bdc94e29 100644 --- a/clang/lib/Driver/Driver.cpp +++ b/clang/lib/Driver/Driver.cpp @@ -936,13 +936,12 @@ void Driver::BuildUniversalActions(const ToolChain &TC, Actions.push_back(new DsymutilJobAction(Inputs, types::TY_dSYM)); } - // Verify the output (debug information only for now). + // Verify the debug info output. if (Args.hasArg(options::OPT_verify_debug_info)) { - ActionList VerifyInputs; - VerifyInputs.push_back(Actions.back()); + Action *VerifyInput = Actions.back(); Actions.pop_back(); - Actions.push_back(new VerifyJobAction(VerifyInputs, - types::TY_Nothing)); + Actions.push_back(new VerifyDebugInfoJobAction(VerifyInput, + types::TY_Nothing)); } } } @@ -1318,7 +1317,7 @@ Action *Driver::ConstructPhaseAction(const ArgList &Args, phases::ID Phase, } else if (Args.hasArg(options::OPT_module_file_info)) { return new CompileJobAction(Input, types::TY_ModuleFile); } else if (Args.hasArg(options::OPT_verify_pch)) { - return new CompileJobAction(Input, types::TY_Nothing); + return new VerifyPCHJobAction(Input, types::TY_Nothing); } else if (IsUsingLTO(Args)) { types::ID Output = Args.hasArg(options::OPT_S) ? types::TY_LTO_IR : types::TY_LTO_BC; diff --git a/clang/lib/Driver/ToolChain.cpp b/clang/lib/Driver/ToolChain.cpp index 9b09b4ecd66..9c43706d4f9 100644 --- a/clang/lib/Driver/ToolChain.cpp +++ b/clang/lib/Driver/ToolChain.cpp @@ -114,7 +114,7 @@ Tool *ToolChain::getTool(Action::ActionClass AC) const { case Action::BindArchClass: case Action::LipoJobClass: case Action::DsymutilJobClass: - case Action::VerifyJobClass: + case Action::VerifyDebugInfoJobClass: llvm_unreachable("Invalid tool kind."); case Action::CompileJobClass: @@ -122,6 +122,7 @@ Tool *ToolChain::getTool(Action::ActionClass AC) const { case Action::PreprocessJobClass: case Action::AnalyzeJobClass: case Action::MigrateJobClass: + case Action::VerifyPCHJobClass: return getClang(); } diff --git a/clang/lib/Driver/ToolChains.cpp b/clang/lib/Driver/ToolChains.cpp index 9c4213bc18d..d328b1671dd 100644 --- a/clang/lib/Driver/ToolChains.cpp +++ b/clang/lib/Driver/ToolChains.cpp @@ -212,7 +212,7 @@ Tool *MachO::getTool(Action::ActionClass AC) const { if (!Dsymutil) Dsymutil.reset(new tools::darwin::Dsymutil(*this)); return Dsymutil.get(); - case Action::VerifyJobClass: + case Action::VerifyDebugInfoJobClass: if (!VerifyDebug) VerifyDebug.reset(new tools::darwin::VerifyDebug(*this)); return VerifyDebug.get(); diff --git a/clang/lib/Driver/Tools.cpp b/clang/lib/Driver/Tools.cpp index af8696c42a7..6885f2410f2 100644 --- a/clang/lib/Driver/Tools.cpp +++ b/clang/lib/Driver/Tools.cpp @@ -2066,14 +2066,13 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA, CmdArgs.push_back("-emit-pch"); else CmdArgs.push_back("-emit-pth"); + } else if (isa<VerifyPCHJobAction>(JA)) { + CmdArgs.push_back("-verify-pch"); } else { assert(isa<CompileJobAction>(JA) && "Invalid action for clang tool."); if (JA.getType() == types::TY_Nothing) { - if (Args.hasArg(options::OPT_verify_pch)) - CmdArgs.push_back("-verify-pch"); - else - CmdArgs.push_back("-fsyntax-only"); + CmdArgs.push_back("-fsyntax-only"); } else if (JA.getType() == types::TY_LLVM_IR || JA.getType() == types::TY_LTO_IR) { CmdArgs.push_back("-emit-llvm"); diff --git a/clang/test/Driver/darwin-verify-debug.c b/clang/test/Driver/darwin-verify-debug.c index 9688eaa6e13..4878c746e07 100644 --- a/clang/test/Driver/darwin-verify-debug.c +++ b/clang/test/Driver/darwin-verify-debug.c @@ -7,7 +7,7 @@ // // CHECK-MULTIARCH-ACTIONS: 0: input, "{{.*}}darwin-verify-debug.c", c // CHECK-MULTIARCH-ACTIONS: 8: dsymutil, {7}, dSYM -// CHECK-MULTIARCH-ACTIONS: 9: verify, {8}, none +// CHECK-MULTIARCH-ACTIONS: 9: verify-debug-info, {8}, none // // RUN: %clang -target x86_64-apple-darwin10 -ccc-print-bindings \ // RUN: --verify-debug-info -arch i386 -arch x86_64 %s -g 2> %t |

