diff --git a/llvm/docs/HowToSetUpLLVMStyleRTTI.rst b/llvm/docs/HowToSetUpLLVMStyleRTTI.rst index 37843c1ef80e..54fe6fb10d61 100644 --- a/llvm/docs/HowToSetUpLLVMStyleRTTI.rst +++ b/llvm/docs/HowToSetUpLLVMStyleRTTI.rst @@ -511,11 +511,10 @@ we can use some provided cast traits like so: .. code-block:: c++ - template + template struct CastInfo - : public CastIsPossible, - public NullableValueCastFailed, - public DefaultDoCastIfPossible> { + : CastIsPossible, NullableValueCastFailed, + DefaultDoCastIfPossible> { static T doCast(SomeValue v) { return T(v.getPointer()); } @@ -528,11 +527,10 @@ that type from a char pointer type. So what we would do in that case is: .. code-block:: c++ - template + template struct CastInfo - : public NullableValueCastFailed, - public DefaultDoCastIfPossible> { + : NullableValueCastFailed, + DefaultDoCastIfPossible> { static bool isPossible(const T *t) { return std::is_same::value; } @@ -551,9 +549,8 @@ In those cases, you probably want something like this: .. code-block:: c++ - template - struct CastInfo - : public OptionalValueCast {}; + template + struct CastInfo : OptionalValueCast {}; That cast trait requires that ``T`` is constructible from ``const SomeValue &`` but it enables casting like so: @@ -563,7 +560,7 @@ but it enables casting like so: SomeValue someVal = ...; Optional valOr = dyn_cast(someVal); -With the ``_is_present`` variants, you can even do optional chaining like this: +With the ``_if_present`` variants, you can even do optional chaining like this: .. code-block:: c++