aboutsummaryrefslogtreecommitdiff
path: root/flang/lib/Parser/source.cpp
diff options
context:
space:
mode:
authorJonas Devlieghere <jonas@devlieghere.com>2021-01-25 13:02:20 -0800
committerJonas Devlieghere <jonas@devlieghere.com>2021-01-25 13:35:36 -0800
commitf50b8ee71faeb5056df7a950e7427f3047ff9987 (patch)
treec7b5ea1973c7ba8ca2db5fe546079f1710280f97 /flang/lib/Parser/source.cpp
parentdb1a7089eaf0c4df5e1fbfe974716f2bb6cb77e8 (diff)
downloadllvm-f50b8ee71faeb5056df7a950e7427f3047ff9987.zip
llvm-f50b8ee71faeb5056df7a950e7427f3047ff9987.tar.gz
llvm-f50b8ee71faeb5056df7a950e7427f3047ff9987.tar.bz2
[YAML I/O] Fix bug in emission of empty sequence
Don't emit an output dash for an empty sequence. Take emitting a vector of strings for example: std::vector<std::string> Strings = {"foo", "bar"}; LLVM_YAML_IS_SEQUENCE_VECTOR(std::string) yout << Strings; This emits the following YAML document. --- - foo - bar ... When the vector is empty, this generates the following result: --- - [] ... Although this is valid YAML, it does not match what we meant to emit. The result is a one-element sequence consisting of an empty list. Indeed, if we were to try to read this again we get an error: YAML:2:4: error: not a mapping - [] The problem is the output dash before the empty list. The correct output would be: --- [] ... This patch fixes that by not emitting the output dash for an empty sequence. Differential revision: https://reviews.llvm.org/D95280
Diffstat (limited to 'flang/lib/Parser/source.cpp')
0 files changed, 0 insertions, 0 deletions