diff --git a/llvm/docs/HowToSetUpLLVMStyleRTTI.rst b/llvm/docs/HowToSetUpLLVMStyleRTTI.rst --- a/llvm/docs/HowToSetUpLLVMStyleRTTI.rst +++ b/llvm/docs/HowToSetUpLLVMStyleRTTI.rst @@ -494,6 +494,7 @@ invalid. .. code-block:: c++ + class SomeValue { public: SomeValue(void *ptr) : ptr(ptr) {} @@ -509,6 +510,7 @@ we can use some provided cast traits like so: .. code-block:: c++ + template struct CastInfo : public CastIsPossible, @@ -525,6 +527,7 @@ that type from a char pointer type. So what we would do in that case is: .. code-block:: c++ + template struct CastInfo : public NullableValueCastFailed, @@ -547,6 +550,7 @@ In those cases, you probably want something like this: .. code-block:: c++ + template struct CastInfo : public OptionalValueCast {}; @@ -555,12 +559,14 @@ but it enables casting like so: .. code-block:: c++ + SomeValue someVal = ...; Optional valOr = dyn_cast(someVal); With the ``_is_present`` variants, you can even do optional chaining like this: .. code-block:: c++ + Optional someVal = ...; Optional valOr = dyn_cast_if_present(someVal);