Commit c9dab7d
committed
[lldb][NFC] Change ObjectFile's DataExtractor to a unique ptr
ObjectFile has an m_data DataExtractor ivar which may be default
constructed initially, or initialized with a DataBuffer passed in
to a ctor. Subclasses will provide the DataExtrator with a Buffer
source if not. When a DataBuffer is passed in to the base class
ctor, the DataExtractor only has its buffer initalized; we don't
yet know the address size and endianness to fully initialize the
DataExtractor.
This patch changes ObjectFile to instead have a DataExtractorSP
ivar which is always initialized with at least a default-constructed
DataExtractor object in the base class ctor. The next patch
I will be writing is to change the ObjectFile ctor which accepts
a DataBuffer to instead accept a DataExtractorSP, so the caller
can intialize it with a DataExtractor subclass -- the
VirtualizeDataExtractor being added in
#168802
The change is otherwise mechanical; all `m_data.` changed to
`m_data_up->` and all the places where `m_data` was passed in for
a by-ref call were changed to `*m_data_up.get()`. The unique
pointer is always initialized to contain an object.
I can't remember off hand if I'm making a mistake using a unique_ptr
here, given that the ctor may take a DataExtractor as an argument.
The caller will have to do std::move(extractor_up) when it calls
the ObjectFile ctor for correct behavior. Even though a unique_ptr
makes sense internal to ObjectFile, given that it can be passed as
an argument, should I use the more straightforward shared_ptr? An
ObjectFile only has one of them, so the extra storage for the
refcount isn't important.
I built & ran the testsuite on macOS and on aarch64-Ubuntu (thanks
for getting the Linux testsuite to run on SME-only systems David).
All of the ObjectFile subclasses I modifed compile cleanly, but I
haven't tested them beyond any unit tests they may have (prob breakpad).
rdar://1489397951 parent 4dc29b8 commit c9dab7d
File tree
11 files changed
+223
-200
lines changed- lldb
- include/lldb
- Symbol
- source
- Expression
- Plugins/ObjectFile
- Breakpad
- COFF
- ELF
- Mach-O
- PECOFF
- XCOFF
- wasm
- Symbol
11 files changed
+223
-200
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
418 | 418 | | |
419 | 419 | | |
420 | 420 | | |
421 | | - | |
| 421 | + | |
422 | 422 | | |
423 | 423 | | |
424 | 424 | | |
| |||
786 | 786 | | |
787 | 787 | | |
788 | 788 | | |
789 | | - | |
790 | | - | |
| 789 | + | |
| 790 | + | |
| 791 | + | |
| 792 | + | |
| 793 | + | |
791 | 794 | | |
792 | 795 | | |
793 | 796 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
342 | 342 | | |
343 | 343 | | |
344 | 344 | | |
| 345 | + | |
345 | 346 | | |
346 | 347 | | |
347 | 348 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
73 | 73 | | |
74 | 74 | | |
75 | 75 | | |
76 | | - | |
77 | | - | |
| 76 | + | |
| 77 | + | |
78 | 78 | | |
79 | 79 | | |
80 | 80 | | |
| |||
85 | 85 | | |
86 | 86 | | |
87 | 87 | | |
88 | | - | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
89 | 91 | | |
90 | 92 | | |
91 | 93 | | |
92 | 94 | | |
93 | | - | |
| 95 | + | |
94 | 96 | | |
95 | 97 | | |
96 | 98 | | |
| |||
Lines changed: 4 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
130 | 130 | | |
131 | 131 | | |
132 | 132 | | |
133 | | - | |
| 133 | + | |
134 | 134 | | |
135 | 135 | | |
136 | 136 | | |
137 | 137 | | |
138 | 138 | | |
139 | | - | |
| 139 | + | |
140 | 140 | | |
141 | 141 | | |
142 | 142 | | |
| |||
162 | 162 | | |
163 | 163 | | |
164 | 164 | | |
165 | | - | |
| 165 | + | |
166 | 166 | | |
167 | 167 | | |
168 | | - | |
| 168 | + | |
169 | 169 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
300 | 300 | | |
301 | 301 | | |
302 | 302 | | |
303 | | - | |
304 | | - | |
| 303 | + | |
| 304 | + | |
305 | 305 | | |
306 | 306 | | |
307 | 307 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
804 | 804 | | |
805 | 805 | | |
806 | 806 | | |
807 | | - | |
| 807 | + | |
808 | 808 | | |
809 | 809 | | |
810 | 810 | | |
| |||
845 | 845 | | |
846 | 846 | | |
847 | 847 | | |
848 | | - | |
| 848 | + | |
849 | 849 | | |
850 | 850 | | |
851 | 851 | | |
| |||
881 | 881 | | |
882 | 882 | | |
883 | 883 | | |
884 | | - | |
| 884 | + | |
885 | 885 | | |
886 | 886 | | |
887 | 887 | | |
| |||
892 | 892 | | |
893 | 893 | | |
894 | 894 | | |
895 | | - | |
| 895 | + | |
896 | 896 | | |
897 | 897 | | |
898 | 898 | | |
| |||
1078 | 1078 | | |
1079 | 1079 | | |
1080 | 1080 | | |
1081 | | - | |
| 1081 | + | |
| 1082 | + | |
1082 | 1083 | | |
1083 | 1084 | | |
1084 | 1085 | | |
| |||
1668 | 1669 | | |
1669 | 1670 | | |
1670 | 1671 | | |
1671 | | - | |
1672 | | - | |
| 1672 | + | |
| 1673 | + | |
1673 | 1674 | | |
1674 | 1675 | | |
1675 | 1676 | | |
| |||
3678 | 3679 | | |
3679 | 3680 | | |
3680 | 3681 | | |
3681 | | - | |
| 3682 | + | |
| 3683 | + | |
3682 | 3684 | | |
3683 | 3685 | | |
3684 | 3686 | | |
| |||
3833 | 3835 | | |
3834 | 3836 | | |
3835 | 3837 | | |
3836 | | - | |
3837 | | - | |
3838 | | - | |
3839 | | - | |
| 3838 | + | |
| 3839 | + | |
| 3840 | + | |
| 3841 | + | |
3840 | 3842 | | |
3841 | 3843 | | |
3842 | 3844 | | |
| |||
0 commit comments