<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Jun 22, 2015 at 12:58 PM, 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:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<div bgcolor="#FFFFFF" text="#000000"><div><div class="h5">
<div>On 6/22/15 2:29 PM, Peter Finn wrote:<br>
</div>
<blockquote type="cite">
I’ve been debugging SAFECode source code files, and line 170 in
ArrayBoundCheckLocal.cpp has been causing the following
compilation error:
<div><br>
</div>
<div>
<div style="margin:0px;font-size:11px;font-family:Menlo">In file included from
/Users/peterfinn/Desktop/llvm_trunk_2/projects/safecode/lib/ArrayBoundChecks/ArrayBoundCheckLocal.cpp:18:</div>
<div style="margin:0px;font-size:11px;font-family:Menlo">In file included from
/Users/peterfinn/Desktop/build/projects/safecode/../../../llvm_trunk_2/projects/safecode/include/safecode/ArrayBoundsCheck.h:17:</div>
<div style="margin:0px;font-size:11px;font-family:Menlo">In file included from
/Users/peterfinn/Desktop/build/projects/safecode/../../../llvm_trunk_2/projects/safecode/include/safecode/AllocatorInfo.h:21:</div>
<div style="margin:0px;font-size:11px;font-family:Menlo">In file included from
/Users/peterfinn/Desktop/llvm_trunk_2/include/llvm/IR/Module.h:20:</div>
<div style="margin:0px;font-size:11px;font-family:Menlo">In file included from
/Users/peterfinn/Desktop/llvm_trunk_2/include/llvm/IR/DataLayout.h:27:</div>
<div style="margin:0px;font-size:11px;font-family:Menlo">In file included from
/Users/peterfinn/Desktop/llvm_trunk_2/include/llvm/Pass.h:378:</div>
<div style="margin:0px;font-size:11px;font-family:Menlo"><b>/Users/peterfinn/Desktop/llvm_trunk_2/include/llvm/PassAnalysisSupport.h:201:53:
</b><span style="color:rgb(195,55,32)"><b>error: </b></span><b>no member named 'ID' in 'llvm::DataLayout'</b></div>
<div style="margin:0px;font-size:11px;font-family:Menlo"> return
getAnalysisID<AnalysisType>(&AnalysisType::ID);</div>
<div style="margin:0px;font-size:11px;font-family:Menlo;color:rgb(52,189,38)"><b>
~~~~~~~~~~~~~~^</b></div>
<div style="margin:0px;font-size:11px;font-family:Menlo"><b>/Users/peterfinn/Desktop/llvm_trunk_2/projects/safecode/lib/ArrayBoundChecks/ArrayBoundCheckLocal.cpp:170:9:
note: </b>in instantiation of function template
specialization</div>
<div style="margin:0px;font-size:11px;font-family:Menlo">
'llvm::Pass::getAnalysis<llvm::DataLayout>' requested
here</div>
<div style="margin:0px;font-size:11px;font-family:Menlo"> TD = &getAnalysis<DataLayout>();</div>
<div style="margin:0px;font-size:11px;font-family:Menlo;color:rgb(52,189,38)"><b> ^</b></div>
<div style="margin:0px;font-size:11px;font-family:Menlo">1 error generated.</div>
<div style="margin:0px;font-size:11px;font-family:Menlo">make[2]: ***
[/Users/peterfinn/Desktop/build/projects/safecode/lib/ArrayBoundChecks/Debug+Asserts/ArrayBoundCheckLocal.o]
Error 1</div>
<div style="margin:0px;font-size:11px;font-family:Menlo">make[1]: *** [ArrayBoundChecks/.makeall] Error 2</div>
<div style="margin:0px;font-size:11px;font-family:Menlo">make: *** [all] Error 1</div>
</div>
<div><br>
</div>
<div>I assume I need to obtain a DataLayout reference
from the argument of the function “runOnFunction”. Is this
correct? If so, how do I do this? If not, what is supposed to
be done instead?</div>
</blockquote>
<br></div></div>
If you have a pointer to a Function object, you can get the Module
in which the Function resides by calling the getParent() method of
Function. If F is a pointer to an llvm::Function, then<br>
<br>
F->getParent()<br>
<br>
... should return a pointer (or reference; I'm not sure which) to
the Function's containing module.<br>
<br>
Once you have the Module, you can get the DataLayout.<br>
<br>
Regards,<br>
<br>
John Criswell<br>
<br>
<blockquote type="cite">
<div><br>
</div>
<div>Thanks,</div>
<div>Peter Finn</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=""><font color="#888888">
</font></span></pre><span class=""><font color="#888888">
</font></span></blockquote><span class=""><font color="#888888">
<br>
<br>
<pre cols="72">--
John Criswell
Assistant Professor
Department of Computer Science, University of Rochester
<a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__www.cs.rochester.edu_u_criswell&d=AwMD-g&c=8hUWFZcy2Z-Za5rBPlktOQ&r=Mfk2qtn1LTDThVkh6-oGglNfMADXfJdty4_bhmuhMHA&m=RX2VsepnsRpeviZdtI4AHZNkYk7hZp4avI5KZZhXttk&s=eUPRdR1rCx9Ui9iNQKxkju46lFOGfMenIVdaRaqW024&e=" target="_blank">http://www.cs.rochester.edu/u/criswell</a></pre>
</font></span></div>
<br>_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:LLVMdev@cs.uiuc.edu">LLVMdev@cs.uiuc.edu</a> <a href="http://llvm.cs.uiuc.edu" rel="noreferrer" target="_blank">http://llvm.cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" rel="noreferrer" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><br>
<br></blockquote></div><br></div><div class="gmail_extra">InstCombine pass in LLVM has an example of DataLayout.<div><a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_docs_doxygen_html_InstructionCombining-5F8cpp-5Fsource.html&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=Mfk2qtn1LTDThVkh6-oGglNfMADXfJdty4_bhmuhMHA&m=D4lPToIhfC7WK04Sn8qJ3pp1m6DouuGfeMHFMW1rWPM&s=JwuouCsJH33_OJfop07lqKS8eNJP9qsdR8fpdfbYO0k&e=">http://llvm.org/docs/doxygen/html/InstructionCombining_8cpp_source.html</a> Line 2979.<br></div><div><br></div><div>Regards,</div><div>Kamal</div></div></div>