Bug 1714991 - add docs for own compiler explorer instance r=andi

Differential Revision: https://phabricator.services.mozilla.com/D117000
This commit is contained in:
Frederik Braun 2021-06-07 13:15:32 +00:00
Родитель c649e994a2
Коммит 6f19bc3072
4 изменённых файлов: 36 добавлений и 10 удалений

Просмотреть файл

@ -1,3 +1,5 @@
.. _using_clang_query:
Using clang-query
=================
@ -49,7 +51,7 @@ More examples are available `in the documentation <https://clang.llvm.org/docs/L
`-IntegerLiteral 'int' 42
AST Dump in 'IgnoreUnlessSpelledInSource' mode for all dialects:
FunctionDecl
`-CompoundStmt
`-ReturnStmt
@ -97,7 +99,7 @@ clang-query automatically binds ``root`` to the match, but we also bound the nam
Match #1:
testfile.cpp:1:1: note: "x" binds here
testfile.cpp:1:1: note: "x" binds here
int addtwo(int num)
^~~~~~~~~~~~~~~~~~~
@ -159,7 +161,7 @@ This section tracks some patches; they are currently not used, but we may want t
- Plumbing:
- `mapAnyOf <https://reviews.llvm.org/D94127>`_) (`Example of usage <https://reviews.llvm.org/D94131>`_)
- `mapAnyOf() <https://reviews.llvm.org/D94127>`_ (`Example of usage <https://reviews.llvm.org/D94131>`_)
- `Make cxxOperatorCallExpr matchers API-compatible with n-ary operators <https://reviews.llvm.org/D94128>`_
- `CXXRewrittenBinaryOperator <https://reviews.llvm.org/D94130>`_

Просмотреть файл

@ -1,4 +1,32 @@
.. _using_compiler_explorer:
Using Compiler Explorer
=======================
TODO
As noted in the previous section, :ref:`using_clang_query`,
it can be useful to prototype
and develop static analysis with live results. For this reason, we are running a
`custom instance of the Godbolt's Compiler Explorer <https://foxyeah.com/>`_
at foxyeah.com (currently behind SSO).
Our custom instance is bundled with our header files from mozilla-central,
enabled by default.
When first started, Compiler Explorer will provide you with example source code and it's
its compilation results in assembly - when running a specific toolchain.
Let's first ensure this matches our default toolchain for Firefox:
1. Click the dropdown that (currently) defaults to x86-64 gcc and switch it to our current version of x86-64 clang.
2. Once you have selected the correct compiler, find the tool button below and enable clang-query.
3. Click the *Stdin* button to be able to supply arguments to clang-query
4. Fill-in the Recommended Boilerplate from our previous section
::
set traversal IgnoreUnlessSpelledInSource
set bind-root true # Unless you use any .bind("foo") commands
set print-matcher true
enable output dump
Now, you should be able to match a wide variety of C++ source code expressions.
Start with something simple like `match callExpr()` and narrow it down from here.
Continue at the next section, :ref:`writing_matchers`.

Просмотреть файл

@ -11,9 +11,3 @@ or seriously develop one we can land and run internally. While being written fo
compiler-explorer.rst
writing-matchers.rst
The above Table of Contents presents the full breadth of information. A quick-start guide follows.
Quick-State Guide
-----------------
TODO

Просмотреть файл

@ -1,3 +1,5 @@
.. _writing_matchers:
Writing Matchers
================