[Lldb-commits] [PATCH] D64042: [Symbol] Improve Variable::GetLanguage
Alex Langford via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Mon Jul 22 13:15:29 PDT 2019
This revision was automatically updated to reflect the committed changes.
Closed by commit rL366733: [Symbol] Improve Variable::GetLanguage (authored by xiaobai, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
Changed prior to commit:
https://reviews.llvm.org/D64042?vs=207422&id=211174#toc
Repository:
rL LLVM
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D64042/new/
https://reviews.llvm.org/D64042
Files:
lldb/trunk/source/Core/ValueObject.cpp
lldb/trunk/source/Symbol/Variable.cpp
Index: lldb/trunk/source/Core/ValueObject.cpp
===================================================================
--- lldb/trunk/source/Core/ValueObject.cpp
+++ lldb/trunk/source/Core/ValueObject.cpp
@@ -1672,16 +1672,7 @@
if (!GetVariable() || !GetVariable()->IsArtificial())
return false;
- LanguageType lang = eLanguageTypeUnknown;
- if (auto *sym_ctx_scope = GetSymbolContextScope()) {
- if (auto *func = sym_ctx_scope->CalculateSymbolContextFunction())
- lang = func->GetLanguage();
- else if (auto *comp_unit =
- sym_ctx_scope->CalculateSymbolContextCompileUnit())
- lang = comp_unit->GetLanguage();
- }
-
- if (auto *runtime = process->GetLanguageRuntime(lang))
+ if (auto *runtime = process->GetLanguageRuntime(GetVariable()->GetLanguage()))
if (runtime->IsWhitelistedRuntimeValue(GetName()))
return false;
Index: lldb/trunk/source/Symbol/Variable.cpp
===================================================================
--- lldb/trunk/source/Symbol/Variable.cpp
+++ lldb/trunk/source/Symbol/Variable.cpp
@@ -54,10 +54,19 @@
Variable::~Variable() {}
lldb::LanguageType Variable::GetLanguage() const {
- SymbolContext variable_sc;
- m_owner_scope->CalculateSymbolContext(&variable_sc);
- if (variable_sc.comp_unit)
- return variable_sc.comp_unit->GetLanguage();
+ lldb::LanguageType lang = m_mangled.GuessLanguage();
+ if (lang != lldb::eLanguageTypeUnknown)
+ return lang;
+
+ if (auto *func = m_owner_scope->CalculateSymbolContextFunction()) {
+ if ((lang = func->GetLanguage()) && lang != lldb::eLanguageTypeUnknown)
+ return lang;
+ else if (auto *comp_unit =
+ m_owner_scope->CalculateSymbolContextCompileUnit())
+ if ((lang = func->GetLanguage()) && lang != lldb::eLanguageTypeUnknown)
+ return lang;
+ }
+
return lldb::eLanguageTypeUnknown;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D64042.211174.patch
Type: text/x-patch
Size: 1879 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20190722/824bf310/attachment.bin>
More information about the lldb-commits
mailing list