diff options
author | Georgii Rymar <grimar@accesssoftek.com> | 2020-06-11 23:18:40 +0300 |
---|---|---|
committer | Georgii Rymar <grimar@accesssoftek.com> | 2020-06-12 12:03:51 +0300 |
commit | d95f8e7aef79393fbb95b8483c9f494da75b1d83 (patch) | |
tree | 5a45afd7fd2807d392101fcf77453957d3f1bf7e /clang/lib/Frontend/CompilerInvocation.cpp | |
parent | 91728b9172bfd2a2eccc9dc2ef3462f931579aff (diff) | |
download | llvm-d95f8e7aef79393fbb95b8483c9f494da75b1d83.zip llvm-d95f8e7aef79393fbb95b8483c9f494da75b1d83.tar.gz llvm-d95f8e7aef79393fbb95b8483c9f494da75b1d83.tar.bz2 |
[yaml2obj][MachO] - Fix PubName/PubType handling.
`PubName` and `PubType` are optional fields since D80722.
They are defined as:
Optional<PubSection> PubNames;
Optional<PubSection> PubTypes;
And initialized in the following way:
IO.mapOptional("debug_pubnames", DWARF.PubNames);
IO.mapOptional("debug_pubtypes", DWARF.PubTypes);
But problem is that because of the issue in `YAMLTraits.cpp`,
when there are no `debug_pubnames`/`debug_pubtypes` keys in a YAML description,
they are not initialized to `Optional::None` as the code expects, but they
are initialized to default `PubSection()` instances.
Because of this, the `if` condition in the following code is always true:
if (Obj.DWARF.PubNames)
Err = DWARFYAML::emitPubSection(OS, *Obj.DWARF.PubNames,
Obj.IsLittleEndian);
What means `emitPubSection` is always called and it writes few values.
This patch fixes the issue. I've reduced `sizeofcmds` by size of data
previously written because of this bug.
Differential revision: https://reviews.llvm.org/D81686
Diffstat (limited to 'clang/lib/Frontend/CompilerInvocation.cpp')
0 files changed, 0 insertions, 0 deletions