The first argument in the constructor was ignored, and the remaining arguments were always passed as their defaults.
This patch simplifies the class by moving all initializations to the members.
Details
Diff Detail
- Repository
- rL LLVM
Event Timeline
lib/DebugInfo/DWARF/DWARFDie.cpp | ||
---|---|---|
666 ↗ | (On Diff #208651) | You don't need to call default member constructor explicitly. Default member initialization could be used for Index too. |
- Removed AttrValue from the member initializer list of the constructor of DWARFDie::attribute_iterator.
lib/DebugInfo/DWARF/DWARFDie.cpp | ||
---|---|---|
666 ↗ | (On Diff #208651) | The main intent here was to remove the first unused argument in the constructor of DWARFAttribute because it is a bit of misleading. And other changes in that class were done because there was no reason not to do them when I was there. |
include/llvm/DebugInfo/DWARF/DWARFAttribute.h | ||
---|---|---|
32 ↗ | (On Diff #208673) | Form(0) is what the DWARFFormValue default ctor uses, you do not need to make this explicit here. |
include/llvm/DebugInfo/DWARF/DWARFAttribute.h | ||
---|---|---|
34 ↗ | (On Diff #208673) | Remove this ctor since it's the same as the implicit default ctor now. |
47–53 ↗ | (On Diff #208673) | Could you remove this function, and replace the one use (in DWARFDie.cpp) with "AttrValue = {};" instead, now that default construction has the desired effect. |
- Adjusted the initializer for Value.
- Removed the constructor.
- Removed the method clear() and replaced the only usage with AttrValue = {}.
include/llvm/DebugInfo/DWARF/DWARFAttribute.h | ||
---|---|---|
34 ↗ | (On Diff #208673) | This should be written as: DWARFFormValue Value; There's no need to explicitly default construct & then copy construct the object - the default constructor will be called implicitly. |
include/llvm/DebugInfo/DWARF/DWARFAttribute.h | ||
---|---|---|
34 ↗ | (On Diff #208673) | Well, I usually prefer more explicit code because it is just simpler to understand, hoping that the optimizer will remove any redundancy. But let it be as you said. |