[Lldb-commits] [PATCH] D52561: Refactor ClangUserExpression::GetLanguageForExpr

Raphael Isemann via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Wed Sep 26 10:00:44 PDT 2018


teemperor created this revision.
teemperor added a reviewer: xbolva00.
Herald added a subscriber: lldb-commits.

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.


Repository:
  rLLDB LLDB

https://reviews.llvm.org/D52561

Files:
  source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp
  source/Plugins/ExpressionParser/Clang/ClangUserExpression.h

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D52561.167155.patch
Type: text/x-patch
Size: 4664 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20180926/fb8f9843/attachment.bin>


More information about the lldb-commits mailing list