r200938 - Move -verify-pch to use VerifyJobAction
Ben Langmuir
blangmuir at apple.com
Thu Feb 6 10:53:26 PST 2014
Author: benlangmuir
Date: Thu Feb 6 12:53:25 2014
New Revision: 200938
URL: http://llvm.org/viewvc/llvm-project?rev=200938&view=rev
Log:
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.
Modified:
cfe/trunk/include/clang/Driver/Action.h
cfe/trunk/lib/Driver/Action.cpp
cfe/trunk/lib/Driver/Driver.cpp
cfe/trunk/lib/Driver/ToolChain.cpp
cfe/trunk/lib/Driver/ToolChains.cpp
cfe/trunk/lib/Driver/Tools.cpp
cfe/trunk/test/Driver/darwin-verify-debug.c
Modified: cfe/trunk/include/clang/Driver/Action.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Action.h?rev=200938&r1=200937&r2=200938&view=diff
==============================================================================
--- cfe/trunk/include/clang/Driver/Action.h (original)
+++ cfe/trunk/include/clang/Driver/Action.h Thu Feb 6 12:53:25 2014
@@ -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;
}
};
Modified: cfe/trunk/lib/Driver/Action.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Action.cpp?rev=200938&r1=200937&r2=200938&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/Action.cpp (original)
+++ cfe/trunk/lib/Driver/Action.cpp Thu Feb 6 12:53:25 2014
@@ -33,7 +33,8 @@ const char *Action::getClassName(ActionC
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(Act
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) {
}
Modified: cfe/trunk/lib/Driver/Driver.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Driver.cpp?rev=200938&r1=200937&r2=200938&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/Driver.cpp (original)
+++ cfe/trunk/lib/Driver/Driver.cpp Thu Feb 6 12:53:25 2014
@@ -936,13 +936,12 @@ void Driver::BuildUniversalActions(const
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(con
} 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;
Modified: cfe/trunk/lib/Driver/ToolChain.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChain.cpp?rev=200938&r1=200937&r2=200938&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/ToolChain.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChain.cpp Thu Feb 6 12:53:25 2014
@@ -114,7 +114,7 @@ Tool *ToolChain::getTool(Action::ActionC
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::ActionC
case Action::PreprocessJobClass:
case Action::AnalyzeJobClass:
case Action::MigrateJobClass:
+ case Action::VerifyPCHJobClass:
return getClang();
}
Modified: cfe/trunk/lib/Driver/ToolChains.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains.cpp?rev=200938&r1=200937&r2=200938&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/ToolChains.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains.cpp Thu Feb 6 12:53:25 2014
@@ -212,7 +212,7 @@ Tool *MachO::getTool(Action::ActionClass
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();
Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=200938&r1=200937&r2=200938&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Thu Feb 6 12:53:25 2014
@@ -2066,14 +2066,13 @@ void Clang::ConstructJob(Compilation &C,
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");
Modified: cfe/trunk/test/Driver/darwin-verify-debug.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/darwin-verify-debug.c?rev=200938&r1=200937&r2=200938&view=diff
==============================================================================
--- cfe/trunk/test/Driver/darwin-verify-debug.c (original)
+++ cfe/trunk/test/Driver/darwin-verify-debug.c Thu Feb 6 12:53:25 2014
@@ -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
More information about the cfe-commits
mailing list