[all-commits] [llvm/llvm-project] 4bf10f: [YAMLTraits] Fix std::optional input on empty docu...
akirchhoff-modular via All-commits
all-commits at lists.llvm.org
Mon Oct 16 13:14:31 PDT 2023
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 4bf10f3da7ab32d70d5c7c43b7705c06c108d326
https://github.com/llvm/llvm-project/commit/4bf10f3da7ab32d70d5c7c43b7705c06c108d326
Author: akirchhoff-modular <github-work at kirchhoff.digital>
Date: 2023-10-16 (Mon, 16 Oct 2023)
Changed paths:
M llvm/lib/Support/YAMLTraits.cpp
M llvm/unittests/Support/YAMLIOTest.cpp
Log Message:
-----------
[YAMLTraits] Fix std::optional input on empty documents (#68947)
When the input document is non-empty, `mapOptional` works as expected,
setting `std::optional` to `std::nullopt` when the field is not present.
When the input document is empty, we hit a special case inside of
`Input::preflightKey` that results in `UseDefault = false`, which
results in the `std::optional` erroneously being set to a non-nullopt
value. `preflightKey` is changed to set `UseDefault = true` in this case
to make the behavior consistent between empty and non-empty documents.
More information about the All-commits
mailing list