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
diff --git a/lldb/source/API/SBAddress.cpp b/lldb/source/API/SBAddress.cpp
index d12197e..2db447a 100644
--- a/lldb/source/API/SBAddress.cpp
+++ b/lldb/source/API/SBAddress.cpp
@@ -198,8 +198,9 @@
 
 SBSymbolContext SBAddress::GetSymbolContext(uint32_t resolve_scope) {
   SBSymbolContext sb_sc;
+  SymbolContextItem scope = static_cast<SymbolContextItem>(resolve_scope);
   if (m_opaque_ap->IsValid())
-    m_opaque_ap->CalculateSymbolContext(&sb_sc.ref(), resolve_scope);
+    m_opaque_ap->CalculateSymbolContext(&sb_sc.ref(), scope);
   return sb_sc;
 }
 
diff --git a/lldb/source/API/SBFrame.cpp b/lldb/source/API/SBFrame.cpp
index b1c9cb6..8a9088d 100644
--- a/lldb/source/API/SBFrame.cpp
+++ b/lldb/source/API/SBFrame.cpp
@@ -112,7 +112,7 @@
   SBSymbolContext sb_sym_ctx;
   std::unique_lock<std::recursive_mutex> lock;
   ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
-
+  SymbolContextItem scope = static_cast<SymbolContextItem>(resolve_scope);
   StackFrame *frame = nullptr;
   Target *target = exe_ctx.GetTargetPtr();
   Process *process = exe_ctx.GetProcessPtr();
@@ -121,7 +121,7 @@
     if (stop_locker.TryLock(&process->GetRunLock())) {
       frame = exe_ctx.GetFramePtr();
       if (frame) {
-        sb_sym_ctx.SetSymbolContext(&frame->GetSymbolContext(resolve_scope));
+        sb_sym_ctx.SetSymbolContext(&frame->GetSymbolContext(scope));
       } else {
         if (log)
           log->Printf("SBFrame::GetVariables () => error: could not "
diff --git a/lldb/source/API/SBModule.cpp b/lldb/source/API/SBModule.cpp
index 3dd99d5..3b1726e 100644
--- a/lldb/source/API/SBModule.cpp
+++ b/lldb/source/API/SBModule.cpp
@@ -217,9 +217,9 @@
                                          uint32_t resolve_scope) {
   SBSymbolContext sb_sc;
   ModuleSP module_sp(GetSP());
+  SymbolContextItem scope = static_cast<SymbolContextItem>(resolve_scope);
   if (module_sp && addr.IsValid())
-    module_sp->ResolveSymbolContextForAddress(addr.ref(), resolve_scope,
-                                              *sb_sc);
+    module_sp->ResolveSymbolContextForAddress(addr.ref(), scope, *sb_sc);
   return sb_sc;
 }
 
diff --git a/lldb/source/API/SBTarget.cpp b/lldb/source/API/SBTarget.cpp
index d550de1..2d2c6bd 100644
--- a/lldb/source/API/SBTarget.cpp
+++ b/lldb/source/API/SBTarget.cpp
@@ -660,11 +660,12 @@
 SBTarget::ResolveSymbolContextForAddress(const SBAddress &addr,
                                          uint32_t resolve_scope) {
   SBSymbolContext sc;
+  SymbolContextItem scope = static_cast<SymbolContextItem>(resolve_scope);
   if (addr.IsValid()) {
     TargetSP target_sp(GetSP());
     if (target_sp)
-      target_sp->GetImages().ResolveSymbolContextForAddress(
-          addr.ref(), resolve_scope, sc.ref());
+      target_sp->GetImages().ResolveSymbolContextForAddress(addr.ref(), scope,
+                                                            sc.ref());
   }
   return sc;
 }
diff --git a/lldb/source/Commands/CommandObjectSource.cpp b/lldb/source/Commands/CommandObjectSource.cpp
index a1e3285..d321afd 100644
--- a/lldb/source/Commands/CommandObjectSource.cpp
+++ b/lldb/source/Commands/CommandObjectSource.cpp
@@ -1210,7 +1210,9 @@
             target->GetImages().FindModules(module_spec, matching_modules);
             num_matches += matching_modules.ResolveSymbolContextForFilePath(
                 filename, 0, check_inlines,
-                eSymbolContextModule | eSymbolContextCompUnit, sc_list);
+                SymbolContextItem(eSymbolContextModule |
+                                  eSymbolContextCompUnit),
+                sc_list);
           }
         }
       } else {
diff --git a/lldb/source/Core/Address.cpp b/lldb/source/Core/Address.cpp
index f183245..88b530e 100644
--- a/lldb/source/Core/Address.cpp
+++ b/lldb/source/Core/Address.cpp
@@ -779,8 +779,9 @@
          m_section_wp.owner_before(empty_section_wp);
 }
 
