This is an archive of the discontinued LLVM Phabricator instance.

[Symbol] Fix some botched logic in Variable::GetLanguage
ClosedPublic

Authored by xiaobai on Jul 23 2019, 1:30 PM.

Diff Detail

Repository
rL LLVM

Event Timeline

xiaobai created this revision.Jul 23 2019, 1:30 PM
jdoerfert resigned from this revision.Jul 23 2019, 9:06 PM
labath accepted this revision.Jul 24 2019, 12:28 AM

Thanks for responding quickly. LGTM, with one comment..

source/Symbol/Variable.cpp
62 ↗(On Diff #211352)

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.

This revision is now accepted and ready to land.Jul 24 2019, 12:28 AM

Thanks for responding quickly. LGTM, with one comment..

Don't use checks that assume eLanguageTypeUnknown == 0, that seems really confusing and we don't use that practice anywhere else. Pavel's suggestion seems fine.

JDevlieghere accepted this revision.Jul 24 2019, 11:10 AM

LGTM with Pavel's suggestion.

xiaobai updated this revision to Diff 211607.Jul 24 2019, 3:10 PM

Implement suggestion

This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptJul 24 2019, 3:14 PM