summaryrefslogtreecommitdiffstats
path: root/lldb/source/Core/Module.cpp
diff options
context:
space:
mode:
authorZachary Turner <zturner@google.com>2018-10-25 20:45:19 +0000
committerZachary Turner <zturner@google.com>2018-10-25 20:45:19 +0000
commit991e44534a822a5c968ed85a0cce1cc529ad9e57 (patch)
tree361e1fc79b13bf85ff0cb4c6ee74044ec4f58219 /lldb/source/Core/Module.cpp
parent970f38ead68b1767599a86930c93112f721c21be (diff)
downloadbcm5719-llvm-991e44534a822a5c968ed85a0cce1cc529ad9e57.tar.gz
bcm5719-llvm-991e44534a822a5c968ed85a0cce1cc529ad9e57.zip
Don't type-erase the SymbolContextItem enumeration.
When we get the `resolve_scope` parameter from the SB API, it's a `uint32_t`. We then pass it through all of LLDB this way, as a uint32. This is unfortunate, because it means the user of an API never actually knows what they're dealing with. We can call it something like `resolve_scope` and have comments saying "this is a value from the `SymbolContextItem` enumeration, but it makes more sense to just have it actually *be* the correct type in the actual C++ type system to begin with. This way the person reading the code just knows what it is. The reason to use integers instead of enumerations for flags is because when you do bitwise operations on enumerations they get promoted to integers, so it makes it tedious to constantly be casting them back to the enumeration types, so I've introduced a macro to make this happen magically. By writing LLDB_MARK_AS_BITMASK_ENUM after defining an enumeration, it will define overloaded operators so that the returned type will be the original enum. This should address all the mechanical issues surrounding using rich enum types directly. This way, we get a better debugger experience, and new users to the codebase can get more easily acquainted with the codebase because their IDE features can help them understand what the types mean. Differential Revision: https://reviews.llvm.org/D53597 llvm-svn: 345313
Diffstat (limited to 'lldb/source/Core/Module.cpp')
-rw-r--r--lldb/source/Core/Module.cpp20
1 files changed, 8 insertions, 12 deletions
diff --git a/lldb/source/Core/Module.cpp b/lldb/source/Core/Module.cpp
index 8cb60dcdf23..aa35c4fb0c0 100644
--- a/lldb/source/Core/Module.cpp
+++ b/lldb/source/Core/Module.cpp
@@ -433,8 +433,8 @@ bool Module::ResolveFileAddress(lldb::addr_t vm_addr, Address &so_addr) {
}
uint32_t Module::ResolveSymbolContextForAddress(
- const Address &so_addr, uint32_t resolve_scope, SymbolContext &sc,
- bool resolve_tail_call_address) {
+ const Address &so_addr, lldb::SymbolContextItem resolve_scope,
+ SymbolContext &sc, bool resolve_tail_call_address) {
std::lock_guard<std::recursive_mutex> guard(m_mutex);
uint32_t resolved_flags = 0;
@@ -566,21 +566,17 @@ uint32_t Module::ResolveSymbolContextForAddress(
return resolved_flags;
}
-uint32_t Module::ResolveSymbolContextForFilePath(const char *file_path,
- uint32_t line,
- bool check_inlines,
- uint32_t resolve_scope,
- SymbolContextList &sc_list) {
+uint32_t Module::ResolveSymbolContextForFilePath(
+ const char *file_path, uint32_t line, bool check_inlines,
+ lldb::SymbolContextItem resolve_scope, SymbolContextList &sc_list) {
FileSpec file_spec(file_path, false);
return ResolveSymbolContextsForFileSpec(file_spec, line, check_inlines,
resolve_scope, sc_list);
}
-uint32_t Module::ResolveSymbolContextsForFileSpec(const FileSpec &file_spec,
- uint32_t line,
- bool check_inlines,
- uint32_t resolve_scope,
- SymbolContextList &sc_list) {
+uint32_t Module::ResolveSymbolContextsForFileSpec(
+ const FileSpec &file_spec, uint32_t line, bool check_inlines,
+ lldb::SymbolContextItem resolve_scope, SymbolContextList &sc_list) {
std::lock_guard<std::recursive_mutex> guard(m_mutex);
static Timer::Category func_cat(LLVM_PRETTY_FUNCTION);
Timer scoped_timer(func_cat,
OpenPOWER on IntegriCloud