comparison tools/bugpoint-passes/TestPasses.cpp @ 95:afa8332a0e37 LLVM3.8

LLVM 3.8
author Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
date Tue, 13 Oct 2015 17:48:58 +0900
parents 54457678186b
children 7d135dc70f03
comparison
equal deleted inserted replaced
84:f3e34b893a5f 95:afa8332a0e37
66 } 66 }
67 return false; 67 return false;
68 } 68 }
69 }; 69 };
70 } 70 }
71 71
72 char DeleteCalls::ID = 0; 72 char DeleteCalls::ID = 0;
73 static RegisterPass<DeleteCalls> 73 static RegisterPass<DeleteCalls>
74 Y("bugpoint-deletecalls", 74 Y("bugpoint-deletecalls",
75 "BugPoint Test Pass - Intentionally 'misoptimize' CallInsts"); 75 "BugPoint Test Pass - Intentionally 'misoptimize' CallInsts");
76
77 namespace {
78 /// CrashOnDeclFunc - This pass is used to test bugpoint. It intentionally
79 /// crash if the module has an undefined function (ie a function that is
80 /// defined in an external module).
81 class CrashOnDeclFunc : public ModulePass {
82 public:
83 static char ID; // Pass ID, replacement for typeid
84 CrashOnDeclFunc() : ModulePass(ID) {}
85 private:
86 bool runOnModule(Module &M) override {
87 for (auto &F : M.functions()) {
88 if (F.isDeclaration())
89 abort();
90 }
91 return false;
92 }
93 };
94 }
95
96 char CrashOnDeclFunc::ID = 0;
97 static RegisterPass<CrashOnDeclFunc>
98 Z("bugpoint-crash-decl-funcs",
99 "BugPoint Test Pass - Intentionally crash on declared functions");