Skip to content

Commit

Permalink
[Docs] Fix code-blocks missing a colon and a newline
Browse files Browse the repository at this point in the history
Fix syntax issues in the reStructuredText file that prevented rendering them.

Differential Revision: https://reviews.llvm.org/D156438
  • Loading branch information
rofirrim committed Jul 28, 2023
1 parent cb924dd commit 3174766
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Finds ``pthread_kill`` function calls when a thread is terminated by
raising ``SIGTERM`` signal and the signal kills the entire process, not
just the individual thread. Use any signal except ``SIGTERM``.

.. code-block: c++
.. code-block:: c++

pthread_kill(thread, SIGTERM);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ Finds ``cnd_wait``, ``cnd_timedwait``, ``wait``, ``wait_for``, or
that checks whether a condition predicate holds or the function has a
condition parameter.

.. code-block: c++
.. code-block:: c++

if (condition_predicate) {
condition.wait(lk);
}

.. code-block: c
.. code-block:: c
if (condition_predicate) {
if (thrd_success != cnd_wait(&condition, &lock)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ type is set to asynchronous. Asynchronous cancellation type
cancellation, a cancellation point in an asynchronous signal handler may still
be acted upon and the effect is as if it was an asynchronous cancellation.

.. code-block: c++
.. code-block:: c++

pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, &oldtype);

Expand Down
13 changes: 8 additions & 5 deletions clang/include/clang/Basic/AttrDocs.td
Original file line number Diff line number Diff line change
Expand Up @@ -1858,7 +1858,8 @@ The attribute may be applied to the declaration of a class, a typedef, a
variable, a function or method, a function parameter, an enumeration, an
enumerator, a non-static data member, or a label.

.. code-block: c++
.. code-block:: c++

#include <cassert>

[[maybe_unused]] void f([[maybe_unused]] bool thing1,
Expand Down Expand Up @@ -1887,7 +1888,8 @@ literal contents) are allowed. If there are redeclarations of the entity with
differing string literals, it is unspecified which one will be used by Clang
in any resulting diagnostics.

.. code-block: c++
.. code-block:: c++

struct [[nodiscard]] error_info { /*...*/ };
error_info enable_missile_safety_mode();

Expand All @@ -1904,7 +1906,8 @@ marked with ``[[nodiscard]]`` or a constructor of a type marked
``[[nodiscard]]`` will also diagnose. This also applies to type conversions that
use the annotated ``[[nodiscard]]`` constructor or result in an annotated type.

.. code-block: c++
.. code-block:: c++

struct [[nodiscard]] marked_type {/*..*/ };
struct marked_ctor {
[[nodiscard]] marked_ctor();
Expand Down Expand Up @@ -5685,12 +5688,12 @@ accessed. The following are examples of valid expressions where may not be diagn
``noderef`` is currently only supported for pointers and arrays and not usable
for references or Objective-C object pointers.

.. code-block: c++
.. code-block:: c++

int x = 2;
int __attribute__((noderef)) &y = x; // warning: 'noderef' can only be used on an array or pointer type

.. code-block: objc
.. code-block:: objc

id __attribute__((noderef)) obj = [NSObject new]; // warning: 'noderef' can only be used on an array or pointer type
}];
Expand Down
15 changes: 10 additions & 5 deletions clang/include/clang/Basic/DiagnosticGroups.td
Original file line number Diff line number Diff line change
Expand Up @@ -1299,10 +1299,12 @@ like YAML by adding the `-foptimization-record-file=<file>` command-line flag.
Results can be filtered by function name by passing
`-mllvm -filter-print-funcs=foo`, where `foo` is the target function's name.

.. code-block: console
.. code-block:: console

clang -c a.cpp -Rpass-analysis=stack-frame-layout -mllvm -filter-print-funcs=foo

.. code-block: console
.. code-block:: console

clang -c a.cpp -Rpass-analysis=stack-frame-layout -foptimization-record-file=<file>
}];
}
Expand Down Expand Up @@ -1394,19 +1396,22 @@ the token limit, which can be set in three ways:
1. As a limit at a specific point in a file, using the ``clang max_tokens_here``
pragma:

.. code-block: c++
.. code-block:: c++

#pragma clang max_tokens_here 1234

2. As a per-translation unit limit, using the ``-fmax-tokens=`` command-line
flag:

.. code-block: console
.. code-block:: console

clang -c a.cpp -fmax-tokens=1234

3. As a per-translation unit limit using the ``clang max_tokens_total`` pragma,
which works like and overrides the ``-fmax-tokens=`` flag:

.. code-block: c++
.. code-block:: c++

#pragma clang max_tokens_total 1234

These limits can be helpful in limiting code growth through included files.
Expand Down
12 changes: 6 additions & 6 deletions llvm/docs/ORCv2.rst
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ Absolute symbols are symbols that map directly to addresses without requiring
further materialization, for example: "foo" = 0x1234. One use case for
absolute symbols is allowing resolution of process symbols. E.g.

.. code-block: c++
.. code-block:: c++

JD.define(absoluteSymbols(SymbolMap({
{ Mangle("printf"),
Expand All @@ -334,7 +334,7 @@ imagine that your JIT standard library needs access to your JIT object to make
some calls. We could bake the address of your object into the library, but then
it would need to be recompiled for each session:

.. code-block: c++
.. code-block:: c++

// From standard library for JIT'd code:

Expand All @@ -347,7 +347,7 @@ it would need to be recompiled for each session:

We can turn this into a symbolic reference in the JIT standard library:

.. code-block: c++
.. code-block:: c++

extern MyJIT *__MyJITInstance;
Expand All @@ -356,7 +356,7 @@ We can turn this into a symbolic reference in the JIT standard library:
And then make our JIT object visible to the JIT standard library with an
absolute symbol definition when the JIT is started:

.. code-block: c++
.. code-block:: c++

MyJIT J = ...;

Expand All @@ -379,7 +379,7 @@ there are two implementations in the JIT standard library: ``log_fast`` and
used when the ``log`` symbol is referenced by setting up an alias at JIT startup
time:

.. code-block: c++
.. code-block:: c++

auto &JITStdLibJD = ... ;

Expand All @@ -397,7 +397,7 @@ The ``symbolAliases`` function allows you to define aliases within a single
JITDylib. The ``reexports`` function provides the same functionality, but
operates across JITDylib boundaries. E.g.

.. code-block: c++
.. code-block:: c++

auto &JD1 = ... ;
auto &JD2 = ... ;
Expand Down

0 comments on commit 3174766

Please sign in to comment.