<div dir="ltr">Hi John,<div><br></div><div>Thanks. That was the problem exactly. I had declared the pass classes in an anonymous namespace in a header file and also tried to set the ParamCallFinder::ID within the header file as well which is not allowed/had no effect in C++ from what I can gather (I'm not the most familiar with C++). I removed the anonymous namespace and set the ParamCallFinderID in the c++ file with it's implementation and everything worked great. </div><div><br></div><div> I have one further question that has to do with how C++/llvm handles the anonymous namespaces. Are they required when declaring function passes or is my solution okay? If they anonymous namespaces are needed how can I access the ParamCallFinder::ID outside of the header file and in the C++ implementation?</div><div><br></div><div>Thanks,</div><div>Adam Taylor</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Feb 25, 2015 at 7:45 AM, John Criswell <span dir="ltr"><<a href="mailto:jtcriswel@gmail.com" target="_blank">jtcriswel@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div text="#000000" bgcolor="#FFFFFF"><div><div class="h5">
<div>On 2/23/15 10:26 PM, Adam Taylor wrote:<br>
</div>
<blockquote type="cite">
<div dir="ltr"><span>Hello all,</span>
<div><br>
</div>
<div>I have written one pass to collect information about
specific calls in an llvm IR file and am not trying to
reference the results from the first pass in a second pass. </div>
<div><br>
</div>
<div>What is the correct way to reference an additional custom
pass in LLVM? At the moment the project is set up under the
lib/Transforms directory in source and has the current layout:</div>
<div><br>
</div>
<div>Thresholds/</div>
<div> include/</div>
<div> Thresholds.h</div>
<div> Pass1.cpp</div>
<div> Pass2.cpp</div>
<div> Makefile</div>
<div><br>
</div>
<div>Both of the pass classes are defined in the header file.
In pass two I have declared that it requires Pass1 using:
AU.addRequired<Pass1>() and get the result using </div>
<div>getAnalysis<Pass1>().getParamPtrs(); </div>
<div><br>
</div>
<div>The module compiles correctly, but when trying to load it
using opt I get an error:</div>
<div><br>
</div>
<div>Error opening 'Thresholds.dylib': dlopen(Thresholds.dylib,
9): Symbol not found: __ZN12_GLOBAL__N_115ParamCallFinder2ID<br>
</div>
<div><br>
</div>
<div>What is the correct way to reference another custom written
pass in LLVM? Is is possible to do it in this manner or am I
completly wrong in my approach?</div>
</div>
</blockquote>
<br></div></div>
I don't think there's enough information in this email to determine,
reliably, what the problem is. That said, I'm guessing that one of
your passes is named ParamCallFinder.<br>
<br>
If I'm correct, make sure that ParamCallFinder::ID is defined in the
.cpp file that defines the methods for the pass. Otherwise, the ID
will be declared but not defined, and you can get a link error like
the one you're seeing.<br>
<br>
I can't be sure, but I suspect that's the problem.<br>
<br>
Regards,<br>
<br>
John Criswell<br>
<br>
<blockquote type="cite">
<div dir="ltr">
<div><br>
</div>
<div><br>
</div>
<div>Thanks!</div>
</div>
<br>
<fieldset></fieldset>
<br>
<pre>_______________________________________________
LLVM Developers mailing list
<a href="mailto:LLVMdev@cs.uiuc.edu" target="_blank">LLVMdev@cs.uiuc.edu</a> <a href="http://llvm.cs.uiuc.edu" target="_blank">http://llvm.cs.uiuc.edu</a>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><span class="HOEnZb"><font color="#888888">
</font></span></pre><span class="HOEnZb"><font color="#888888">
</font></span></blockquote><span class="HOEnZb"><font color="#888888">
<br>
<br>
<pre cols="72">--
John Criswell
Assistant Professor
Department of Computer Science, University of Rochester
<a href="http://www.cs.rochester.edu/u/criswell" target="_blank">http://www.cs.rochester.edu/u/criswell</a></pre>
</font></span></div>
</blockquote></div><br></div>