[PATCH] D84383: [DWARFYAML] Pull out common helper functions for rnglist and loclist tables. NFC.

Xing GUO via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 23 02:04:25 PDT 2020


Higuoxing marked an inline comment as done.
Higuoxing added inline comments.


================
Comment at: llvm/lib/ObjectYAML/DWARFEmitter.cpp:482
+    return checkListEntryOperands(EncodingName, Entry.Values, ExpectedOperands);
   };
 
----------------
Higuoxing wrote:
> grimar wrote:
> > It looks like you could pass `const DWARFYAML::RnglistEntry &Entry` directly to `checkListEntryOperands`
> > 
> > i.e.:
> > 
> > ```
> > static Error checkListEntryOperands(const DWARFYAML::RnglistEntry &Entry, uint64_t ExpectedOpsNum) {
> >   StringRef EncodingName = dwarf::RangeListEncodingString(Entry.Operator);
> > ...
> > }
> > ```
> > 
> > and then avoid having the `CheckOperands` helper? (inline `checkListEntryOperands`)
> > 
> > 
> Yeah, but I want to use `checkListEntryOperands()` to check operands for both the range list table and the location list table. The .debug_loclists section is implemented in D84234
My idea is having
```
StringRef EncodingName = dwarf::RangeListEncodingString(Entry.Operator);
auto CheckOperands = [&](uint64_t ExpectedOperands) -> Error {
  return checkListEntryOperands(EncodingName, Entry.Values, ExpectedOperands);
};
```
for the range list table and

```
StringRef EncodingName = dwarf::LocListEncodingString(Entry.Operator);
auto CheckOperands = [&](uint64_t ExpectedOperands) -> Error {
  return checkListEntryOperands(EncodingName, Entry.Values, ExpectedOperands);
};
```
for the location list table.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D84383/new/

https://reviews.llvm.org/D84383





More information about the llvm-commits mailing list