aboutsummaryrefslogtreecommitdiff
path: root/tools/bugpoint-passes/TestPasses.cpp
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2015-05-27 18:44:32 +0000
committerDimitry Andric <dim@FreeBSD.org>2015-05-27 18:44:32 +0000
commit5a5ac124e1efaf208671f01c46edb15f29ed2a0b (patch)
treea6140557876943cdd800ee997c9317283394b22c /tools/bugpoint-passes/TestPasses.cpp
parentf03b5bed27d0d2eafd68562ce14f8b5e3f1f0801 (diff)
Diffstat (limited to 'tools/bugpoint-passes/TestPasses.cpp')
-rw-r--r--tools/bugpoint-passes/TestPasses.cpp26
1 files changed, 25 insertions, 1 deletions
diff --git a/tools/bugpoint-passes/TestPasses.cpp b/tools/bugpoint-passes/TestPasses.cpp
index ed54e9f8dfc7..6979d0345ee6 100644
--- a/tools/bugpoint-passes/TestPasses.cpp
+++ b/tools/bugpoint-passes/TestPasses.cpp
@@ -68,8 +68,32 @@ namespace {
}
};
}
-
+
char DeleteCalls::ID = 0;
static RegisterPass<DeleteCalls>
Y("bugpoint-deletecalls",
"BugPoint Test Pass - Intentionally 'misoptimize' CallInsts");
+
+namespace {
+ /// CrashOnDeclFunc - This pass is used to test bugpoint. It intentionally
+ /// crash if the module has an undefined function (ie a function that is
+ /// defined in an external module).
+ class CrashOnDeclFunc : public ModulePass {
+ public:
+ static char ID; // Pass ID, replacement for typeid
+ CrashOnDeclFunc() : ModulePass(ID) {}
+ private:
+ bool runOnModule(Module &M) override {
+ for (auto &F : M.functions()) {
+ if (F.isDeclaration())
+ abort();
+ }
+ return false;
+ }
+ };
+}
+
+char CrashOnDeclFunc::ID = 0;
+static RegisterPass<CrashOnDeclFunc>
+ Z("bugpoint-crash-decl-funcs",
+ "BugPoint Test Pass - Intentionally crash on declared functions");