[llvm] fb27f4f - [llvm] Use "static constexpr bool flow" in YamlIO.rst (#165166)
via llvm-commits
llvm-commits at lists.llvm.org
Sun Oct 26 13:34:28 PDT 2025
Author: Kazu Hirata
Date: 2025-10-26T13:34:24-07:00
New Revision: fb27f4f9c32231712097d93e0359947a2faab5e0
URL: https://github.com/llvm/llvm-project/commit/fb27f4f9c32231712097d93e0359947a2faab5e0
DIFF: https://github.com/llvm/llvm-project/commit/fb27f4f9c32231712097d93e0359947a2faab5e0.diff
LOG: [llvm] Use "static constexpr bool flow" in YamlIO.rst (#165166)
In C++17, we should use "static constexpr bool" instead of
"static const bool" for class-scope constants for for better
compile-time evaluation and checks.
Added:
Modified:
llvm/docs/YamlIO.rst
Removed:
################################################################################
diff --git a/llvm/docs/YamlIO.rst b/llvm/docs/YamlIO.rst
index c5079d8f6c192..4f523cb28e097 100644
--- a/llvm/docs/YamlIO.rst
+++ b/llvm/docs/YamlIO.rst
@@ -807,7 +807,7 @@ Flow Mapping
A YAML "flow mapping" is a mapping that uses the inline notation
(e.g { x: 1, y: 0 } ) when written to YAML. To specify that a type should be
written in YAML using flow mapping, your MappingTraits specialization should
-add "static const bool flow = true;". For instance:
+add ``static constexpr bool flow = true;``. For instance:
.. code-block:: c++
@@ -824,7 +824,7 @@ add "static const bool flow = true;". For instance:
...
}
- static const bool flow = true;
+ static constexpr bool flow = true;
}
Flow mappings are subject to line wrapping according to the ``Output`` object
@@ -859,7 +859,7 @@ Flow Sequence
A YAML "flow sequence" is a sequence that when written to YAML it uses the
inline notation (e.g [ foo, bar ] ). To specify that a sequence type should
be written in YAML as a flow sequence, your SequenceTraits specialization should
-add "static const bool flow = true;". For instance:
+add ``static constexpr bool flow = true;``. For instance:
.. code-block:: c++
@@ -869,7 +869,7 @@ add "static const bool flow = true;". For instance:
static MyListEl &element(IO &io, MyList &list, size_t index) { ... }
// The existence of this member causes YAML I/O to use a flow sequence
- static const bool flow = true;
+ static constexpr bool flow = true;
};
With the above, if you used MyList as the data type in your native data
More information about the llvm-commits
mailing list