<div dir="ltr"><div class="gmail_default" style="font-family:courier new,monospace;font-size:small">Hello,</div><div class="gmail_default" style="font-family:courier new,monospace;font-size:small"><br></div><div class="gmail_default" style="font-family:courier new,monospace;font-size:small">I am trying to write a pass. Here is a short and simplified version of it</div><div>bool <span class="gmail_default" style="font-family:"courier new",monospace;font-size:small">My</span>Pass:: runOnFunction( Function &F){<br>        errs() << "Visiting function " << F.getName();<br>        errs() << "\n";<br><br>        for (auto &BB : F) {<br>                for (auto &II : BB) {<br>                        if (CallInst *c = dyn_cast <CallInst> (&II)){<br>               <br>                        }<br>                }<br>        }<br>        return false; // We did not change anything in the IR<br>}<br></div><div><br></div><div><div class="gmail_default" style="font-family:"courier new",monospace;font-size:small">The code is straight forward and very much in line with the examples LLVM pass on the web.</div><br></div><div><div class="gmail_default" style="font-family:"courier new",monospace;font-size:small">However, when I compile it, I am getting the following error.</div><div class="gmail_default" style="font-family:"courier new",monospace;font-size:small"><br></div><div class="gmail_default" style="font-family:"courier new",monospace;font-size:small">In file included from MyPass.cpp:1:<br>In file included from /home/amalik/LLVM/llvm-8.0.0.src/include/llvm/Pass.h:365:<br>In file included from /home/amalik/LLVM/llvm_install/include/llvm/PassSupport.h:26:<br>In file included from /home/amalik/LLVM/llvm_install/include/llvm/PassRegistry.h:23:<br>In file included from /home/amalik/LLVM/llvm_install/include/llvm/Support/CBindingWrapping.h:18:<br>/home/amalik/LLVM/llvm_install/include/llvm/Support/Casting.h:59:12: error: incomplete type 'llvm::CallInst' named in nested name<br>      specifier<br>    return To::classof(&Val);<br>           ^~~~<br>/home/amalik/LLVM/llvm_install/include/llvm/Support/Casting.h:107:32: note: in instantiation of member function<br>      'llvm::isa_impl<llvm::CallInst, llvm::Instruction, void>::doit' requested here<br>    return isa_impl<To, From>::doit(*Val);<br>                               ^<br>/home/amalik/LLVM/llvm_install/include/llvm/Support/Casting.h:133:36: note: in instantiation of member function<br>      'llvm::isa_impl_cl<llvm::CallInst, const llvm::Instruction *>::doit' requested here<br>    return isa_impl_cl<To,FromTy>::doit(Val);<br>                                   ^<br>/home/amalik/LLVM/llvm_install/include/llvm/Support/Casting.h:124:56: note: in instantiation of member function<br>      'llvm::isa_impl_wrap<llvm::CallInst, const llvm::Instruction *, const llvm::Instruction *>::doit' requested here<br>      typename simplify_type<SimpleFrom>::SimpleType>::doit(<br>                                                       ^<br>/home/amalik/LLVM/llvm_install/include/llvm/Support/Casting.h:144:70: note: in instantiation of member function<br>      'llvm::isa_impl_wrap<llvm::CallInst, llvm::Instruction *const, const llvm::Instruction *>::doit' requested here<br>                       typename simplify_type<const Y>::SimpleType>::doit(Val);<br>                                                                     ^<br>/home/amalik/LLVM/llvm_install/include/llvm/Support/Casting.h:334:10: note: in instantiation of function template specialization<br>      'llvm::isa<llvm::CallInst, llvm::Instruction *>' requested here<br>  return isa<X>(Val) ? cast<X>(Val) : nullptr;<br>         ^<br>DummyPass.cpp:30:21: note: in instantiation of function template specialization 'llvm::dyn_cast<llvm::CallInst, llvm::Instruction>'<br>      requested here<br>                if (CallInst *c = dyn_cast <CallInst> (&II)){<br>                                  ^<br>/home/amalik/LLVM/llvm_install/include/llvm/IR/BasicBlock.h:35:7: note: forward declaration of 'llvm::CallInst'<br>class CallInst;<br>      ^<br>1 error generated<br></div><div class="gmail_default" style="font-family:"courier new",monospace;font-size:small"><br></div><div class="gmail_default" style="font-family:"courier new",monospace;font-size:small">------></div><div class="gmail_default" style="font-family:"courier new",monospace;font-size:small"><br></div><div class="gmail_default" style="font-family:"courier new",monospace;font-size:small">Thanks,</div><div class="gmail_default" style="font-family:"courier new",monospace;font-size:small"></div><br></div>-- <br><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div>Abid M. Malik<br>******************************************************<br><br> </div></div></div></div>