This is an archive of the discontinued LLVM Phabricator instance.

Refactor ClangUserExpression::GetLanguageForExpr
ClosedPublic

Authored by teemperor on Sep 26 2018, 10:00 AM.

Details

Summary

The ClangUserExpression::GetLanguageForExpr method is currently a big
source of sadness, as it's name implies that it's an accessor method, but it actually
is also initializing some variables that we need for parsing. This caused that we
currently call this getter just for it's side effects while ignoring it's return value,
which is confusing for the reader.

This patch renames it to UpdateLanguageForExpr and merges all calls to the
method into a single call in ClangUserExpression::PrepareForParsing (as calling
this method is anyway mandatory for parsing to succeed)

While looking at the code, I also found that we actually have two language
variables in this class hierarchy. The normal Language from the UserExpression
class and the LanguageForExpr that we implemented in this subclass. Both
don't seem to actually contain the same value, so we probably should look at this
next.

Diff Detail

Repository
rLLDB LLDB

Event Timeline

teemperor created this revision.Sep 26 2018, 10:00 AM
xbolva00 accepted this revision.Sep 27 2018, 1:05 AM

looks fine, thanks :)

This revision is now accepted and ready to land.Sep 27 2018, 1:05 AM
This revision was automatically updated to reflect the committed changes.