Summary: The documentation had gone out of sync with the new library names. Add or copy some short documentation for the main libraries, i.e. all of them except individual analyses (and scripts, third party, ..). The idea is that each library has some toplevel documentation `infer/src/<library_dir>/<LibraryName>.mld` that is linked to from the main entry point of the document infer/infer.mld. We can link to some important modules for each library from within their toplevel documentation, then the actual documentation should live inside the .mli's of the modules of the library as appropriate. Hopefully this leads to better documentation over time. At least now we can write some docs and they'll end up somewhere nice. Lots can be improved still at this point. Reviewed By: ngorogiannis Differential Revision: D21551955 fbshipit-source-id: 69a0cfa44master
parent
4e64657d50
commit
e29a9033bb
@ -1,11 +0,0 @@
|
|||||||
{1 Library InferIR: Intermediate Representation}
|
|
||||||
The Intermediate Representation, called [SIL], is a format used by the back-end for analysis. It is produced by the front-ends.
|
|
||||||
|
|
||||||
The entry point of this library is the module:
|
|
||||||
{!module-InferIR}.
|
|
||||||
|
|
||||||
The main entry point is the intermediate language in {!module-InferIR.Sil}.
|
|
||||||
|
|
||||||
The control flow graph module is {!module-InferIR.Cfg}.
|
|
||||||
|
|
||||||
The type environment module is {!module-InferIR.Tenv}.
|
|
@ -1,5 +0,0 @@
|
|||||||
{1 Library InferGenerated}
|
|
||||||
Source code that is generated from ATD definitions.
|
|
||||||
|
|
||||||
The entry point of this library is the module:
|
|
||||||
{!module-InferGenerated}.
|
|
@ -1,6 +0,0 @@
|
|||||||
{1 Library InferBase}
|
|
||||||
Utility modules that are somewhat specific to infer, usually because
|
|
||||||
they depend on Config.ml.
|
|
||||||
|
|
||||||
The entry point of this library is the module:
|
|
||||||
{!module-InferBase}.
|
|
@ -1,7 +0,0 @@
|
|||||||
{1 Infer Libraries}
|
|
||||||
|
|
||||||
- {{:infer.html}infer}: most of the modules: capture, analysis, integrations, ...
|
|
||||||
- {{:IR.html}IR}: the intermediate language used by the analysis
|
|
||||||
- {{:base.html}base}: configuration and utilities
|
|
||||||
- {{:atd.html}atd}: auto-generated datatypes
|
|
||||||
- {{:istd.html}}: additions to the Core standard library
|
|
@ -1,63 +1,45 @@
|
|||||||
{1 Library infer}
|
{0 Infer}
|
||||||
These are the modules used by infer that are not packaged into sub-libraries.
|
|
||||||
|
|
||||||
The entry point of this library is the module:
|
{1 Backend}
|
||||||
{!module-InferModules}.
|
|
||||||
|
|
||||||
|
Want to write your own analysis? You probably want the
|
||||||
|
{{:Absint.html}Absint} library. {{:Backend.html}Backend} is in charge
|
||||||
|
of orchestrating the various analyses on a collection of procedures.
|
||||||
|
|
||||||
The modules are split into several directories in the source tree of infer.
|
Some of the simplest analyses can be found in the {{:Checkers.html} Checkers} library.
|
||||||
|
|
||||||
{2 absint/}
|
{1 Frontends}
|
||||||
Code + utilities for the Infer.AI abstract interpretation framework. Start at {!module-InferModules.AbstractInterpreter}.
|
|
||||||
|
|
||||||
{2 backend/}
|
The frontends translate the source code to analyze into Infer's
|
||||||
The backend is responsible for the analysis of a project starting from an intermediate representation stored in the results directory, typically [infer-out].
|
intermediate representation (see {{:IR.html} IR}) to be analyzed by
|
||||||
|
the backend.
|
||||||
|
|
||||||
The entry point for the analysis is the module {!module-InferModules.InferAnalyze}.
|
There are two frontends:
|
||||||
|
- {{:ClangFrontend.html} Clang}
|
||||||
|
- {{:JavaFrontend.html} Java}
|
||||||
|
|
||||||
The module {!module-InferModules.InferPrint} is used to export the analysis results.
|
See also {{:ASTLanguage.html} AST Language}, and
|
||||||
|
{{:TestDeterminators.html} TestDeterminators}, which operate right
|
||||||
|
after the frontends.
|
||||||
|
|
||||||
{2 checkers/}
|
{1 Utilities}
|
||||||
Transfer functions, abstract domains, and checker configuration.
|
|
||||||
|
|
||||||
{2 clang/}
|
{{:IStdlib.html} IStdlib} groups non-Infer-specific modules, and
|
||||||
This is the frontend for the clang compiler. The main entry point is {!module-InferModules.ClangWrapper}.
|
{{:IBase.html} IBase} contains more Infer-specific modules that other
|
||||||
|
Infer libraries need, usually depending on the {!module-IBase.Config}
|
||||||
|
module. Some datatypes and their accompanying utilities are defined in
|
||||||
|
the {{:ATDGenerated.html} ATDGenerated} library.
|
||||||
|
|
||||||
{3 General structure}
|
{1 Integrations and Infer executables}
|
||||||
+ Given a compilation command from the build system, sanitize it, attach [ASTExporter] clang plugin to the relevant commands and run it.
|
|
||||||
+ Parse the AST (Abstract Syntax Tree) from the Biniou format into an OCaml data structure.
|
|
||||||
+ If enabled, invoke translation to [SIL] via {!module-InferModules.CFrontend}.
|
|
||||||
+ If enabled, invoke linters via {!module-InferModules.CFrontend_checkers_main}. More on linters here: {:http://fbinfer.com/docs/linters.html}.
|
|
||||||
|
|
||||||
{3 Format of the AST}
|
{{:Integration.html} Integration} ties the frontends and backend
|
||||||
The OCaml data type is defined in [atd] format. The [clang_ast_t.atd] file is generated from the comments in the {{:https://github.com/facebook/facebook-clang-plugins/blob/master/libtooling/ASTExporter.h} [ASTExporter.h]} file.
|
together, and deals with build system integrations.
|
||||||
|
|
||||||
For more information, refer to the relevant documentation in [facebook-clang-plugins]:
|
You'll find the source code for the [infer] command-line interface and
|
||||||
- {{:https://github.com/facebook/facebook-clang-plugins/blob/master/libtooling/ATD_GUIDELINES.md} [libtooling/ATD_GUIDELINES.md]}
|
others in the
|
||||||
- {{:https://github.com/facebook/facebook-clang-plugins/blob/master/clang-ocaml/README.md} [clang-ocaml/README.md]}
|
{{:https://github.com/facebook/infer/blob/master/infer/src/}infer/src/}
|
||||||
|
directory.
|
||||||
|
|
||||||
{3 Hacking on the [.atd] file}
|
{1 Index}
|
||||||
+ Create a simple example ([example.cpp]) source file with construct that needs to be exported. The smaller the better.
|
|
||||||
+ Export the extra information by changing the code in {{:https://github.com/facebook/facebook-clang-plugins/blob/master/libtooling/ASTExporter.h} [libtooling/ASTExporter.h]}. For more information, refer to the {{:https://github.com/facebook/facebook-clang-plugins/blob/master/libtooling/ATD_GUIDELINES.md} [ATD_GUIDELINES]}.
|
|
||||||
+ Compile Infer with the new version of [facebook-clang-plugins]. Running [make] from top level of Infer repository will do that. Sometimes there may be compilation errors due to [.atd] file changes - they need to be fixed.
|
|
||||||
+ Use newly exported information information in the frontend.
|
|
||||||
|
|
||||||
Tips & Tricks:
|
{{:index.html}List of all libraries.}
|
||||||
- To view the AST in a human readable version, Infer can generate [.bdump] file: [infer -g -- clang -c example.cpp && sh example.cpp.ast.sh]. Then open [example.cpp.ast.bdump].
|
|
||||||
- To inspect AST dump visually: [clang -c example.cpp -Xclang -ast-dump]. It doesn't include all the information that Infer sees, but it's pretty concise
|
|
||||||
- If running [bdump] 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 [BiniouASTExporter] with [YojsonASTExporter] in the [.ast.sh] script.
|
|
||||||
|
|
||||||
{2 eradicate/ }
|
|
||||||
Eradicate [@Nullable] Checker
|
|
||||||
|
|
||||||
Eradicate is a type checker for [@Nullable] annotations for Java. The goal is to eradicate null pointer exceptions. See the online docs at {:http://fbinfer.com/docs/eradicate}.
|
|
||||||
|
|
||||||
The main entry point is module {!module-InferModules.Eradicate}.
|
|
||||||
|
|
||||||
{2 java/}
|
|
||||||
Java Frontend; this is the frontend for Java compilers.
|
|
||||||
|
|
||||||
The main entry point is {!module-InferModules.JMain}.
|
|
||||||
|
|
||||||
{2 infer executable}
|
|
||||||
You'll find the infer binary in infer.ml. It is not part of this library.
|
|
||||||
|
@ -1,6 +0,0 @@
|
|||||||
{1 Library InferStdLib}
|
|
||||||
Utility modules not specific to infer. In particular, nothing here
|
|
||||||
should depend on Config.ml.
|
|
||||||
|
|
||||||
The entry point of this library is the module:
|
|
||||||
{!module-InferStdlib}.
|
|
@ -0,0 +1,11 @@
|
|||||||
|
{0 Library IR: Intermediate Representation}
|
||||||
|
|
||||||
|
The Intermediate Representation, called [SIL], is a format used by the back-end for analysis. It is produced by the front-ends.
|
||||||
|
|
||||||
|
The entry point of this library is the module {!module-IR}.
|
||||||
|
|
||||||
|
The main entry point is the intermediate language in {!module-IR.Sil}.
|
||||||
|
|
||||||
|
The control flow graph module is {!module-IR.Cfg}.
|
||||||
|
|
||||||
|
The type environment module is {!module-IR.Tenv}.
|
@ -0,0 +1,7 @@
|
|||||||
|
{0 Abstract Interpretation Framework}
|
||||||
|
|
||||||
|
{!module-Absint} is Infer's abstract interpretation framework, the recommended way to write analyses in Infer.
|
||||||
|
|
||||||
|
Important modules:
|
||||||
|
- {!module-Absint.AbstractInterpreter}
|
||||||
|
- {!module-Absint.AbstractDomain}
|
@ -0,0 +1,5 @@
|
|||||||
|
{0 AST Language (AL)}
|
||||||
|
|
||||||
|
Linter framework based on the {{:ClangFrontend.html} Clang frontend}.
|
||||||
|
|
||||||
|
All modules: {!module-ASTLanguage}
|
@ -0,0 +1,5 @@
|
|||||||
|
{0 Library ATDGenerated}
|
||||||
|
|
||||||
|
Source code that is generated from ATD definitions.
|
||||||
|
|
||||||
|
The entry point of this library is the module {!module-ATDGenerated}.
|
@ -0,0 +1,9 @@
|
|||||||
|
{0 Orchestration of the Backend Analyses}
|
||||||
|
|
||||||
|
Important modules:
|
||||||
|
- {!module-Backend.InferAnalyze}
|
||||||
|
- {!module-Backend.Ondemand}
|
||||||
|
- {!module-Backend.RegisterCheckers}
|
||||||
|
- {!module-Backend.Summary}
|
||||||
|
|
||||||
|
All modules: {!module-Backend}
|
@ -0,0 +1,6 @@
|
|||||||
|
{0 Library IBase}
|
||||||
|
|
||||||
|
Utility modules that are somewhat specific to infer, usually because
|
||||||
|
they depend on {!Config}.
|
||||||
|
|
||||||
|
The entry point of this library is the module {!module-IBase}.
|
@ -0,0 +1,5 @@
|
|||||||
|
{0 Checkers Library}
|
||||||
|
|
||||||
|
A collection of various analyses.
|
||||||
|
|
||||||
|
All modules: {!module-Checkers}
|
@ -0,0 +1,25 @@
|
|||||||
|
{0 Clang Frontend}
|
||||||
|
|
||||||
|
Translates code that {{:https://clang.llvm.org/}[Clang]} understands into Infer's intermediate representation language {!module-IR.Sil}.
|
||||||
|
|
||||||
|
All modules: {!module-ClangFrontend}
|
||||||
|
|
||||||
|
{1 Capturing source files}
|
||||||
|
|
||||||
|
Start at {!module-ClangFrontend.Capture} for how Infer uses Clang to parse source files, using our Clang plugin. For more information on our clang plugin itself, refer to the relevant documentation in [facebook-clang-plugins]:
|
||||||
|
|
||||||
|
- {{:https://github.com/facebook/facebook-clang-plugins/blob/master/libtooling/ATD_GUIDELINES.md} [facebook-clang-plugins/libtooling/ATD_GUIDELINES.md]}
|
||||||
|
- {{:https://github.com/facebook/facebook-clang-plugins/blob/master/clang-ocaml/README.md} [facebook-clang-plugins/clang-ocaml/README.md]}
|
||||||
|
|
||||||
|
{1 Quick guide to changing the AST format}
|
||||||
|
|
||||||
|
+ Create a simple example ([example.cpp]) source file with construct that needs to be exported. The smaller the better.
|
||||||
|
+ Export the extra information by changing the code in {{:https://github.com/facebook/facebook-clang-plugins/blob/master/libtooling/ASTExporter.h} [libtooling/ASTExporter.h]}. For more information, refer to the {{:https://github.com/facebook/facebook-clang-plugins/blob/master/libtooling/ATD_GUIDELINES.md} [ATD_GUIDELINES]}.
|
||||||
|
+ Compile Infer with the new version of [facebook-clang-plugins]. Running [make] from top level of Infer repository will do that. Sometimes there may be compilation errors due to [.atd] file changes --they need to be fixed.
|
||||||
|
+ Use newly-exported information in the frontend as you please.
|
||||||
|
|
||||||
|
{1 Tips & Tricks}
|
||||||
|
|
||||||
|
- To view the AST in a human readable version, Infer can generate [.bdump] files: [infer -g -- clang -c example.cpp && sh example.cpp.ast.sh]. Then open [example.cpp.ast.bdump].
|
||||||
|
- To inspect the AST visually: [clang -c example.cpp -Xclang -ast-dump]. It doesn't include all the information that Infer sees, but it's often a good place to start.
|
||||||
|
- If running [bdump] 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 [BiniouASTExporter] with [YojsonASTExporter] in the [.ast.sh] debug script.
|
@ -0,0 +1,3 @@
|
|||||||
|
{0 Integration}
|
||||||
|
|
||||||
|
All modules: {!module-Integration}
|
@ -0,0 +1,5 @@
|
|||||||
|
{0 Library IStdlib}
|
||||||
|
|
||||||
|
Additions to the standard library that are not specific to infer.
|
||||||
|
|
||||||
|
The entry point of this library is the module {!module-IStdlib}.
|
@ -0,0 +1,5 @@
|
|||||||
|
{0 Java Frontend}
|
||||||
|
|
||||||
|
This is the frontend for Java compilers.
|
||||||
|
|
||||||
|
All modules: {!module-JavaFrontend}
|
@ -0,0 +1,8 @@
|
|||||||
|
{0 Nullsafe [@Nullable] Checker}
|
||||||
|
|
||||||
|
Nullsafe (also called Eradicate) is a type checker for [@Nullable]
|
||||||
|
annotations in Java. The goal is to eradicate null pointer
|
||||||
|
exceptions. See the online docs at
|
||||||
|
{:http://fbinfer.com/docs/eradicate}.
|
||||||
|
|
||||||
|
All modules: {!module-Nullsafe}.
|
@ -0,0 +1,6 @@
|
|||||||
|
{0 Test Determinators}
|
||||||
|
|
||||||
|
Call graph analyses that can be used to determine which tests to run
|
||||||
|
in a given project as a result of a code change.
|
||||||
|
|
||||||
|
All modules: {!module-TestDeterminators}
|
Loading…
Reference in new issue