5 #include "llvm/IR/Module.h"
11 class TestLLVMPass : public ModulePass {
16 TestLLVMPass() : ModulePass(ID) { }
18 bool runOnModule(Module &M) override;
20 StringRef getPassName() const override {
21 return "Some LLVM pass";
28 bool TestLLVMPass::runOnModule(Module &M) {
29 // A couple examples of operations that previously caused segmentation faults
30 // https://github.com/rust-lang/rust/issues/31067
32 for (auto F = M.begin(); F != M.end(); ++F) {
36 LLVMContext &C = M.getContext();
37 IntegerType *Int8Ty = IntegerType::getInt8Ty(C);
38 PointerType::get(Int8Ty, 0);
42 char TestLLVMPass::ID = 0;
44 static RegisterPass<TestLLVMPass> RegisterAFLPass(
45 "some-llvm-module-pass", "Some LLVM pass");