diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2015-04-27 15:30:34 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2015-04-27 15:31:04 +0200 |
commit | dbb75877c2efe075e85365dbbb315fcc25656292 (patch) | |
tree | 4a32f3e759b0cf792527bb9cc5eea749d9f57f4e /compilerplugins | |
parent | 6f287989fb26c0972bf3dde045acce70c349d90e (diff) |
loplugin:simplifybool: Need to ignore imp. casts when determining literals
Change-Id: I6b25ef369a9d445322f7500630a6a4ed38ae7d8f
Diffstat (limited to 'compilerplugins')
-rw-r--r-- | compilerplugins/clang/simplifybool.cxx | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/compilerplugins/clang/simplifybool.cxx b/compilerplugins/clang/simplifybool.cxx index e30d408e9faf..9f82660dd29f 100644 --- a/compilerplugins/clang/simplifybool.cxx +++ b/compilerplugins/clang/simplifybool.cxx @@ -31,6 +31,7 @@ Expr const * getSubExprOfLogicalNegation(Expr const * expr) { enum class Value { Unknown, False, True }; Value getValue(Expr const * expr) { + expr = ignoreParenImpCastAndComma(expr); if (expr->getType()->isBooleanType()) { // Instead going via Expr::isCXX11ConstantExpr would turn up excatly one // additional place in svx/source/dialog/framelinkarray.cxx @@ -41,8 +42,7 @@ Value getValue(Expr const * expr) { // // where it is unclear whether it is not actually better to consider // DIAG_DBL_CLIP_DEFAULT a tunable parameter (and thus not to simplify): - auto lit - = dyn_cast<CXXBoolLiteralExpr>(ignoreParenImpCastAndComma(expr)); + auto lit = dyn_cast<CXXBoolLiteralExpr>(expr); if (lit != nullptr) { return lit->getValue() ? Value::True : Value::False; } |