[Lldb-commits] [PATCH] D59562: [SymbolFileDWARF] Introduce DWARFContext
Zachary Turner via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Tue Mar 19 15:19:58 PDT 2019
zturner marked an inline comment as done.
zturner added inline comments.
Comment at: lldb/source/Plugins/SymbolFile/DWARF/DWARFContext.h:30
+ const DWARFDataExtractor *maybeLoadArangesData();
> Why do we need these two methods? I presume it's because one does work and the other doesn't? If I understand the code correctly, `LoadOrGetSection` will initialize the optional, so could you just check the optional to determine where we should try to do work or not?
It's because one of them is `const` and a const version of the function cannot do any work. It's possible we won't ever need this, and we'll always want a "get or create" function, but i can imagine scenarios where we have a const reference or const pointer.
This is always a problem with these lazy type interfaces, because in that case should you actually use `const_cast` or should you just fail and return nullptr? It's a tough call. I chose to explicitly embed into the name whether the function was doing work (e.g. `maybeLoad`) versus being purely a getter that will never do work (e.g. `get`).
CHANGES SINCE LAST ACTION
More information about the lldb-commits