This is an archive of the discontinued LLVM Phabricator instance.

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

Authored by Higuoxing on Jul 7 2020, 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.Jul 7 2020, 1:14 AM
grimar added a comment.Jul 7 2020, 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.Jul 7 2020, 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.Jul 26 2020, 8:36 PM