[llvm] f9e9037 - [docs] Fix style and typo in HowToSetUpLLVMStyleRTTI.rst after D126943

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 6 12:41:26 PDT 2022


Author: Fangrui Song
Date: 2022-06-06T12:41:21-07:00
New Revision: f9e9037c86bd98012f8fce11adf36e5df62d9a73

URL: https://github.com/llvm/llvm-project/commit/f9e9037c86bd98012f8fce11adf36e5df62d9a73
DIFF: https://github.com/llvm/llvm-project/commit/f9e9037c86bd98012f8fce11adf36e5df62d9a73.diff

LOG: [docs] Fix style and typo in HowToSetUpLLVMStyleRTTI.rst after D126943

Added: 
    

Modified: 
    llvm/docs/HowToSetUpLLVMStyleRTTI.rst

Removed: 
    


################################################################################
diff  --git a/llvm/docs/HowToSetUpLLVMStyleRTTI.rst b/llvm/docs/HowToSetUpLLVMStyleRTTI.rst
index 37843c1ef80e0..54fe6fb10d61b 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<typename T>
+  template <typename T>
   struct CastInfo<T, SomeValue>
-    : public CastIsPossible<T, SomeValue>,
-      public NullableValueCastFailed<T>,
-      public DefaultDoCastIfPossible<T, SomeValue, CastInfo<T, SomeValue>> {
+    : CastIsPossible<T, SomeValue>, NullableValueCastFailed<T>,
+      DefaultDoCastIfPossible<T, SomeValue, CastInfo<T, SomeValue>> {
     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<typename T>
+  template <typename T>
   struct CastInfo<SomeValue, T *>
-    : public NullableValueCastFailed<SomeValue>,
-      public DefaultDoCastIfPossible<SomeValue, T *,
-                                     CastInfo<SomeValue, T *>> {
+    : NullableValueCastFailed<SomeValue>,
+      DefaultDoCastIfPossible<SomeValue, T *, CastInfo<SomeValue, T *>> {
     static bool isPossible(const T *t) {
       return std::is_same<T, char>::value;
     }
@@ -551,9 +549,8 @@ In those cases, you probably want something like this:
 
 .. code-block:: c++
 
-  template<typename T>
-  struct CastInfo<T, SomeValue>
-    : public OptionalValueCast<T, SomeValue> {};
+  template <typename T>
+  struct CastInfo<T, SomeValue> : OptionalValueCast<T, SomeValue> {};
 
 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<AnotherValue> valOr = dyn_cast<AnotherValue>(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++
 


        


More information about the llvm-commits mailing list