YAML: Assign a value returned by the default constructor to the value in an optional mapping.

This commit ensures that a value that's passed into YAML's IO mapOptional method
is going to be assigned a value returned by the default constructor for that
value's type when the appropriate key is not present in the YAML mapping.

Reviewers: Duncan P. N. Exon Smith

Differential Revision: http://reviews.llvm.org/D10492


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239972 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Alex Lorenz
2015-06-17 23:26:01 +00:00
parent 6ebf741ea2
commit 15db0fbcc8
2 changed files with 30 additions and 0 deletions

View File

@@ -647,6 +647,8 @@ private:
if ( this->preflightKey(Key, Required, false, UseDefault, SaveInfo) ) {
yamlize(*this, Val, Required);
this->postflightKey(SaveInfo);
} else if (UseDefault) {
Val = T();
}
}