aboutsummaryrefslogtreecommitdiff
path: root/tools/bugpoint-passes/TestPasses.cpp
diff options
context:
space:
mode:
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");