You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
14 lines
5.6 KiB
14 lines
5.6 KiB
5 years ago
|
<!DOCTYPE html>
|
||
|
<html xmlns="http://www.w3.org/1999/xhtml"><head><title>index (infer.index)</title><link rel="stylesheet" href="../odoc.css"/><meta charset="utf-8"/><meta name="viewport" content="width=device-width,initial-scale=1.0"/><meta name="generator" content="doc-ock-html v1.0.0-1-g1fc9bf0"/></head><body><nav id="top"><a href="../index.html">Up</a> — <span class="package">package <a href="index.html">infer</a></span></nav><header></header><h2>Library infer</h2><p>
|
||
|
These are the modules used by infer that are not packaged into sub-libraries.</p><p>The entry point of this library is the module:
|
||
|
<a href="InferModules/index.html">InferModules</a>.</p><p>The modules are split into several directories in the source tree of infer.</p><h3>absint/</h3><p>
|
||
|
Code + utilities for the Infer.AI abstract interpretation framework. Start at <a href="InferModules/AbstractInterpreter/index.html">InferModules.AbstractInterpreter</a>.</p><h3>backend/</h3><p>
|
||
|
The backend is responsible for the analysis of a project starting from an intermediate representation stored in the results directory, typically <code class="code">infer-out</code>.</p><p>The entry point for the analysis is the module <a href="InferModules/InferAnalyze/index.html">InferModules.InferAnalyze</a>.</p><p>The module <a href="InferModules/InferPrint/index.html">InferModules.InferPrint</a> is used to export the analysis results.</p><h3>checkers/</h3><p>
|
||
|
Transfer functions, abstract domains, and checker configuration.</p><h3>clang/</h3><p>
|
||
|
This is the frontend for the clang compiler. The main entry point is <a href="InferModules/ClangWrapper/index.html">InferModules.ClangWrapper</a>.</p><h4>General structure</h4><ol><li>Given a compilation command from the build system, sanitize it, attach <code class="code">ASTExporter</code> clang plugin to the relevant commands and run it.</li><li>Parse the AST (Abstract Syntax Tree) from the Biniou format into an OCaml data structure.</li><li>If enabled, invoke translation to <code class="code">SIL</code> via <a href="InferModules/CFrontend/index.html">InferModules.CFrontend</a>.</li><li>If enabled, invoke linters via <a href="InferModules/CFrontend_checkers_main/index.html">InferModules.CFrontend_checkers_main</a>. More on linters here: <a href="http://fbinfer.com/docs/linters.html">http://fbinfer.com/docs/linters.html</a>.</li></ol><h4>Format of the AST</h4><p>
|
||
|
The OCaml data type is defined in <code class="code">atd</code> format. The <code class="code">clang_ast_t.atd</code> file is generated from the comments in the <a href="https://github.com/facebook/facebook-clang-plugins/blob/master/libtooling/ASTExporter.h"><code class="code">ASTExporter.h</code></a> file.</p><p>For more information, refer to the relevant documentation in <code class="code">facebook-clang-plugins</code>:
|
||
|
</p><ul><li><a href="https://github.com/facebook/facebook-clang-plugins/blob/master/libtooling/ATD_GUIDELINES.md"><code class="code">libtooling/ATD_GUIDELINES.md</code></a></li><li><a href="https://github.com/facebook/facebook-clang-plugins/blob/master/clang-ocaml/README.md"><code class="code">clang-ocaml/README.md</code></a></li></ul><h4>Hacking on the <code class="code">.atd</code> file</h4><ol><li>Create a simple example (<code class="code">example.cpp</code>) source file with construct that needs to be exported. The smaller the better.</li><li>Export the extra information by changing the code in <a href="https://github.com/facebook/facebook-clang-plugins/blob/master/libtooling/ASTExporter.h"><code class="code">libtooling/ASTExporter.h</code></a>. For more information, refer to the <a href="https://github.com/facebook/facebook-clang-plugins/blob/master/libtooling/ATD_GUIDELINES.md"><code class="code">ATD_GUIDELINES</code></a>.</li><li>Compile Infer with the new version of <code class="code">facebook-clang-plugins</code>. Running <code class="code">make</code> from top level of Infer repository will do that. Sometimes there may be compilation errors due to <code class="code">.atd</code> file changes - they need to be fixed.</li><li>Use newly exported information information in the frontend.</li></ol><p>Tips & Tricks:
|
||
|
</p><ul><li>To view the AST in a human readable version, Infer can generate <code class="code">.bdump</code> file: <code class="code">infer -g -- clang -c example.cpp && sh example.cpp.ast.sh</code>. Then open <code class="code">example.cpp.ast.bdump</code>.</li><li>To inspect AST dump visually: <code class="code">clang -c example.cpp -Xclang -ast-dump</code>. It doesn't include all the information that Infer sees, but it's pretty concise</li><li>If running <code class="code">bdump</code> is failing (it happens on huge sources sometimes), there is a way to view it in "Yojson" format. To do that, replace all occurrences of <code class="code">BiniouASTExporter</code> with <code class="code">YojsonASTExporter</code> in the <code class="code">.ast.sh</code> script.</li></ul><h3>eradicate/</h3><p>
|
||
|
Eradicate <code class="code">@Nullable</code> Checker</p><p>Eradicate is a type checker for <code class="code">@Nullable</code> annotations for Java. The goal is to eradicate null pointer exceptions. See the online docs at <a href="http://fbinfer.com/docs/eradicate.html">http://fbinfer.com/docs/eradicate.html</a>.</p><p>The main entry point is module <a href="InferModules/Eradicate/index.html">InferModules.Eradicate</a>.</p><h3>java/</h3><p>
|
||
|
Java Frontend; this is the frontend for Java compilers.</p><p>The main entry point is <a href="InferModules/JMain/index.html">InferModules.JMain</a>.</p><h3>infer executable</h3><p>
|
||
|
You'll find the infer binary in infer.ml. It is not part of this library.</p></body></html>
|