[Lldb-commits] [PATCH] D65165: [Symbol] Fix some botched logic in Variable::GetLanguage
Pavel Labath via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Wed Jul 24 00:29:39 PDT 2019
labath accepted this revision.
labath added a comment.
This revision is now accepted and ready to land.
Thanks for responding quickly. LGTM, with one comment..
================
Comment at: source/Symbol/Variable.cpp:62
if (auto *func = m_owner_scope->CalculateSymbolContextFunction()) {
- if ((lang = func->GetLanguage()) && lang != lldb::eLanguageTypeUnknown)
+ if ((lang = func->GetLanguage()))
+ return lang;
----------------
if you want to keep the assignment in the if condition, then I think the best way to express that would be to say `if((lang = func->GetLanguage()) != lldb::eLanguageTypeUnknown)`. That way one does not have to wonder "why is this code checking the zero value too and what does that mean?", and the check against `eLanguageTypeUnknown` is still explicit.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D65165/new/
https://reviews.llvm.org/D65165
More information about the lldb-commits
mailing list