xar_open and xar_iter_new require manual calls to close/free functions
to deallocate resources. This makes it easy to introduce memory leaks,
so add RAII struct wrappers for these resources.
Details
Diff Detail
- Build Status
Buildable 10896 Build 10896: arc lint + arc unit
Event Timeline
tools/llvm-objdump/MachODump.cpp | ||
---|---|---|
205 | this probably should be in the anonymous namespace |
tools/llvm-objdump/MachODump.cpp | ||
---|---|---|
211 | just to double check - does xar_close work fine with nulls ? (i.e. if xar_open has failed) |
tools/llvm-objdump/MachODump.cpp | ||
---|---|---|
206 | These really should have the copy and move constructors deleted as well as the assignment operator deleted. |
Delete copy constructor (which implicitly deletes move constructor), and
assignment operator
llvm/trunk/tools/llvm-objdump/MachODump.cpp | ||
---|---|---|
206 ↗ | (On Diff #118007) | I'd consider dropping the "Scoped" suffix & just having XarFile and XarIterator - but up to you. |
222 ↗ | (On Diff #118007) | Consider using the init list: ScopedXarIter() : iter(xar_iter_new()) {} (or I guess maybe even a NSDMI: xar_iter_t iter = xar_iter_new(); ) |
Can you please call this ScopedXarFile?