[PATCH] D26013: Change DWARF parser to use enumerations for DWARF tags, attributes and forms.
Adrian Prantl via llvm-commits
llvm-commits at lists.llvm.org
Wed Oct 26 15:08:47 PDT 2016
aprantl added inline comments.
================
Comment at: lib/DebugInfo/DWARF/DWARFFormValue.cpp:126
return (FC == FC_String);
+ default:
+ break;
----------------
Here's an idea: How about adding a
```
template<typename EnumType>
llvm::Optional<EnumType>
getULEB128AsEnum() {
// Decode ULEB.
uint64_t Val = ...; // what about larger values?
if (Val >= EnumType::getMinValue() && Val <= EnumType::getMaxValue())
return static_cast<EnumType>(Val);
return None;
}
```
?
This way we could guarantee that on of the enums if it is passed as an enum is always well-formed. Then we would never need a default case in a switch over a dwarf enum and could benefit from the not-all-enum-cases-covered-by-switch warning.
Is that feasible?
Repository:
rL LLVM
https://reviews.llvm.org/D26013
More information about the llvm-commits
mailing list