-uint32_t Address::CalculateSymbolContext(SymbolContext *sc,
-                                         uint32_t resolve_scope) const {
+uint32_t
+Address::CalculateSymbolContext(SymbolContext *sc,
+                                SymbolContextItem resolve_scope) const {
   sc->Clear(false);
   // Absolute addresses don't have enough information to reconstruct even their
   // target.
diff --git a/lldb/source/Core/Disassembler.cpp b/lldb/source/Core/Disassembler.cpp
index d41a194..b72e210 100644
--- a/lldb/source/Core/Disassembler.cpp
+++ b/lldb/source/Core/Disassembler.cpp
@@ -429,9 +429,9 @@
       const Address &addr = inst->GetAddress();
       ModuleSP module_sp(addr.GetModule());
       if (module_sp) {
-        const uint32_t resolve_mask = eSymbolContextFunction |
-                                      eSymbolContextSymbol |
-                                      eSymbolContextLineEntry;
+        const SymbolContextItem resolve_mask = eSymbolContextFunction |
+                                               eSymbolContextSymbol |
+                                               eSymbolContextLineEntry;
         uint32_t resolved_mask =
             module_sp->ResolveSymbolContextForAddress(addr, resolve_mask, sc);
         if (resolved_mask) {
diff --git a/lldb/source/Core/Module.cpp b/lldb/source/Core/Module.cpp
index 8cb60dc..aa35c4f 100644
--- a/lldb/source/Core/Module.cpp
+++ b/lldb/source/Core/Module.cpp
@@ -433,8 +433,8 @@
 }
 
 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 @@
   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,
diff --git a/lldb/source/Core/ModuleList.cpp b/lldb/source/Core/ModuleList.cpp
index 81c9c4a..3ce294c 100644
--- a/lldb/source/Core/ModuleList.cpp
+++ b/lldb/source/Core/ModuleList.cpp
@@ -662,9 +662,10 @@
   return false;
 }
 
-uint32_t ModuleList::ResolveSymbolContextForAddress(const Address &so_addr,
-                                                    uint32_t resolve_scope,
-                                                    SymbolContext &sc) const {
+uint32_t
+ModuleList::ResolveSymbolContextForAddress(const Address &so_addr,
+                                           SymbolContextItem resolve_scope,
+                                           SymbolContext &sc) const {
   // The address is already section offset so it has a module
   uint32_t resolved_flags = 0;
   ModuleSP module_sp(so_addr.GetModule());
@@ -687,7 +688,7 @@
 
 uint32_t ModuleList::ResolveSymbolContextForFilePath(
     const char *file_path, uint32_t line, bool check_inlines,
-    uint32_t resolve_scope, SymbolContextList &sc_list) const {
+    SymbolContextItem resolve_scope, SymbolContextList &sc_list) const {
   FileSpec file_spec(file_path, false);
   return ResolveSymbolContextsForFileSpec(file_spec, line, check_inlines,
                                           resolve_scope, sc_list);
@@ -695,7 +696,7 @@
 
 uint32_t ModuleList::ResolveSymbolContextsForFileSpec(
     const FileSpec &file_spec, uint32_t line, bool check_inlines,
-    uint32_t resolve_scope, SymbolContextList &sc_list) const {
+    SymbolContextItem resolve_scope, SymbolContextList &sc_list) const {
   std::lock_guard<std::recursive_mutex> guard(m_modules_mutex);
   collection::const_iterator pos, end = m_modules.end();
   for (pos = m_modules.begin(); pos != end; ++pos) {
diff --git a/lldb/source/Core/SourceManager.cpp b/lldb/source/Core/SourceManager.cpp
index 5522852..590410a 100644
--- a/lldb/source/Core/SourceManager.cpp
+++ b/lldb/source/Core/SourceManager.cpp
@@ -397,7 +397,8 @@
         size_t num_matches =
             target->GetImages().ResolveSymbolContextForFilePath(
                 file_spec.GetFilename().AsCString(), 0, check_inlines,
-                lldb::eSymbolContextModule | lldb::eSymbolContextCompUnit,
+                SymbolContextItem(eSymbolContextModule |
+                                  eSymbolContextCompUnit),
                 sc_list);
         bool got_multiple = false;
         if (num_matches != 0) {
diff --git a/lldb/source/Plugins/Architecture/Mips/ArchitectureMips.cpp b/lldb/source/Plugins/Architecture/Mips/ArchitectureMips.cpp
index 58230a5..a8f99e2 100644
--- a/lldb/source/Plugins/Architecture/Mips/ArchitectureMips.cpp
+++ b/lldb/source/Plugins/Architecture/Mips/ArchitectureMips.cpp
@@ -96,7 +96,8 @@
   ModuleSP temp_addr_module_sp(resolved_addr.GetModule());
   if (temp_addr_module_sp) {
     SymbolContext sc;
-    uint32_t resolve_scope = eSymbolContextFunction | eSymbolContextSymbol;
+    SymbolContextItem resolve_scope =
+        eSymbolContextFunction | eSymbolContextSymbol;
     temp_addr_module_sp->ResolveSymbolContextForAddress(resolved_addr,
       resolve_scope, sc);
     Address sym_addr;
diff --git a/lldb/source/Plugins/Disassembler/llvm/DisassemblerLLVMC.cpp b/lldb/source/Plugins/Disassembler/llvm/DisassemblerLLVMC.cpp
index 20209e9a..cfbd627 100644
--- a/lldb/source/Plugins/Disassembler/llvm/DisassemblerLLVMC.cpp
+++ b/lldb/source/Plugins/Disassembler/llvm/DisassemblerLLVMC.cpp
@@ -1382,7 +1382,7 @@
       }
 
       SymbolContext sym_ctx;
-      const uint32_t resolve_scope =
+      const SymbolContextItem resolve_scope =
           eSymbolContextFunction | eSymbolContextSymbol;
       if (pc_so_addr.IsValid() && pc_so_addr.GetModule()) {
         pc_so_addr.GetModule()->ResolveSymbolContextForAddress(
diff --git a/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp b/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp
index 5961e6a..f5ecb52 100644
--- a/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp
+++ b/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp
@@ -3718,7 +3718,8 @@
       continue;
 
     // Find the function name
-    const SymbolContext sym_ctx = frame_sp->GetSymbolContext(false);
+    const SymbolContext sym_ctx =
+        frame_sp->GetSymbolContext(eSymbolContextFunction);
     const ConstString func_name = sym_ctx.GetFunctionName();
     if (!func_name)
       continue;
diff --git a/lldb/source/Plugins/Process/Utility/RegisterContextLLDB.cpp b/lldb/source/Plugins/Process/Utility/RegisterContextLLDB.cpp
index 664f325..e943c3d 100644
--- a/lldb/source/Plugins/Process/Utility/RegisterContextLLDB.cpp
+++ b/lldb/source/Plugins/Process/Utility/RegisterContextLLDB.cpp
@@ -150,7 +150,8 @@
 
   // We require either a symbol or function in the symbols context to be
   // successfully filled in or this context is of no use to us.
-  const uint32_t resolve_scope = eSymbolContextFunction | eSymbolContextSymbol;
+  const SymbolContextItem resolve_scope =
+      eSymbolContextFunction | eSymbolContextSymbol;
   if (pc_module_sp.get() && (pc_module_sp->ResolveSymbolContextForAddress(
                                  m_current_pc, resolve_scope, m_sym_ctx) &
                              resolve_scope)) {
@@ -436,7 +437,8 @@
   // then we might not find the correct unwind information later. Instead, let
   // ResolveSymbolContextForAddress fail, and handle the case via
   // decr_pc_and_recompute_addr_range below.
-  const uint32_t resolve_scope = eSymbolContextFunction | eSymbolContextSymbol;
+  const SymbolContextItem resolve_scope =
+      eSymbolContextFunction | eSymbolContextSymbol;
   uint32_t resolved_scope = pc_module_sp->ResolveSymbolContextForAddress(
       m_current_pc, resolve_scope, m_sym_ctx, resolve_tail_call_address);
 
@@ -494,7 +496,8 @@
     temporary_pc.SetLoadAddress(pc - 1, &process->GetTarget());
     m_sym_ctx.Clear(false);
     m_sym_ctx_valid = false;
-    uint32_t resolve_scope = eSymbolContextFunction | eSymbolContextSymbol;
+    SymbolContextItem resolve_scope =
+        eSymbolContextFunction | eSymbolContextSymbol;
 
     ModuleSP temporary_module_sp = temporary_pc.GetModule();
     if (temporary_module_sp &&
diff --git a/lldb/source/Plugins/Process/Utility/UnwindMacOSXFrameBackchain.cpp b/lldb/source/Plugins/Process/Utility/UnwindMacOSXFrameBackchain.cpp
index 2115b4e..ae0b9fb 100644
--- a/lldb/source/Plugins/Process/Utility/UnwindMacOSXFrameBackchain.cpp
+++ b/lldb/source/Plugins/Process/Utility/UnwindMacOSXFrameBackchain.cpp
@@ -114,7 +114,7 @@
   if (!m_cursors.empty()) {
     lldb::addr_t first_frame_pc = m_cursors.front().pc;
     if (first_frame_pc != LLDB_INVALID_ADDRESS) {
-      const uint32_t resolve_scope =
+      const SymbolContextItem resolve_scope =
           eSymbolContextModule | eSymbolContextCompUnit |
           eSymbolContextFunction | eSymbolContextSymbol;
 
@@ -205,7 +205,7 @@
   if (!m_cursors.empty()) {
     lldb::addr_t first_frame_pc = m_cursors.front().pc;
     if (first_frame_pc != LLDB_INVALID_ADDRESS) {
-      const uint32_t resolve_scope =
+      const SymbolContextItem resolve_scope =
           eSymbolContextModule | eSymbolContextCompUnit |
           eSymbolContextFunction | eSymbolContextSymbol;
 
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
index 41be820..b72ab2f 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
@@ -1777,7 +1777,7 @@
 }
 
 uint32_t SymbolFileDWARF::ResolveSymbolContext(const Address &so_addr,
-                                               uint32_t resolve_scope,
+                                               SymbolContextItem resolve_scope,
                                                SymbolContext &sc) {
   static Timer::Category func_cat(LLVM_PRETTY_FUNCTION);
   Timer scoped_timer(func_cat,
@@ -1911,7 +1911,7 @@
 uint32_t SymbolFileDWARF::ResolveSymbolContext(const FileSpec &file_spec,
                                                uint32_t line,
                                                bool check_inlines,
-                                               uint32_t resolve_scope,
+                                               SymbolContextItem resolve_scope,
                                                SymbolContextList &sc_list) {
   const uint32_t prev_size = sc_list.GetSize();
   if (resolve_scope & eSymbolContextCompUnit) {
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
index 80a9acb..c95044d 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
+++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
@@ -168,12 +168,13 @@
   ParseDeclsForContext(lldb_private::CompilerDeclContext decl_ctx) override;
 
   uint32_t ResolveSymbolContext(const lldb_private::Address &so_addr,
-                                uint32_t resolve_scope,
+                                lldb::SymbolContextItem resolve_scope,
                                 lldb_private::SymbolContext &sc) override;
 
   uint32_t
   ResolveSymbolContext(const lldb_private::FileSpec &file_spec, uint32_t line,
-                       bool check_inlines, uint32_t resolve_scope,
+                       bool check_inlines,
+                       lldb::SymbolContextItem resolve_scope,
                        lldb_private::SymbolContextList &sc_list) override;
 
   uint32_t
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
index 4c91686..80a018f 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
@@ -717,8 +717,10 @@
   return success;
 }
 
-uint32_t SymbolFileDWARFDebugMap::ResolveSymbolContext(
-    const Address &exe_so_addr, uint32_t resolve_scope, SymbolContext &sc) {
+uint32_t
+SymbolFileDWARFDebugMap::ResolveSymbolContext(const Address &exe_so_addr,
+                                              SymbolContextItem resolve_scope,
+                                              SymbolContext &sc) {
   uint32_t resolved_flags = 0;
   Symtab *symtab = m_obj_file->GetSymtab();
   if (symtab) {
@@ -760,7 +762,7 @@
 
 uint32_t SymbolFileDWARFDebugMap::ResolveSymbolContext(
     const FileSpec &file_spec, uint32_t line, bool check_inlines,
-    uint32_t resolve_scope, SymbolContextList &sc_list) {
+    SymbolContextItem resolve_scope, SymbolContextList &sc_list) {
   const uint32_t initial = sc_list.GetSize();
   const uint32_t cu_count = GetNumCompileUnits();
 
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h
index 4bb9af0..c29ea17 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h
+++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h
@@ -86,11 +86,12 @@
 
   bool CompleteType(lldb_private::CompilerType &compiler_type) override;
   uint32_t ResolveSymbolContext(const lldb_private::Address &so_addr,
-                                uint32_t resolve_scope,
+                                lldb::SymbolContextItem resolve_scope,
                                 lldb_private::SymbolContext &sc) override;
   uint32_t
   ResolveSymbolContext(const lldb_private::FileSpec &file_spec, uint32_t line,
-                       bool check_inlines, uint32_t resolve_scope,
+                       bool check_inlines,
+                       lldb::SymbolContextItem resolve_scope,
                        lldb_private::SymbolContextList &sc_list) override;
   uint32_t
   FindGlobalVariables(const lldb_private::ConstString &name,
diff --git a/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp b/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
index 9d3eeb9..34440da 100644
--- a/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
+++ b/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
@@ -960,9 +960,8 @@
   return (resolve_scope & flags) != 0;
 }
 
-uint32_t SymbolFileNativePDB::ResolveSymbolContext(const Address &addr,
-                                                   uint32_t resolve_scope,
-                                                   SymbolContext &sc) {
+uint32_t SymbolFileNativePDB::ResolveSymbolContext(
+    const Address &addr, SymbolContextItem resolve_scope, SymbolContext &sc) {
   uint32_t resolved_flags = 0;
   lldb::addr_t file_addr = addr.GetFileAddress();
 
diff --git a/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.h b/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.h
index ec52bda..8b5e8cb 100644
--- a/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.h
+++ b/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.h
@@ -109,7 +109,8 @@
   }
   Type *ResolveTypeUID(lldb::user_id_t type_uid) override;
   bool CompleteType(CompilerType &compiler_type) override;
-  uint32_t ResolveSymbolContext(const Address &so_addr, uint32_t resolve_scope,
+  uint32_t ResolveSymbolContext(const Address &so_addr,
+                                lldb::SymbolContextItem resolve_scope,
                                 SymbolContext &sc) override;
 
   size_t GetTypes(SymbolContextScope *sc_scope, uint32_t type_mask,
diff --git a/lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp b/lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp
index d4dad89..9ea484d 100644
--- a/lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp
+++ b/lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp
@@ -684,7 +684,7 @@
 
 uint32_t
 SymbolFilePDB::ResolveSymbolContext(const lldb_private::Address &so_addr,
-                                    uint32_t resolve_scope,
+                                    SymbolContextItem resolve_scope,
                                     lldb_private::SymbolContext &sc) {
   uint32_t resolved_flags = 0;
   if (resolve_scope & eSymbolContextCompUnit ||
@@ -744,7 +744,7 @@
 
 uint32_t SymbolFilePDB::ResolveSymbolContext(
     const lldb_private::FileSpec &file_spec, uint32_t line, bool check_inlines,
-    uint32_t resolve_scope, lldb_private::SymbolContextList &sc_list) {
+    SymbolContextItem resolve_scope, lldb_private::SymbolContextList &sc_list) {
   const size_t old_size = sc_list.GetSize();
   if (resolve_scope & lldb::eSymbolContextCompUnit) {
     // Locate all compilation units with line numbers referencing the specified
diff --git a/lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.h b/lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.h
index 4384d72..6bb196b 100644
--- a/lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.h
+++ b/lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.h
@@ -100,12 +100,13 @@
   ParseDeclsForContext(lldb_private::CompilerDeclContext decl_ctx) override;
 
   uint32_t ResolveSymbolContext(const lldb_private::Address &so_addr,
-                                uint32_t resolve_scope,
+                                lldb::SymbolContextItem resolve_scope,
                                 lldb_private::SymbolContext &sc) override;
 
   uint32_t
   ResolveSymbolContext(const lldb_private::FileSpec &file_spec, uint32_t line,
-                       bool check_inlines, uint32_t resolve_scope,
+                       bool check_inlines,
+                       lldb::SymbolContextItem resolve_scope,
                        lldb_private::SymbolContextList &sc_list) override;
 
   uint32_t
diff --git a/lldb/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp b/lldb/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp
index 64e2daf..b3d57b8 100644
--- a/lldb/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp
+++ b/lldb/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp
@@ -244,7 +244,7 @@
 }
 
 uint32_t SymbolFileSymtab::ResolveSymbolContext(const Address &so_addr,
-                                                uint32_t resolve_scope,
+                                                SymbolContextItem resolve_scope,
                                                 SymbolContext &sc) {
   if (m_obj_file->GetSymtab() == NULL)
     return 0;
diff --git a/lldb/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.h b/lldb/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.h
index d1887a7..1e6ad9f 100644
--- a/lldb/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.h
+++ b/lldb/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.h
@@ -84,7 +84,7 @@
   bool CompleteType(lldb_private::CompilerType &compiler_type) override;
 
   uint32_t ResolveSymbolContext(const lldb_private::Address &so_addr,
-                                uint32_t resolve_scope,
+                                lldb::SymbolContextItem resolve_scope,
                                 lldb_private::SymbolContext &sc) override;
 
   size_t GetTypes(lldb_private::SymbolContextScope *sc_scope,
diff --git a/lldb/source/Symbol/CompileUnit.cpp b/lldb/source/Symbol/CompileUnit.cpp
index 7302561..8f8a331 100644
--- a/lldb/source/Symbol/CompileUnit.cpp
+++ b/lldb/source/Symbol/CompileUnit.cpp
@@ -278,7 +278,8 @@
 
 uint32_t CompileUnit::ResolveSymbolContext(const FileSpec &file_spec,
                                            uint32_t line, bool check_inlines,
-                                           bool exact, uint32_t resolve_scope,
+                                           bool exact,
+                                           SymbolContextItem resolve_scope,
                                            SymbolContextList &sc_list) {
   // First find all of the file indexes that match our "file_spec". If
   // "file_spec" has an empty directory, then only compare the basenames when
diff --git a/lldb/source/Symbol/SymbolFile.cpp b/lldb/source/Symbol/SymbolFile.cpp
index 4bf7e5b..27957796 100644
--- a/lldb/source/Symbol/SymbolFile.cpp
+++ b/lldb/source/Symbol/SymbolFile.cpp
@@ -97,7 +97,7 @@
 
 uint32_t SymbolFile::ResolveSymbolContext(const FileSpec &file_spec,
                                           uint32_t line, bool check_inlines,
-                                          uint32_t resolve_scope,
+                                          lldb::SymbolContextItem resolve_scope,
                                           SymbolContextList &sc_list) {
   return 0;
 }
diff --git a/lldb/source/Symbol/SymbolVendor.cpp b/lldb/source/Symbol/SymbolVendor.cpp
index 245f7bb..f4b4852 100644
--- a/lldb/source/Symbol/SymbolVendor.cpp
+++ b/lldb/source/Symbol/SymbolVendor.cpp
@@ -235,7 +235,7 @@
 }
 
 uint32_t SymbolVendor::ResolveSymbolContext(const Address &so_addr,
-                                            uint32_t resolve_scope,
+                                            SymbolContextItem resolve_scope,
                                             SymbolContext &sc) {
   ModuleSP module_sp(GetModule());
   if (module_sp) {
@@ -248,7 +248,7 @@
 
 uint32_t SymbolVendor::ResolveSymbolContext(const FileSpec &file_spec,
                                             uint32_t line, bool check_inlines,
-                                            uint32_t resolve_scope,
+                                            SymbolContextItem resolve_scope,
                                             SymbolContextList &sc_list) {
   ModuleSP module_sp(GetModule());
   if (module_sp) {
diff --git a/lldb/source/Target/StackFrame.cpp b/lldb/source/Target/StackFrame.cpp
index 5ed1509..00be79d 100644
--- a/lldb/source/Target/StackFrame.cpp
+++ b/lldb/source/Target/StackFrame.cpp
@@ -35,6 +35,8 @@
 #include "lldb/Target/Thread.h"
 #include "lldb/Utility/RegisterValue.h"
 
+#include "lldb/lldb-enumerations.h"
+
 using namespace lldb;
 using namespace lldb_private;
 
@@ -262,7 +264,8 @@
 // StackFrame object, everyone will have as much information as possible and no
 // one will ever have to look things up manually.
 //----------------------------------------------------------------------
-const SymbolContext &StackFrame::GetSymbolContext(uint32_t resolve_scope) {
+const SymbolContext &
+StackFrame::GetSymbolContext(SymbolContextItem resolve_scope) {
   std::lock_guard<std::recursive_mutex> guard(m_mutex);
   // Copy our internal symbol context into "sc".
   if ((m_flags.Get() & resolve_scope) != resolve_scope) {
@@ -314,7 +317,7 @@
       // haven't already tried to lookup one of those things. If we haven't
       // then we will do the query.
 
-      uint32_t actual_resolve_scope = 0;
+      SymbolContextItem actual_resolve_scope = SymbolContextItem(0);
 
       if (resolve_scope & eSymbolContextCompUnit) {
         if (m_flags.IsClear(eSymbolContextCompUnit)) {