Skip to content

Commit 8b18572

Browse files
committed
[docs] Fix RST code-block syntax in HowToSetUpLLVMStyleRTTI.rst
1 parent 1523e8b commit 8b18572

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

llvm/docs/HowToSetUpLLVMStyleRTTI.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -494,6 +494,7 @@ constructible from ``nullptr`` and that results in a value you can tell is
494494
invalid.
495495

496496
.. code-block:: c++
497+
497498
class SomeValue {
498499
public:
499500
SomeValue(void *ptr) : ptr(ptr) {}
@@ -509,6 +510,7 @@ now, we assume that the types we want to cast *to* all provide ``classof``. So
509510
we can use some provided cast traits like so:
510511

511512
.. code-block:: c++
513+
512514
template<typename T>
513515
struct CastInfo<T, SomeValue>
514516
: public CastIsPossible<T, SomeValue>,
@@ -525,6 +527,7 @@ Now given the value above ``SomeValue``, maybe we'd like to be able to cast to
525527
that type from a char pointer type. So what we would do in that case is:
526528

527529
.. code-block:: c++
530+
528531
template<typename T>
529532
struct CastInfo<SomeValue, T *>
530533
: public NullableValueCastFailed<SomeValue>,
@@ -547,6 +550,7 @@ way to tell when an object is invalid, you may want to use ``llvm::Optional``.
547550
In those cases, you probably want something like this:
548551

549552
.. code-block:: c++
553+
550554
template<typename T>
551555
struct CastInfo<T, SomeValue>
552556
: public OptionalValueCast<T, SomeValue> {};
@@ -555,12 +559,14 @@ That cast trait requires that ``T`` is constructible from ``const SomeValue &``
555559
but it enables casting like so:
556560

557561
.. code-block:: c++
562+
558563
SomeValue someVal = ...;
559564
Optional<AnotherValue> valOr = dyn_cast<AnotherValue>(someVal);
560565

561566
With the ``_is_present`` variants, you can even do optional chaining like this:
562567

563568
.. code-block:: c++
569+
564570
Optional<SomeValue> someVal = ...;
565571
Optional<AnotherValue> valOr = dyn_cast_if_present<AnotherValue>(someVal);
566572

0 commit comments

Comments
 (0)