[llvm] 74da7ae - [NFC][llvm][docs] YamlIO: StringRef validate -> std::string validate
via llvm-commits
llvm-commits at lists.llvm.org
Fri Jul 9 02:50:08 PDT 2021
Author: Whisperity
Date: 2021-07-09T11:49:37+02:00
New Revision: 74da7ae0601728d7996e37c1f1828096e3d19103
URL: https://github.com/llvm/llvm-project/commit/74da7ae0601728d7996e37c1f1828096e3d19103
DIFF: https://github.com/llvm/llvm-project/commit/74da7ae0601728d7996e37c1f1828096e3d19103.diff
LOG: [NFC][llvm][docs] YamlIO: StringRef validate -> std::string validate
A change in the API happened as per http://reviews.llvm.org/D89463
(latest related commit b9e2b59680ad1bbfd2b9110b3ebf3d2b22cad51b)
but the RST documentation was not updated to match this at that time.
Added:
Modified:
llvm/docs/YamlIO.rst
Removed:
################################################################################
diff --git a/llvm/docs/YamlIO.rst b/llvm/docs/YamlIO.rst
index 68bc0e4c51f4..a42650d666cb 100644
--- a/llvm/docs/YamlIO.rst
+++ b/llvm/docs/YamlIO.rst
@@ -555,7 +555,7 @@ you can specialize on the class pointer. Examples:
No Normalization
----------------
-The mapping() method is responsible, if needed, for normalizing and
+The ``mapping()`` method is responsible, if needed, for normalizing and
denormalizing. In a simple case where the native data structure requires no
normalization, the mapping method just uses mapOptional() or mapRequired() to
bind the struct's fields to YAML key names. For example:
@@ -739,15 +739,15 @@ what the tag should be. This will also add that tag when writing yaml.
Validation
----------
-Sometimes in a yaml map, each key/value pair is valid, but the combination is
+Sometimes in a YAML map, each key/value pair is valid, but the combination is
not. This is similar to something having no syntax errors, but still having
semantic errors. To support semantic level checking, YAML I/O allows
an optional ``validate()`` method in a MappingTraits template specialization.
-When parsing yaml, the ``validate()`` method is call *after* all key/values in
+When parsing YAML, the ``validate()`` method is call *after* all key/values in
the map have been processed. Any error message returned by the ``validate()``
method during input will be printed just a like a syntax error would be printed.
-When writing yaml, the ``validate()`` method is called *before* the yaml
+When writing YAML, the ``validate()`` method is called *before* the YAML
key/values are written. Any error during output will trigger an ``assert()``
because it is a programming error to have invalid struct values.
@@ -766,11 +766,11 @@ because it is a programming error to have invalid struct values.
static void mapping(IO &io, Stuff &stuff) {
...
}
- static StringRef validate(IO &io, Stuff &stuff) {
+ static std::string validate(IO &io, Stuff &stuff) {
// Look at all fields in 'stuff' and if there
// are any bad values return a string describing
// the error. Otherwise return an empty string.
- return StringRef();
+ return std::string{};
}
};
More information about the llvm-commits
mailing list