summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2018-11-30 11:38:19 +0100
committerStephan Bergmann <sbergman@redhat.com>2018-11-30 15:59:54 +0100
commit9eff2ebf388fc967409590d050037cc7400ceec4 (patch)
tree7cf35d7f0da011576cee3ea158b7b120435325eb
parent37688ce6be8cd15a57cae4c1b70ac47925079026 (diff)
Make some loplugin:implicitboolconversion code use TypeCheck
Change-Id: If675d629784894573085122beadc6abc3e67f457 Reviewed-on: https://gerrit.libreoffice.org/64335 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
-rw-r--r--compilerplugins/clang/implicitboolconversion.cxx9
1 files changed, 3 insertions, 6 deletions
diff --git a/compilerplugins/clang/implicitboolconversion.cxx b/compilerplugins/clang/implicitboolconversion.cxx
index 8080c1c2ae13..a6ff1c53c26d 100644
--- a/compilerplugins/clang/implicitboolconversion.cxx
+++ b/compilerplugins/clang/implicitboolconversion.cxx
@@ -654,12 +654,9 @@ bool ImplicitBoolConversion::TraverseBinAssign(BinaryOperator * expr) {
if (fd != nullptr && fd->isBitField()
&& fd->getBitWidthValue(compiler.getASTContext()) == 1)
{
- TypedefType const * t = fd->getType()->getAs<TypedefType>();
- if (t != nullptr)
- {
- std::string sTypeName = t->getDecl()->getNameAsString();
- bExt = (sTypeName == "guint" || sTypeName == "quint64");
- }
+ auto const check = loplugin::TypeCheck(fd->getType());
+ bExt = check.Typedef("guint").GlobalNamespace()
+ || check.Typedef("quint64").GlobalNamespace();
}
}
assert(!nested.empty());