Page MenuHomePhabricator

[DWARFYAML] Refactor: Pull out member functions to DWARFYAMLUtils.cpp.
AbandonedPublic

Authored by Higuoxing on Tue, Jul 7, 1:14 AM.

Details

Summary

DWARFYAML.cpp should only hold functions for mapping YAML representation
to DWARF structures.

In this change, I add a file DWARFYAMLUtils.cpp to contain helper
functions that are defined as member functions. In the future, we will
add some helper functions that make DWARF sections interlinked. They
should be implemented in DWARFYAMLUtils.cpp.

Diff Detail

Event Timeline

Higuoxing created this revision.Tue, Jul 7, 1:14 AM
grimar added a comment.Tue, Jul 7, 1:34 AM

So, currently, for example, DWARFYAML::Data is defined in DWARFYAML.h
(https://github.com/llvm/llvm-project/blob/master/llvm/include/llvm/ObjectYAML/DWARFYAML.h#L180) and implemented in DWARFYAML.cpp.

With this change the implementation of members is moved to a new DWARFYAMLUtils.cpp file. I.e. we have DWARFYAML.h + DWARFYAMLUtils.cpp with this patch.
Honestly, it looks a bit unnatural to me, because it breaks the straightforward common approach: "define in a header, implement in a cpp with the same name".

You're saying that "In the future, we will add some helper functions that make DWARF sections interlinked". Perhaps I'd wait for these functions to appear and may be
then create DWARFYAMLUtils.h + DWARFYAMLUtils.cpp for them.

Higuoxing planned changes to this revision.Tue, Jul 7, 1:40 AM

So, currently, for example, DWARFYAML::Data is defined in DWARFYAML.h
(https://github.com/llvm/llvm-project/blob/master/llvm/include/llvm/ObjectYAML/DWARFYAML.h#L180) and implemented in DWARFYAML.cpp.

With this change the implementation of members is moved to a new DWARFYAMLUtils.cpp file. I.e. we have DWARFYAML.h + DWARFYAMLUtils.cpp with this patch.
Honestly, it looks a bit unnatural to me, because it breaks the straightforward common approach: "define in a header, implement in a cpp with the same name".

You're saying that "In the future, we will add some helper functions that make DWARF sections interlinked". Perhaps I'd wait for these functions to appear and may be
then create DWARFYAMLUtils.h + DWARFYAMLUtils.cpp for them.

Sure, I will upload them later to see how it works, thanks for the suggestion!

Higuoxing abandoned this revision.Sun, Jul 26, 8:36 PM