avmedia/source/gstreamer/gstplayer.cxx                              |    2 
 compilerplugins/clang/fakebool.cxx                                  |  720 
++++++----
 compilerplugins/clang/test/fakebool.cxx                             |    6 
 connectivity/source/drivers/evoab2/NResultSet.cxx                   |    2 
 connectivity/source/drivers/jdbc/DatabaseMetaData.cxx               |    8 
 connectivity/source/drivers/jdbc/JStatement.cxx                     |    2 
 connectivity/source/drivers/jdbc/Object.cxx                         |    4 
 connectivity/source/drivers/jdbc/Reader.cxx                         |    2 
 connectivity/source/drivers/mysqlc/mysqlc_prepared_resultset.cxx    |    4 
 connectivity/source/drivers/mysqlc/mysqlc_preparedstatement.cxx     |   32 
 connectivity/source/drivers/mysqlc/mysqlc_preparedstatement.hxx     |    4 
 javaunohelper/source/javaunohelper.cxx                              |    2 
 libreofficekit/qa/gtktiledviewer/gtv-calc-header-bar.cxx            |    2 
 libreofficekit/qa/gtktiledviewer/gtv-lokdocview-signal-handlers.cxx |    8 
 libreofficekit/source/gtk/lokdocview.cxx                            |   32 
 solenv/CompilerTest_compilerplugins_clang.mk                        |    2 
 solenv/clang-format/blacklist                                       |    4 
 ucb/source/ucp/gio/gio_content.cxx                                  |    2 
 vcl/source/gdi/scrptrun.cxx                                         |    2 
 vcl/unx/gtk3/a11y/gtk3atklistener.cxx                               |    2 
 vcl/unx/gtk3/fpicker/SalGtkFilePicker.cxx                           |    4 
 vcl/unx/gtk3/gtk3gloactiongroup.cxx                                 |    4 
 vcl/unx/gtk3/gtk3glomenu.cxx                                        |    2 
 vcl/unx/gtk3/gtk3gtkdata.cxx                                        |    2 
 vcl/unx/gtk3/gtk3gtkframe.cxx                                       |    8 
 vcl/unx/gtk3/gtk3gtkinst.cxx                                        |   16 
 26 files changed, 553 insertions(+), 325 deletions(-)

New commits:
commit 913d34ec6b8fdb2796f76ce90fee51ade2051189
Author:     Stephan Bergmann <sberg...@redhat.com>
AuthorDate: Tue Nov 12 21:53:31 2019 +0100
Commit:     Stephan Bergmann <sberg...@redhat.com>
CommitDate: Wed Nov 13 15:06:42 2019 +0100

    Extend loplugin:salbool to loplugin:fakebool
    
    ...checking for unnecessary uses of more "fake bool" types.
    
    In the past, some of the checks involving the types of variables or data
    members, or the return types of functions, issued warnings that required
    surrounding code to be changed too (e.g., when changing the signature of a
    function whose address was taken).  These checks have been tightened now to 
not
    warn in such cases (which avoids warnings that require changes to additional
    code, or changes that might even be impossible to make, at the cost of being
    less aggressive about removing all unnecessary uses of those "fake bool" 
types).
    
    Change-Id: I70eb75039817cda34ed611387ee27dc5f36a3e2e
    Reviewed-on: https://gerrit.libreoffice.org/82554
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <sberg...@redhat.com>

diff --git a/avmedia/source/gstreamer/gstplayer.cxx 
b/avmedia/source/gstreamer/gstplayer.cxx
index 4612c1053998..764a27639eb5 100644
--- a/avmedia/source/gstreamer/gstplayer.cxx
+++ b/avmedia/source/gstreamer/gstplayer.cxx
@@ -414,7 +414,7 @@ void Player::processMessage( GstMessage *message )
 
 #define LCL_WAYLAND_DISPLAY_HANDLE_CONTEXT_TYPE 
"GstWaylandDisplayHandleContextType"
 
-static gboolean lcl_is_wayland_display_handle_need_context_message(GstMessage* 
msg)
+static bool lcl_is_wayland_display_handle_need_context_message(GstMessage* msg)
 {
     g_return_val_if_fail(GST_IS_MESSAGE(msg), false);
 
diff --git a/compilerplugins/clang/salbool.cxx 
b/compilerplugins/clang/fakebool.cxx
similarity index 56%
rename from compilerplugins/clang/salbool.cxx
rename to compilerplugins/clang/fakebool.cxx
index fdadfc6b795a..1dbb535ceef9 100644
--- a/compilerplugins/clang/salbool.cxx
+++ b/compilerplugins/clang/fakebool.cxx
@@ -10,27 +10,167 @@
 #include <algorithm>
 #include <cassert>
 #include <limits>
-#include <set>
+#include <map>
 #include <string>
 
 #include "clang/AST/Attr.h"
 
 #include "check.hxx"
 #include "compat.hxx"
+#include "functionaddress.hxx"
 #include "plugin.hxx"
 
 namespace {
 
-bool isSalBool(QualType type) {
+// BEGIN code copied from LLVM's clang/lib/Sema/Sema.cpp
+
+typedef llvm::DenseMap<const CXXRecordDecl*, bool> RecordCompleteMap;
+
+/// Returns true, if all methods and nested classes of the given
+/// CXXRecordDecl are defined in this translation unit.
+///
+/// Should only be called from ActOnEndOfTranslationUnit so that all
+/// definitions are actually read.
+static bool MethodsAndNestedClassesComplete(const CXXRecordDecl *RD,
+                                            RecordCompleteMap &MNCComplete) {
+  RecordCompleteMap::iterator Cache = MNCComplete.find(RD);
+  if (Cache != MNCComplete.end())
+    return Cache->second;
+  if (!RD->isCompleteDefinition())
+    return false;
+  bool Complete = true;
+  for (DeclContext::decl_iterator I = RD->decls_begin(),
+                                  E = RD->decls_end();
+       I != E && Complete; ++I) {
+    if (const CXXMethodDecl *M = dyn_cast<CXXMethodDecl>(*I))
+      Complete = M->isDefined() || M->isDefaulted() ||
+                 (M->isPure() && !isa<CXXDestructorDecl>(M));
+    else if (const FunctionTemplateDecl *F = 
dyn_cast<FunctionTemplateDecl>(*I))
+      // If the template function is marked as late template parsed at this
+      // point, it has not been instantiated and therefore we have not
+      // performed semantic analysis on it yet, so we cannot know if the type
+      // can be considered complete.
+      Complete = !F->getTemplatedDecl()->isLateTemplateParsed() &&
+                  F->getTemplatedDecl()->isDefined();
+    else if (const CXXRecordDecl *R = dyn_cast<CXXRecordDecl>(*I)) {
+      if (R->isInjectedClassName())
+        continue;
+      if (R->hasDefinition())
+        Complete = MethodsAndNestedClassesComplete(R->getDefinition(),
+                                                   MNCComplete);
+      else
+        Complete = false;
+    }
+  }
+  MNCComplete[RD] = Complete;
+  return Complete;
+}
+
+/// Returns true, if the given CXXRecordDecl is fully defined in this
+/// translation unit, i.e. all methods are defined or pure virtual and all
+/// friends, friend functions and nested classes are fully defined in this
+/// translation unit.
+///
+/// Should only be called from ActOnEndOfTranslationUnit so that all
+/// definitions are actually read.
+static bool IsRecordFullyDefined(const CXXRecordDecl *RD,
+                                 RecordCompleteMap &RecordsComplete,
+                                 RecordCompleteMap &MNCComplete) {
+  RecordCompleteMap::iterator Cache = RecordsComplete.find(RD);
+  if (Cache != RecordsComplete.end())
+    return Cache->second;
+  bool Complete = MethodsAndNestedClassesComplete(RD, MNCComplete);
+  for (CXXRecordDecl::friend_iterator I = RD->friend_begin(),
+                                      E = RD->friend_end();
+       I != E && Complete; ++I) {
+    // Check if friend classes and methods are complete.
+    if (TypeSourceInfo *TSI = (*I)->getFriendType()) {
+      // Friend classes are available as the TypeSourceInfo of the FriendDecl.
+      if (CXXRecordDecl *FriendD = TSI->getType()->getAsCXXRecordDecl())
+        Complete = MethodsAndNestedClassesComplete(FriendD, MNCComplete);
+      else
+        Complete = false;
+    } else {
+      // Friend functions are available through the NamedDecl of FriendDecl.
+      if (const FunctionDecl *FD =
+          dyn_cast<FunctionDecl>((*I)->getFriendDecl()))
+        Complete = FD->isDefined();
+      else
+        // This is a template friend, give up.
+        Complete = false;
+    }
+  }
+  RecordsComplete[RD] = Complete;
+  return Complete;
+}
+
+RecordCompleteMap RecordsComplete;
+RecordCompleteMap MNCComplete;
+
+// END code copied from LLVM's clang/lib/Sema/Sema.cpp
+
+// Is all code that could see `decl` defined in this TU?
+bool isAllRelevantCodeDefined(NamedDecl const * decl) {
+    switch (decl->getAccess()) {
+    case AS_protected:
+        if 
(!cast<CXXRecordDecl>(decl->getDeclContext())->hasAttr<FinalAttr>()) {
+            break;
+        }
+        LLVM_FALLTHROUGH;
+    case AS_private:
+        if (IsRecordFullyDefined(
+                cast<CXXRecordDecl>(decl->getDeclContext()), RecordsComplete, 
MNCComplete))
+        {
+            return true;
+        }
+        break;
+    default:
+        break;
+    }
+    return !decl->isExternallyVisible();
+}
+
+enum FakeBoolKind {
+    FBK_No,
+    FBK_BOOL, FBK_First = FBK_BOOL,
+    FBK_Boolean, FBK_FT_Bool, FBK_FcBool, FBK_GLboolean, FBK_NPBool, 
FBK_TW_BOOL, FBK_UBool,
+    FBK_boolean, FBK_dbus_bool_t, FBK_gboolean, FBK_hb_boot_t, FBK_jboolean, 
FBK_my_bool,
+    FBK_sal_Bool,
+    FBK_End };
+    // matches loplugin::TypeCheck::AnyBoolean 
(compilerplugins/clang/check.hxx)
+
+StringRef getName(FakeBoolKind k) {
+    static constexpr llvm::StringLiteral names[] = {
+        "BOOL", "Boolean", "FT_Bool", "FcBool", "GLboolean", "NPBool", 
"TW_BOOL", "UBool",
+        "boolean", "dbus_bool_t", "gboolean", "hb_boot_t", "jboolean", 
"my_bool", "sal_Bool"};
+    assert(k >= FBK_First && k < FBK_End);
+    return names[k - FBK_First];
+}
+
+FakeBoolKind isFakeBool(QualType type) {
     TypedefType const * t = type->getAs<TypedefType>();
-    return t != nullptr && t->getDecl()->getName() == "sal_Bool";
+    if (t != nullptr) {
+        auto const name = t->getDecl()->getName();
+        for (int i = FBK_First; i != FBK_End; ++i) {
+            auto const k = FakeBoolKind(i);
+            if (name == getName(k)) {
+                return k;
+            }
+        }
+    }
+    return FBK_No;
 }
 
-bool isSalBoolArray(QualType type) {
+FakeBoolKind isFakeBoolArray(QualType type) {
     auto t = type->getAsArrayTypeUnsafe();
-    return t != nullptr
-        && (isSalBool(t->getElementType())
-            || isSalBoolArray(t->getElementType()));
+    if (t == nullptr) {
+        return FBK_No;
+    }
+    auto const k = isFakeBool(t->getElementType());
+    if (k != FBK_No) {
+        return k;
+    }
+    return isFakeBoolArray(t->getElementType());
 }
 
 // It appears that, given a function declaration, there is no way to determine
@@ -78,27 +218,27 @@ BoolOverloadKind isBoolOverloadOf(
     if (!mustBeDeleted || f->isDeleted()) {
         unsigned n = decl->getNumParams();
         if (f->getNumParams() == n) {
-            bool hasSB = false;
+            bool hasFB = false;
             for (unsigned i = 0; i != n; ++i) {
                 QualType t1 { decl->getParamDecl(i)->getType() };
-                bool isSB = isSalBool(t1);
-                bool isSBRef = !isSB && t1->isReferenceType()
-                    && isSalBool(t1.getNonReferenceType());
+                bool isFB = isFakeBool(t1) != FBK_No;
+                bool isFBRef = !isFB && t1->isReferenceType()
+                    && isFakeBool(t1.getNonReferenceType()) != FBK_No;
                 QualType t2 { f->getParamDecl(i)->getType() };
-                if (!(isSB
+                if (!(isFB
                       ? t2->isBooleanType()
-                      : isSBRef
+                      : isFBRef
                       ? (t2->isReferenceType()
                          && t2.getNonReferenceType()->isBooleanType())
                       : t2.getCanonicalType() == t1.getCanonicalType()))
                 {
                     return BoolOverloadKind::CheckNext;
                 }
-                hasSB |= isSB || isSBRef;
+                hasFB |= isFB || isFBRef;
             }
-            return hasSB ? BoolOverloadKind::Yes : BoolOverloadKind::No;
+            return hasFB ? BoolOverloadKind::Yes : BoolOverloadKind::No;
                 // cheaply protect against the case where decl would have no
-                // sal_Bool parameters at all and would match itself
+                // fake bool parameters at all and would match itself
         }
     }
     return BoolOverloadKind::CheckNext;
@@ -142,12 +282,12 @@ bool hasBoolOverload(FunctionDecl const * decl, bool 
mustBeDeleted) {
     return false;
 }
 
-class SalBool:
-    public loplugin::FilteringRewritePlugin<SalBool>
+class FakeBool:
+    public 
loplugin::FunctionAddress<loplugin::FilteringRewritePlugin<FakeBool>>
 {
 public:
-    explicit SalBool(loplugin::InstantiationData const & data):
-        FilteringRewritePlugin(data) {}
+    explicit FakeBool(loplugin::InstantiationData const & data):
+        FunctionAddress(data) {}
 
     virtual void run() override;
 
@@ -190,16 +330,20 @@ private:
 
     bool isInSpecialMainFile(SourceLocation spellingLocation) const;
 
-    bool rewrite(SourceLocation location);
+    bool rewrite(SourceLocation location, FakeBoolKind kind);
 
-    std::set<VarDecl const *> varDecls_;
+    std::map<VarDecl const *, FakeBoolKind> varDecls_;
+    std::map<FieldDecl const *, FakeBoolKind> fieldDecls_;
+    std::map<ParmVarDecl const *, FakeBoolKind> parmVarDecls_;
+    std::map<FunctionDecl const *, FakeBoolKind> functionDecls_;
     unsigned int externCContexts_ = 0;
 };
 
-void SalBool::run() {
+void FakeBool::run() {
     if (compiler.getLangOpts().CPlusPlus) {
         TraverseDecl(compiler.getASTContext().getTranslationUnitDecl());
-        for (auto decl: varDecls_) {
+        for (auto const dcl: varDecls_) {
+            auto const decl = dcl.first; auto const fbk = dcl.second;
             SourceLocation loc { compat::getBeginLoc(decl) };
             TypeSourceInfo * tsi = decl->getTypeSourceInfo();
             if (tsi != nullptr) {
@@ -221,7 +365,95 @@ void SalBool::run() {
                         std::string s {
                             compiler.getSourceManager().getCharacterData(l),
                             n };
-                        if (s == "sal_Bool") {
+                        if (s == getName(fbk)) {
+                            loc = l;
+                            break;
+                        }
+                        if (l == end) {
+                            break;
+                        }
+                        l = l.getLocWithOffset(std::max<unsigned>(n, 1));
+                    }
+                }
+            }
+            if (!rewrite(loc, fbk)) {
+                report(
+                    DiagnosticsEngine::Warning,
+                    "VarDecl, use \"bool\" instead of %0", loc)
+                    << decl->getType().getLocalUnqualifiedType()
+                    << decl->getSourceRange();
+            }
+        }
+        for (auto const dcl: fieldDecls_) {
+            auto const decl = dcl.first; auto const fbk = dcl.second;
+            SourceLocation loc { compat::getBeginLoc(decl) };
+            TypeSourceInfo * tsi = decl->getTypeSourceInfo();
+            if (tsi != nullptr) {
+                SourceLocation l {
+                    compiler.getSourceManager().getExpansionLoc(
+                        tsi->getTypeLoc().getBeginLoc()) };
+                SourceLocation end {
+                    compiler.getSourceManager().getExpansionLoc(
+                        tsi->getTypeLoc().getEndLoc()) };
+                assert(l.isFileID() && end.isFileID());
+                if (l == end
+                    || compiler.getSourceManager().isBeforeInTranslationUnit(
+                        l, end))
+                {
+                    for (;;) {
+                        unsigned n = Lexer::MeasureTokenLength(
+                            l, compiler.getSourceManager(),
+                            compiler.getLangOpts());
+                        std::string s {
+                            compiler.getSourceManager().getCharacterData(l),
+                            n };
+                        if (s == getName(fbk)) {
+                            loc = l;
+                            break;
+                        }
+                        if (l == end) {
+                            break;
+                        }
+                        l = l.getLocWithOffset(std::max<unsigned>(n, 1));
+                    }
+                }
+            }
+            if (!rewrite(loc, fbk)) {
+                report(
+                    DiagnosticsEngine::Warning,
+                    "FieldDecl, use \"bool\" instead of %0", loc)
+                    << decl->getType().getLocalUnqualifiedType() << 
decl->getSourceRange();
+            }
+        }
+        auto const ignoredFns = getFunctionsWithAddressTaken();
+        for (auto const dcl: parmVarDecls_) {
+            auto const decl = dcl.first; auto const fbk = dcl.second;
+            FunctionDecl const * f = 
cast<FunctionDecl>(decl->getDeclContext())->getCanonicalDecl();
+            if (ignoredFns.find(f) != ignoredFns.end()) {
+                continue;
+            }
+            SourceLocation loc { compat::getBeginLoc(decl) };
+            TypeSourceInfo * tsi = decl->getTypeSourceInfo();
+            if (tsi != nullptr) {
+                SourceLocation l {
+                    compiler.getSourceManager().getExpansionLoc(
+                        tsi->getTypeLoc().getBeginLoc()) };
+                SourceLocation end {
+                    compiler.getSourceManager().getExpansionLoc(
+                        tsi->getTypeLoc().getEndLoc()) };
+                assert(l.isFileID() && end.isFileID());
+                if (l == end
+                    || (compiler.getSourceManager()
+                        .isBeforeInTranslationUnit(l, end)))
+                {
+                    for (;;) {
+                        unsigned n = Lexer::MeasureTokenLength(
+                            l, compiler.getSourceManager(),
+                            compiler.getLangOpts());
+                        std::string s {
+                            compiler.getSourceManager().getCharacterData(l),
+                            n };
+                        if (s == getName(fbk)) {
                             loc = l;
                             break;
                         }
@@ -232,31 +464,114 @@ void SalBool::run() {
                     }
                 }
             }
-            if (!rewrite(loc)) {
+            // Only rewrite declarations in include files if a
+            // definition is also seen, to avoid compilation of a
+            // definition (in a main file only processed later) to fail
+            // with a "mismatch" error before the rewriter had a chance
+            // to act upon the definition (but use the heuristic of
+            // assuming pure virtual functions do not have definitions);
+            // also, do not automatically rewrite functions that could
+            // implicitly override depend base functions (and thus stop
+            // doing so after the rewrite; note that this is less
+            // dangerous for return types than for parameter types,
+            // where the function would still implicitly override and
+            // cause a compilation error due to the incompatible return
+            // type):
+            OverrideKind k = getOverrideKind(f);
+            if (!((compiler.getSourceManager().isInMainFile(
+                       compiler.getSourceManager().getSpellingLoc(
+                           dyn_cast<FunctionDecl>(
+                               decl->getDeclContext())
+                           ->getNameInfo().getLoc()))
+                   || f->isDefined() || f->isPure())
+                  && k != OverrideKind::MAYBE && rewrite(loc, fbk)))
+            {
                 report(
                     DiagnosticsEngine::Warning,
-                    "VarDecl, use \"bool\" instead of \"sal_Bool\"", loc)
+                    ("ParmVarDecl, use \"bool\" instead of"
+                     " %0%1"),
+                    loc)
+                    << 
decl->getType().getNonReferenceType().getLocalUnqualifiedType()
+                    << (k == OverrideKind::MAYBE
+                        ? (" (unless this member function overrides a"
+                           " dependent base member function, even"
+                           " though it is not marked 'override')")
+                        : "")
+                    << decl->getSourceRange();
+            }
+        }
+        for (auto const dcl: functionDecls_) {
+            auto const decl = dcl.first; auto const fbk = dcl.second;
+            FunctionDecl const * f = decl->getCanonicalDecl();
+            if (ignoredFns.find(f) != ignoredFns.end()) {
+                continue;
+            }
+            SourceLocation loc { compat::getBeginLoc(decl) };
+            SourceLocation l { compiler.getSourceManager().getExpansionLoc(
+                loc) };
+            SourceLocation end { compiler.getSourceManager().getExpansionLoc(
+                decl->getNameInfo().getLoc()) };
+            assert(l.isFileID() && end.isFileID());
+            if (compiler.getSourceManager().isBeforeInTranslationUnit(l, end)) 
{
+                while (l != end) {
+                    unsigned n = Lexer::MeasureTokenLength(
+                        l, compiler.getSourceManager(), 
compiler.getLangOpts());
+                    std::string s {
+                        compiler.getSourceManager().getCharacterData(l), n };
+                    if (s == getName(fbk)) {
+                        loc = l;
+                        break;
+                    }
+                    l = l.getLocWithOffset(std::max<unsigned>(n, 1));
+                }
+            }
+            // Only rewrite declarations in include files if a definition is
+            // also seen, to avoid compilation of a definition (in a main file
+            // only processed later) to fail with a "mismatch" error before the
+            // rewriter had a chance to act upon the definition (but use the
+            // heuristic of assuming pure virtual functions do not have
+            // definitions):
+            if (!((compiler.getSourceManager().isInMainFile(
+                       compiler.getSourceManager().getSpellingLoc(
+                           decl->getNameInfo().getLoc()))
+                   || f->isDefined() || f->isPure())
+                  && rewrite(loc, fbk)))
+            {
+                report(
+                    DiagnosticsEngine::Warning,
+                    "use \"bool\" instead of %0 as return type%1",
+                    loc)
+                    << 
decl->getReturnType().getNonReferenceType().getLocalUnqualifiedType()
+                    << (getOverrideKind(f) == OverrideKind::MAYBE
+                        ? (" (unless this member function overrides a 
dependent"
+                           " base member function, even though it is not 
marked"
+                           " 'override')")
+                        : "")
                     << decl->getSourceRange();
             }
         }
     }
 }
 
-bool SalBool::VisitUnaryAddrOf(UnaryOperator const * op) {
+bool FakeBool::VisitUnaryAddrOf(UnaryOperator const * op) {
+    FunctionAddress::VisitUnaryAddrOf(op);
     Expr const * e1 = op->getSubExpr()->IgnoreParenCasts();
-    if (isSalBool(e1->getType())) {
-        DeclRefExpr const * e2 = dyn_cast<DeclRefExpr>(e1);
-        if (e2 != nullptr) {
+    if (isFakeBool(e1->getType()) != FBK_No) {
+        if (DeclRefExpr const * e2 = dyn_cast<DeclRefExpr>(e1)) {
             VarDecl const * d = dyn_cast<VarDecl>(e2->getDecl());
             if (d != nullptr) {
                 varDecls_.erase(d);
             }
+        } else if (auto const e3 = dyn_cast<MemberExpr>(e1)) {
+            if (auto const d = dyn_cast<FieldDecl>(e3->getMemberDecl())) {
+                fieldDecls_.erase(d);
+            }
         }
     }
     return true;
 }
 
-bool SalBool::VisitCallExpr(CallExpr * expr) {
+bool FakeBool::VisitCallExpr(CallExpr * expr) {
     Decl const * d = expr->getCalleeDecl();
     FunctionProtoType const * ft = nullptr;
     if (d != nullptr) {
@@ -290,7 +605,7 @@ bool SalBool::VisitCallExpr(CallExpr * expr) {
             bool b = false;
             if (t->isLValueReferenceType()) {
                 t = t.getNonReferenceType();
-                b = !t.isConstQualified() && isSalBool(t);
+                b = !t.isConstQualified() && isFakeBool(t) != FBK_No;
             } else if (t->isPointerType()) {
                 for (;;) {
                     auto t2 = t->getAs<clang::PointerType>();
@@ -299,16 +614,19 @@ bool SalBool::VisitCallExpr(CallExpr * expr) {
                     }
                     t = t2->getPointeeType();
                 }
-                b = isSalBool(t);
+                b = isFakeBool(t) != FBK_No;
             }
             if (b && i < expr->getNumArgs()) {
-                DeclRefExpr * ref = dyn_cast<DeclRefExpr>(
-                    expr->getArg(i)->IgnoreParenImpCasts());
-                if (ref != nullptr) {
+                auto const e1 = expr->getArg(i)->IgnoreParenImpCasts();
+                if (DeclRefExpr * ref = dyn_cast<DeclRefExpr>(e1)) {
                     VarDecl const * d = dyn_cast<VarDecl>(ref->getDecl());
                     if (d != nullptr) {
                         varDecls_.erase(d);
                     }
+                } else if (auto const e2 = dyn_cast<MemberExpr>(e1)) {
+                    if (auto const d = 
dyn_cast<FieldDecl>(e2->getMemberDecl())) {
+                        fieldDecls_.erase(d);
+                    }
                 }
             }
         }
@@ -316,11 +634,12 @@ bool SalBool::VisitCallExpr(CallExpr * expr) {
     return true;
 }
 
-bool SalBool::VisitCStyleCastExpr(CStyleCastExpr * expr) {
+bool FakeBool::VisitCStyleCastExpr(CStyleCastExpr * expr) {
     if (ignoreLocation(expr)) {
         return true;
     }
-    if (isSalBool(expr->getType())) {
+    auto const k = isFakeBool(expr->getType());
+    if (k != FBK_No) {
         SourceLocation loc { compat::getBeginLoc(expr) };
         while (compiler.getSourceManager().isMacroArgExpansion(loc)) {
             loc = compiler.getSourceManager().getImmediateMacroCallerLoc(loc);
@@ -328,7 +647,7 @@ bool SalBool::VisitCStyleCastExpr(CStyleCastExpr * expr) {
         if (compiler.getSourceManager().isMacroBodyExpansion(loc)) {
             StringRef name { Lexer::getImmediateMacroName(
                 loc, compiler.getSourceManager(), compiler.getLangOpts()) };
-            if (name == "sal_False" || name == "sal_True") {
+            if (k == FBK_sal_Bool && (name == "sal_False" || name == 
"sal_True")) {
                 auto callLoc = compiler.getSourceManager()
                     .getImmediateMacroCallerLoc(loc);
                 if (!isSharedCAndCppCode(callLoc)) {
@@ -345,7 +664,7 @@ bool SalBool::VisitCStyleCastExpr(CStyleCastExpr * expr) {
                         // arguments to CPPUNIT_ASSERT_EQUAL:
                         return true;
                     }
-                    bool b = name == "sal_True";
+                    bool b = k == FBK_sal_Bool && name == "sal_True";
                     if (rewriter != nullptr) {
                         auto callSpellLoc = compiler.getSourceManager()
                             .getSpellingLoc(callLoc);
@@ -380,29 +699,34 @@ bool SalBool::VisitCStyleCastExpr(CStyleCastExpr * expr) {
     return true;
 }
 
-bool SalBool::VisitCXXStaticCastExpr(CXXStaticCastExpr * expr) {
+bool FakeBool::VisitCXXStaticCastExpr(CXXStaticCastExpr * expr) {
     if (ignoreLocation(expr)) {
         return true;
     }
-    if (isSalBool(expr->getType())
-        && !isInSpecialMainFile(
+    auto const k = isFakeBool(expr->getType());
+    if (k == FBK_No) {
+        return true;
+    }
+    if (k == FBK_sal_Bool
+        && isInSpecialMainFile(
             
compiler.getSourceManager().getSpellingLoc(compat::getBeginLoc(expr))))
     {
-        report(
-            DiagnosticsEngine::Warning,
-            "CXXStaticCastExpr, suspicious cast from %0 to %1",
-            compat::getBeginLoc(expr))
-            << expr->getSubExpr()->IgnoreParenImpCasts()->getType()
-            << expr->getType() << expr->getSourceRange();
+        return true;
     }
+    report(
+        DiagnosticsEngine::Warning,
+        "CXXStaticCastExpr, suspicious cast from %0 to %1",
+        compat::getBeginLoc(expr))
+        << expr->getSubExpr()->IgnoreParenImpCasts()->getType()
+        << expr->getType() << expr->getSourceRange();
     return true;
 }
 
-bool SalBool::VisitCXXFunctionalCastExpr(CXXFunctionalCastExpr * expr) {
+bool FakeBool::VisitCXXFunctionalCastExpr(CXXFunctionalCastExpr * expr) {
     if (ignoreLocation(expr)) {
         return true;
     }
-    if (isSalBool(expr->getType())) {
+    if (isFakeBool(expr->getType()) != FBK_No) {
         report(
             DiagnosticsEngine::Warning,
             "CXXFunctionalCastExpr, suspicious cast from %0 to %1",
@@ -413,11 +737,13 @@ bool 
SalBool::VisitCXXFunctionalCastExpr(CXXFunctionalCastExpr * expr) {
     return true;
 }
 
-bool SalBool::VisitImplicitCastExpr(ImplicitCastExpr * expr) {
+bool FakeBool::VisitImplicitCastExpr(ImplicitCastExpr * expr) {
+    FunctionAddress::VisitImplicitCastExpr(expr);
     if (ignoreLocation(expr)) {
         return true;
     }
-    if (!isSalBool(expr->getType())) {
+    auto const k = isFakeBool(expr->getType());
+    if (k == FBK_No) {
         return true;
     }
     auto l = compat::getBeginLoc(expr);
@@ -427,7 +753,11 @@ bool SalBool::VisitImplicitCastExpr(ImplicitCastExpr * 
expr) {
     if (compiler.getSourceManager().isMacroBodyExpansion(l)) {
         auto n = Lexer::getImmediateMacroName(
             l, compiler.getSourceManager(), compiler.getLangOpts());
-        if (n == "sal_False" || n == "sal_True") {
+        if ((k == FBK_GLboolean && (n == "GL_FALSE" || n == "GL_TRUE"))
+            || (k == FBK_UBool && (n == "FALSE" || n == "TRUE"))
+            || (k == FBK_jboolean && (n == "JNI_FALSE" || n == "JNI_TRUE"))
+            || (k == FBK_sal_Bool && (n == "sal_False" || n == "sal_True")))
+        {
             return true;
         }
     }
@@ -454,13 +784,13 @@ bool SalBool::VisitImplicitCastExpr(ImplicitCastExpr * 
expr) {
         }
     }
     report(
-        DiagnosticsEngine::Warning, "conversion from %0 to sal_Bool",
+        DiagnosticsEngine::Warning, "conversion from %0 to %1",
         compat::getBeginLoc(expr))
-        << t << expr->getSourceRange();
+        << t << expr->getType() << expr->getSourceRange();
     return true;
 }
 
-bool SalBool::VisitReturnStmt(ReturnStmt const * stmt) {
+bool FakeBool::VisitReturnStmt(ReturnStmt const * stmt) {
     // Just enough to avoid warnings in rtl_getUriCharClass (sal/rtl/uri.cxx),
     // which has
     //
@@ -488,7 +818,7 @@ bool SalBool::VisitReturnStmt(ReturnStmt const * stmt) {
         }
         t = t2->getPointeeType();
     }
-    if (!isSalBool(t)) {
+    if (isFakeBool(t) != FBK_sal_Bool) {
         return true;
     }
     auto e2 = dyn_cast<ArraySubscriptExpr>(e->IgnoreParenImpCasts());
@@ -507,92 +837,30 @@ bool SalBool::VisitReturnStmt(ReturnStmt const * stmt) {
     return true;
 }
 
-bool SalBool::WalkUpFromParmVarDecl(ParmVarDecl const * decl) {
+bool FakeBool::WalkUpFromParmVarDecl(ParmVarDecl const * decl) {
     return VisitParmVarDecl(decl);
 }
 
-bool SalBool::VisitParmVarDecl(ParmVarDecl const * decl) {
+bool FakeBool::VisitParmVarDecl(ParmVarDecl const * decl) {
     if (ignoreLocation(decl)) {
         return true;
     }
-    if (isSalBool(decl->getType().getNonReferenceType())) {
+    auto const fbk = isFakeBool(decl->getType().getNonReferenceType());
+    if (fbk != FBK_No) {
         FunctionDecl const * f = 
dyn_cast<FunctionDecl>(decl->getDeclContext());
         if (f != nullptr) { // e.g.: typedef sal_Bool (* FuncPtr )( sal_Bool );
             f = f->getCanonicalDecl();
-            if (!(hasCLanguageLinkageType(f)
-                  || (isInUnoIncludeFile(f)
-                      && (!f->isInlined() || f->hasAttr<DeprecatedAttr>()
-                          || decl->getType()->isReferenceType()
-                          || hasBoolOverload(f, false)))
-                  || f->isDeleted() || hasBoolOverload(f, true)))
+            if (isAllRelevantCodeDefined(f)
+                && !(hasCLanguageLinkageType(f)
+                     || (fbk == FBK_sal_Bool && isInUnoIncludeFile(f)
+                         && (!f->isInlined() || f->hasAttr<DeprecatedAttr>()
+                             || decl->getType()->isReferenceType()
+                             || hasBoolOverload(f, false)))
+                     || f->isDeleted() || hasBoolOverload(f, true)))
             {
                 OverrideKind k = getOverrideKind(f);
                 if (k != OverrideKind::YES) {
-                    SourceLocation loc { compat::getBeginLoc(decl) };
-                    TypeSourceInfo * tsi = decl->getTypeSourceInfo();
-                    if (tsi != nullptr) {
-                        SourceLocation l {
-                            compiler.getSourceManager().getExpansionLoc(
-                                tsi->getTypeLoc().getBeginLoc()) };
-                        SourceLocation end {
-                            compiler.getSourceManager().getExpansionLoc(
-                                tsi->getTypeLoc().getEndLoc()) };
-                        assert(l.isFileID() && end.isFileID());
-                        if (l == end
-                            || (compiler.getSourceManager()
-                                .isBeforeInTranslationUnit(l, end)))
-                        {
-                            for (;;) {
-                                unsigned n = Lexer::MeasureTokenLength(
-                                    l, compiler.getSourceManager(),
-                                    compiler.getLangOpts());
-                                std::string s {
-                                    
compiler.getSourceManager().getCharacterData(l),
-                                        n };
-                                if (s == "sal_Bool") {
-                                    loc = l;
-                                    break;
-                                }
-                                if (l == end) {
-                                    break;
-                                }
-                                l = l.getLocWithOffset(std::max<unsigned>(n, 
1));
-                            }
-                        }
-                    }
-                    // Only rewrite declarations in include files if a
-                    // definition is also seen, to avoid compilation of a
-                    // definition (in a main file only processed later) to fail
-                    // with a "mismatch" error before the rewriter had a chance
-                    // to act upon the definition (but use the heuristic of
-                    // assuming pure virtual functions do not have 
definitions);
-                    // also, do not automatically rewrite functions that could
-                    // implicitly override depend base functions (and thus stop
-                    // doing so after the rewrite; note that this is less
-                    // dangerous for return types than for parameter types,
-                    // where the function would still implicitly override and
-                    // cause a compilation error due to the incompatible return
-                    // type):
-                    if (!((compiler.getSourceManager().isInMainFile(
-                               compiler.getSourceManager().getSpellingLoc(
-                                   dyn_cast<FunctionDecl>(
-                                       decl->getDeclContext())
-                                   ->getNameInfo().getLoc()))
-                           || f->isDefined() || f->isPure())
-                          && k != OverrideKind::MAYBE && rewrite(loc)))
-                    {
-                        report(
-                            DiagnosticsEngine::Warning,
-                            ("ParmVarDecl, use \"bool\" instead of"
-                             " \"sal_Bool\"%0"),
-                            loc)
-                            << (k == OverrideKind::MAYBE
-                                ? (" (unless this member function overrides a"
-                                   " dependent base member function, even"
-                                   " though it is not marked 'override')")
-                                : "")
-                            << decl->getSourceRange();
-                    }
+                    parmVarDecls_.insert({decl, fbk});
                 }
             }
         }
@@ -600,96 +868,92 @@ bool SalBool::VisitParmVarDecl(ParmVarDecl const * decl) {
     return true;
 }
 
-bool SalBool::WalkUpFromVarDecl(VarDecl const * decl) {
+bool FakeBool::WalkUpFromVarDecl(VarDecl const * decl) {
     return VisitVarDecl(decl);
 }
 
-bool SalBool::VisitVarDecl(VarDecl const * decl) {
+bool FakeBool::VisitVarDecl(VarDecl const * decl) {
     if (ignoreLocation(decl)) {
         return true;
     }
-    if (!decl->isExternC()
-        && (isSalBool(decl->getType()) || isSalBoolArray(decl->getType()))
-        && !isInSpecialMainFile(
-            
compiler.getSourceManager().getSpellingLoc(compat::getBeginLoc(decl))))
+    if (decl->isExternC()) {
+        return true;
+    }
+    auto k = isFakeBool(decl->getType());
+    if (k == FBK_No) {
+        k = isFakeBoolArray(decl->getType());
+    }
+    if (k == FBK_No) {
+        return true;
+    }
+    auto const loc = compat::getBeginLoc(decl);
+    if (k == FBK_sal_Bool
+        && isInSpecialMainFile(
+            compiler.getSourceManager().getSpellingLoc(loc)))
+    {
+        return true;
+    }
+    auto l = loc;
+    while (compiler.getSourceManager().isMacroArgExpansion(l)) {
+        l = compiler.getSourceManager().getImmediateMacroCallerLoc(l);
+    }
+    if (compiler.getSourceManager().isMacroBodyExpansion(l)
+        && 
isSharedCAndCppCode(compiler.getSourceManager().getImmediateMacroCallerLoc(l)))
     {
-        varDecls_.insert(decl);
+        return true;
     }
+    varDecls_.insert({decl, k});
     return true;
 }
 
-bool SalBool::WalkUpFromFieldDecl(FieldDecl const * decl) {
+bool FakeBool::WalkUpFromFieldDecl(FieldDecl const * decl) {
     return VisitFieldDecl(decl);
 }
 
-bool SalBool::VisitFieldDecl(FieldDecl const * decl) {
+bool FakeBool::VisitFieldDecl(FieldDecl const * decl) {
     if (ignoreLocation(decl)) {
         return true;
     }
-    if ((isSalBool(decl->getType()) || isSalBoolArray(decl->getType()))
-        && !isInSpecialMainFile(
+    auto k = isFakeBool(decl->getType());
+    if (k == FBK_No) {
+        k = isFakeBoolArray(decl->getType());
+    }
+    if (k == FBK_No) {
+        return true;
+    }
+    if (!isAllRelevantCodeDefined(decl)) {
+        return true;
+    }
+    if (k == FBK_sal_Bool
+        && isInSpecialMainFile(
             
compiler.getSourceManager().getSpellingLoc(compat::getBeginLoc(decl))))
     {
-        TagDecl const * td = dyn_cast<TagDecl>(decl->getDeclContext());
-        assert(td != nullptr);
-        if (!(((td->isStruct() || td->isUnion()) && td->isExternCContext())
-              || isInUnoIncludeFile(
-                  compiler.getSourceManager().getSpellingLoc(
-                      decl->getLocation()))))
-        {
-            SourceLocation loc { compat::getBeginLoc(decl) };
-            TypeSourceInfo * tsi = decl->getTypeSourceInfo();
-            if (tsi != nullptr) {
-                SourceLocation l {
-                    compiler.getSourceManager().getExpansionLoc(
-                        tsi->getTypeLoc().getBeginLoc()) };
-                SourceLocation end {
-                    compiler.getSourceManager().getExpansionLoc(
-                        tsi->getTypeLoc().getEndLoc()) };
-                assert(l.isFileID() && end.isFileID());
-                if (l == end
-                    || compiler.getSourceManager().isBeforeInTranslationUnit(
-                        l, end))
-                {
-                    for (;;) {
-                        unsigned n = Lexer::MeasureTokenLength(
-                            l, compiler.getSourceManager(),
-                            compiler.getLangOpts());
-                        std::string s {
-                            compiler.getSourceManager().getCharacterData(l),
-                                n };
-                        if (s == "sal_Bool") {
-                            loc = l;
-                            break;
-                        }
-                        if (l == end) {
-                            break;
-                        }
-                        l = l.getLocWithOffset(std::max<unsigned>(n, 1));
-                    }
-                }
-            }
-            if (!rewrite(loc)) {
-                report(
-                    DiagnosticsEngine::Warning,
-                    "FieldDecl, use \"bool\" instead of \"sal_Bool\"", loc)
-                    << decl->getSourceRange();
-            }
-        }
+        return true;
+    }
+    TagDecl const * td = dyn_cast<TagDecl>(decl->getDeclContext());
+    assert(td != nullptr);
+    if (!(((td->isStruct() || td->isUnion()) && td->isExternCContext())
+          || isInUnoIncludeFile(
+              compiler.getSourceManager().getSpellingLoc(
+                  decl->getLocation()))))
+    {
+        fieldDecls_.insert({decl, k});
     }
     return true;
 }
 
-bool SalBool::WalkUpFromFunctionDecl(FunctionDecl const * decl) {
+bool FakeBool::WalkUpFromFunctionDecl(FunctionDecl const * decl) {
     return VisitFunctionDecl(decl);
 }
 
-bool SalBool::VisitFunctionDecl(FunctionDecl const * decl) {
+bool FakeBool::VisitFunctionDecl(FunctionDecl const * decl) {
     if (ignoreLocation(decl)) {
         return true;
     }
-    if (isSalBool(decl->getReturnType().getNonReferenceType())
-        && !(decl->isDeletedAsWritten() && isa<CXXConversionDecl>(decl)))
+    auto const fbk = isFakeBool(decl->getReturnType().getNonReferenceType());
+    if (fbk != FBK_No
+        && !(decl->isDeletedAsWritten() && isa<CXXConversionDecl>(decl))
+        && isAllRelevantCodeDefined(decl))
     {
         FunctionDecl const * f = decl->getCanonicalDecl();
         OverrideKind k = getOverrideKind(f);
@@ -698,68 +962,28 @@ bool SalBool::VisitFunctionDecl(FunctionDecl const * 
decl) {
                  || (isInUnoIncludeFile(f)
                      && (!f->isInlined() || f->hasAttr<DeprecatedAttr>()))))
         {
-            SourceLocation loc { compat::getBeginLoc(decl) };
-            SourceLocation l { compiler.getSourceManager().getExpansionLoc(
-                loc) };
-            SourceLocation end { compiler.getSourceManager().getExpansionLoc(
-                decl->getNameInfo().getLoc()) };
-            assert(l.isFileID() && end.isFileID());
-            if (compiler.getSourceManager().isBeforeInTranslationUnit(l, end)) 
{
-                while (l != end) {
-                    unsigned n = Lexer::MeasureTokenLength(
-                        l, compiler.getSourceManager(), 
compiler.getLangOpts());
-                    std::string s {
-                        compiler.getSourceManager().getCharacterData(l), n };
-                    if (s == "sal_Bool") {
-                        loc = l;
-                        break;
-                    }
-                    l = l.getLocWithOffset(std::max<unsigned>(n, 1));
-                }
-            }
-            // Only rewrite declarations in include files if a definition is
-            // also seen, to avoid compilation of a definition (in a main file
-            // only processed later) to fail with a "mismatch" error before the
-            // rewriter had a chance to act upon the definition (but use the
-            // heuristic of assuming pure virtual functions do not have
-            // definitions):
-            if (!((compiler.getSourceManager().isInMainFile(
-                       compiler.getSourceManager().getSpellingLoc(
-                           decl->getNameInfo().getLoc()))
-                   || f->isDefined() || f->isPure())
-                  && rewrite(loc)))
-            {
-                report(
-                    DiagnosticsEngine::Warning,
-                    "use \"bool\" instead of \"sal_Bool\" as return type%0",
-                    loc)
-                    << (k == OverrideKind::MAYBE
-                        ? (" (unless this member function overrides a 
dependent"
-                           " base member function, even though it is not 
marked"
-                           " 'override')")
-                        : "")
-                    << decl->getSourceRange();
-            }
+            functionDecls_.insert({decl, fbk});
         }
     }
     return true;
 }
 
-bool SalBool::VisitValueDecl(ValueDecl const * decl) {
+bool FakeBool::VisitValueDecl(ValueDecl const * decl) {
     if (ignoreLocation(decl)) {
         return true;
     }
-    if (isSalBool(decl->getType()) && !rewrite(compat::getBeginLoc(decl))) {
+    auto const k = isFakeBool(decl->getType());
+    if (k != FBK_No && !rewrite(compat::getBeginLoc(decl), k)) {
         report(
             DiagnosticsEngine::Warning,
-            "ValueDecl, use \"bool\" instead of \"sal_Bool\"",
+            "ValueDecl, use \"bool\" instead of %0",
             compat::getBeginLoc(decl))
-            << decl->getSourceRange();
+            << decl->getType() << decl->getSourceRange();
     }
     return true;
 }
 
-bool SalBool::TraverseStaticAssertDecl(StaticAssertDecl * decl) {
+bool FakeBool::TraverseStaticAssertDecl(StaticAssertDecl * decl) {
     // Ignore special code like
     //
     //   static_cast<sal_Bool>(true) == sal_True
@@ -772,7 +996,7 @@ bool SalBool::TraverseStaticAssertDecl(StaticAssertDecl * 
decl) {
         || RecursiveASTVisitor::TraverseStaticAssertDecl(decl);
 }
 
-bool SalBool::TraverseLinkageSpecDecl(LinkageSpecDecl * decl) {
+bool FakeBool::TraverseLinkageSpecDecl(LinkageSpecDecl * decl) {
     assert(externCContexts_ != std::numeric_limits<unsigned int>::max()); 
//TODO
     ++externCContexts_;
     bool ret = RecursiveASTVisitor::TraverseLinkageSpecDecl(decl);
@@ -781,7 +1005,7 @@ bool SalBool::TraverseLinkageSpecDecl(LinkageSpecDecl * 
decl) {
     return ret;
 }
 
-bool SalBool::isFromCIncludeFile(SourceLocation spellingLocation) const {
+bool FakeBool::isFromCIncludeFile(SourceLocation spellingLocation) const {
     return !compiler.getSourceManager().isInMainFile(spellingLocation)
         && (StringRef(
                 compiler.getSourceManager().getPresumedLoc(spellingLocation)
@@ -789,7 +1013,7 @@ bool SalBool::isFromCIncludeFile(SourceLocation 
spellingLocation) const {
             .endswith(".h"));
 }
 
-bool SalBool::isSharedCAndCppCode(SourceLocation location) const {
+bool FakeBool::isSharedCAndCppCode(SourceLocation location) const {
     // Assume that code is intended to be shared between C and C++ if it comes
     // from an include file ending in .h, and is either in an extern "C" 
context
     // or the body of a macro definition:
@@ -799,7 +1023,7 @@ bool SalBool::isSharedCAndCppCode(SourceLocation location) 
const {
             || compiler.getSourceManager().isMacroBodyExpansion(location));
 }
 
-bool SalBool::isInSpecialMainFile(SourceLocation spellingLocation) const {
+bool FakeBool::isInSpecialMainFile(SourceLocation spellingLocation) const {
     if (!compiler.getSourceManager().isInMainFile(spellingLocation)) {
         return false;
     }
@@ -809,7 +1033,7 @@ bool SalBool::isInSpecialMainFile(SourceLocation 
spellingLocation) const {
         // TODO: the offset checks
 }
 
-bool SalBool::rewrite(SourceLocation location) {
+bool FakeBool::rewrite(SourceLocation location, FakeBoolKind kind) {
     if (rewriter != nullptr) {
         //TODO: "::sal_Bool" -> "bool", not "::bool"
         SourceLocation loc { compiler.getSourceManager().getExpansionLoc(
@@ -817,7 +1041,7 @@ bool SalBool::rewrite(SourceLocation location) {
         unsigned n = Lexer::MeasureTokenLength(
             loc, compiler.getSourceManager(), compiler.getLangOpts());
         if (std::string(compiler.getSourceManager().getCharacterData(loc), n)
-            == "sal_Bool")
+            == getName(kind))
         {
             return replaceText(loc, n, "bool");
         }
@@ -825,7 +1049,7 @@ bool SalBool::rewrite(SourceLocation location) {
     return false;
 }
 
-loplugin::Plugin::Registration<SalBool> X("salbool", true);
+loplugin::Plugin::Registration<FakeBool> X("fakebool", true);
 
 }
 
diff --git a/compilerplugins/clang/test/salbool.cxx 
b/compilerplugins/clang/test/fakebool.cxx
similarity index 88%
rename from compilerplugins/clang/test/salbool.cxx
rename to compilerplugins/clang/test/fakebool.cxx
index da861afe73be..26b5d7e2f791 100644
--- a/compilerplugins/clang/test/salbool.cxx
+++ b/compilerplugins/clang/test/fakebool.cxx
@@ -11,8 +11,12 @@
 
 #include <sal/types.h>
 
+namespace {
+
 struct S {
-    sal_Bool b; // expected-error {{FieldDecl, use "bool" instead of 
"sal_Bool" [loplugin:salbool]}}
+    sal_Bool b; // expected-error {{FieldDecl, use "bool" instead of 
'sal_Bool' (aka 'unsigned char') [loplugin:fakebool]}}
 };
 
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s 
cinkeys+=0=break: */
diff --git a/connectivity/source/drivers/evoab2/NResultSet.cxx 
b/connectivity/source/drivers/evoab2/NResultSet.cxx
index 28c7278f2010..5a7c1ebea4dd 100644
--- a/connectivity/source/drivers/evoab2/NResultSet.cxx
+++ b/connectivity/source/drivers/evoab2/NResultSet.cxx
@@ -255,7 +255,7 @@ getValue( EContact* pContact, sal_Int32 nColumnNum, GType 
nType, GValue* pStackV
         return false;
 
     GParamSpec* pSpec = pSpecs->pField;
-    gboolean bIsSplittedColumn = pSpecs->bIsSplittedValue;
+    bool bIsSplittedColumn = pSpecs->bIsSplittedValue;
 
     _out_rWasNull = true;
     if ( !pSpec || !pContact)
diff --git a/connectivity/source/drivers/jdbc/DatabaseMetaData.cxx 
b/connectivity/source/drivers/jdbc/DatabaseMetaData.cxx
index 2422f44bd299..35c020f4a738 100644
--- a/connectivity/source/drivers/jdbc/DatabaseMetaData.cxx
+++ b/connectivity/source/drivers/jdbc/DatabaseMetaData.cxx
@@ -536,7 +536,7 @@ Reference< XResultSet > SAL_CALL 
java_sql_DatabaseMetaData::getCrossReference(
 bool java_sql_DatabaseMetaData::impl_callBooleanMethod( const char* 
_pMethodName, jmethodID& _inout_MethodID )
 {
     m_aLogger.log( LogLevel::FINEST, STR_LOG_META_DATA_METHOD, _pMethodName );
-    jboolean out( 
java_lang_Object::callBooleanMethod(_pMethodName,_inout_MethodID) );
+    bool out( 
java_lang_Object::callBooleanMethod(_pMethodName,_inout_MethodID) );
     m_aLogger.log< const sal_Char*, bool>( LogLevel::FINEST, 
STR_LOG_META_DATA_RESULT, _pMethodName, out );
     return out;
 }
@@ -578,7 +578,7 @@ bool 
java_sql_DatabaseMetaData::impl_callBooleanMethodWithIntArg( const char* _p
 {
     m_aLogger.log( LogLevel::FINEST, STR_LOG_META_DATA_METHOD_ARG1, 
_pMethodName, _nArgument );
 
-    jboolean out( 
callBooleanMethodWithIntArg(_pMethodName,_inout_MethodID,_nArgument) );
+    bool out( 
callBooleanMethodWithIntArg(_pMethodName,_inout_MethodID,_nArgument) );
 
     m_aLogger.log< const sal_Char*, bool >( LogLevel::FINEST, 
STR_LOG_META_DATA_RESULT, _pMethodName, out );
     return out;
@@ -990,7 +990,7 @@ sal_Bool SAL_CALL 
java_sql_DatabaseMetaData::supportsConvert( sal_Int32 fromType
     static const char* const pMethodName = "supportsConvert";
     m_aLogger.log( LogLevel::FINEST, STR_LOG_META_DATA_METHOD_ARG2, 
pMethodName, fromType, toType );
 
-    jboolean out( false );
+    bool out( false );
     SDBThreadAttach t;
 
     {
@@ -1332,7 +1332,7 @@ sal_Bool SAL_CALL 
java_sql_DatabaseMetaData::supportsResultSetConcurrency( sal_I
     static const char* const pMethodName = "supportsResultSetConcurrency";
     m_aLogger.log( LogLevel::FINEST, STR_LOG_META_DATA_METHOD_ARG2, 
pMethodName, setType, concurrency );
 
-    jboolean out( false );
+    bool out( false );
     SDBThreadAttach t;
 
     {
diff --git a/connectivity/source/drivers/jdbc/JStatement.cxx 
b/connectivity/source/drivers/jdbc/JStatement.cxx
index f6ad7f1d279b..72f205995639 100644
--- a/connectivity/source/drivers/jdbc/JStatement.cxx
+++ b/connectivity/source/drivers/jdbc/JStatement.cxx
@@ -213,7 +213,7 @@ sal_Bool SAL_CALL java_sql_Statement_Base::execute( const 
OUString& sql )
     ::osl::MutexGuard aGuard( m_aMutex );
     checkDisposed(java_sql_Statement_BASE::rBHelper.bDisposed);
 
-    jboolean out(false);
+    bool out(false);
     SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java environment has been deleted!");
     {
         createStatement(t.pEnv);
diff --git a/connectivity/source/drivers/jdbc/Object.cxx 
b/connectivity/source/drivers/jdbc/Object.cxx
index 13f9c79da482..b3516a15f6ac 100644
--- a/connectivity/source/drivers/jdbc/Object.cxx
+++ b/connectivity/source/drivers/jdbc/Object.cxx
@@ -255,7 +255,7 @@ void java_lang_Object::obtainMethodId_throwRuntime(JNIEnv* 
_pEnv,const char* _pM
 
 bool java_lang_Object::callBooleanMethod( const char* _pMethodName, jmethodID& 
_inout_MethodID ) const
 {
-    jboolean out( false );
+    bool out( false );
 
     SDBThreadAttach t;
     OSL_ENSURE( t.pEnv, "java_lang_Object::callBooleanMethod: no Java 
environment anymore!" );
@@ -269,7 +269,7 @@ bool java_lang_Object::callBooleanMethod( const char* 
_pMethodName, jmethodID& _
 
 bool java_lang_Object::callBooleanMethodWithIntArg( const char* _pMethodName, 
jmethodID& _inout_MethodID, sal_Int32 _nArgument ) const
 {
-    jboolean out( false );
+    bool out( false );
     SDBThreadAttach t;
     OSL_ENSURE( t.pEnv, "java_lang_Object::callBooleanMethodWithIntArg: no 
Java environment anymore!" );
     obtainMethodId_throwSQL(t.pEnv, _pMethodName,"(I)Z", _inout_MethodID);
diff --git a/connectivity/source/drivers/jdbc/Reader.cxx 
b/connectivity/source/drivers/jdbc/Reader.cxx
index 1c7bfe9660df..5f49db97f05b 100644
--- a/connectivity/source/drivers/jdbc/Reader.cxx
+++ b/connectivity/source/drivers/jdbc/Reader.cxx
@@ -78,7 +78,7 @@ sal_Int32 SAL_CALL java_io_Reader::available(  )
 {
     if(m_buf)
         return 1;
-    jboolean out;
+    bool out;
     SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java environment has been deleted!");
 
     {
diff --git a/connectivity/source/drivers/mysqlc/mysqlc_prepared_resultset.cxx 
b/connectivity/source/drivers/mysqlc/mysqlc_prepared_resultset.cxx
index b0d83965f2f3..ddaba5fc9e45 100644
--- a/connectivity/source/drivers/mysqlc/mysqlc_prepared_resultset.cxx
+++ b/connectivity/source/drivers/mysqlc/mysqlc_prepared_resultset.cxx
@@ -111,9 +111,9 @@ bool OPreparedResultSet::fetchResult()
     }
     for (sal_Int32 i = 0; i < m_nColumnCount; ++i)
     {
-        m_aMetaData[i].is_null = 0;
+        m_aMetaData[i].is_null = false;
         m_aMetaData[i].length = 0l;
-        m_aMetaData[i].error = 0;
+        m_aMetaData[i].error = false;
 
         m_aData[i].is_null = &m_aMetaData[i].is_null;
         m_aData[i].buffer_length = m_aFields[i].type == MYSQL_TYPE_BLOB ? 0 : 
m_aFields[i].length;
diff --git a/connectivity/source/drivers/mysqlc/mysqlc_preparedstatement.cxx 
b/connectivity/source/drivers/mysqlc/mysqlc_preparedstatement.cxx
index e9082dfa05e9..902a1d93edb0 100644
--- a/connectivity/source/drivers/mysqlc/mysqlc_preparedstatement.cxx
+++ b/connectivity/source/drivers/mysqlc/mysqlc_preparedstatement.cxx
@@ -182,7 +182,7 @@ void SAL_CALL OPreparedStatement::setString(sal_Int32 
parameter, const OUString&
     m_binds[nIndex].buffer_type = MYSQL_TYPE_STRING;
     mysqlc_sdbc_driver::resetSqlVar(&m_binds[nIndex].buffer, 
stringie.getStr(), MYSQL_TYPE_STRING,
                                     stringie.getLength());
-    m_bindMetas[nIndex].is_null = 0;
+    m_bindMetas[nIndex].is_null = false;
     m_bindMetas[nIndex].length = stringie.getLength();
 }
 
@@ -228,7 +228,7 @@ void SAL_CALL OPreparedStatement::setBoolean(sal_Int32 
parameter, sal_Bool x)
     const sal_Int32 nIndex = parameter - 1;
     m_binds[nIndex].buffer_type = MYSQL_TYPE_TINY;
     mysqlc_sdbc_driver::resetSqlVar(&m_binds[nIndex].buffer, &x, 
MYSQL_TYPE_TINY);
-    m_bindMetas[nIndex].is_null = 0;
+    m_bindMetas[nIndex].is_null = false;
 }
 
 void SAL_CALL OPreparedStatement::setByte(sal_Int32 parameter, sal_Int8 x)
@@ -240,7 +240,7 @@ void SAL_CALL OPreparedStatement::setByte(sal_Int32 
parameter, sal_Int8 x)
     const sal_Int32 nIndex = parameter - 1;
     m_binds[nIndex].buffer_type = MYSQL_TYPE_TINY;
     mysqlc_sdbc_driver::resetSqlVar(&m_binds[nIndex].buffer, &x, 
MYSQL_TYPE_TINY);
-    m_bindMetas[nIndex].is_null = 0;
+    m_bindMetas[nIndex].is_null = false;
 }
 
 void SAL_CALL OPreparedStatement::setDate(sal_Int32 parameter, const Date& 
aData)
@@ -258,7 +258,7 @@ void SAL_CALL OPreparedStatement::setDate(sal_Int32 
parameter, const Date& aData
     const sal_Int32 nIndex = parameter - 1;
     m_binds[nIndex].buffer_type = MYSQL_TYPE_DATE;
     mysqlc_sdbc_driver::resetSqlVar(&m_binds[nIndex].buffer, &my_time, 
MYSQL_TYPE_DATE);
-    m_bindMetas[nIndex].is_null = 0;
+    m_bindMetas[nIndex].is_null = false;
 }
 
 void SAL_CALL OPreparedStatement::setTime(sal_Int32 parameter, const Time& 
aVal)
@@ -276,7 +276,7 @@ void SAL_CALL OPreparedStatement::setTime(sal_Int32 
parameter, const Time& aVal)
     const sal_Int32 nIndex = parameter - 1;
     m_binds[nIndex].buffer_type = MYSQL_TYPE_TIME;
     mysqlc_sdbc_driver::resetSqlVar(&m_binds[nIndex].buffer, &my_time, 
MYSQL_TYPE_TIME);
-    m_bindMetas[nIndex].is_null = 0;
+    m_bindMetas[nIndex].is_null = false;
 }
 
 void SAL_CALL OPreparedStatement::setTimestamp(sal_Int32 parameter, const 
DateTime& aVal)
@@ -297,7 +297,7 @@ void SAL_CALL OPreparedStatement::setTimestamp(sal_Int32 
parameter, const DateTi
     const sal_Int32 nIndex = parameter - 1;
     m_binds[nIndex].buffer_type = MYSQL_TYPE_DATETIME;
     mysqlc_sdbc_driver::resetSqlVar(&m_binds[nIndex].buffer, &my_time, 
MYSQL_TYPE_DATETIME);
-    m_bindMetas[nIndex].is_null = 0;
+    m_bindMetas[nIndex].is_null = false;
 }
 
 void SAL_CALL OPreparedStatement::setDouble(sal_Int32 parameter, double x)
@@ -309,7 +309,7 @@ void SAL_CALL OPreparedStatement::setDouble(sal_Int32 
parameter, double x)
     const sal_Int32 nIndex = parameter - 1;
     m_binds[nIndex].buffer_type = MYSQL_TYPE_DOUBLE;
     mysqlc_sdbc_driver::resetSqlVar(&m_binds[nIndex].buffer, &x, 
MYSQL_TYPE_DOUBLE);
-    m_bindMetas[nIndex].is_null = 0;
+    m_bindMetas[nIndex].is_null = false;
 }
 
 void SAL_CALL OPreparedStatement::setFloat(sal_Int32 parameter, float x)
@@ -321,7 +321,7 @@ void SAL_CALL OPreparedStatement::setFloat(sal_Int32 
parameter, float x)
     const sal_Int32 nIndex = parameter - 1;
     m_binds[nIndex].buffer_type = MYSQL_TYPE_FLOAT;
     mysqlc_sdbc_driver::resetSqlVar(&m_binds[nIndex].buffer, &x, 
MYSQL_TYPE_FLOAT);
-    m_bindMetas[nIndex].is_null = 0;
+    m_bindMetas[nIndex].is_null = false;
 }
 
 void SAL_CALL OPreparedStatement::setInt(sal_Int32 parameter, sal_Int32 x)
@@ -333,7 +333,7 @@ void SAL_CALL OPreparedStatement::setInt(sal_Int32 
parameter, sal_Int32 x)
     const sal_Int32 nIndex = parameter - 1;
     m_binds[nIndex].buffer_type = MYSQL_TYPE_LONG;
     mysqlc_sdbc_driver::resetSqlVar(&m_binds[nIndex].buffer, &x, 
MYSQL_TYPE_LONG);
-    m_bindMetas[nIndex].is_null = 0;
+    m_bindMetas[nIndex].is_null = false;
 }
 
 void SAL_CALL OPreparedStatement::setLong(sal_Int32 parameter, sal_Int64 aVal)
@@ -345,7 +345,7 @@ void SAL_CALL OPreparedStatement::setLong(sal_Int32 
parameter, sal_Int64 aVal)
     const sal_Int32 nIndex = parameter - 1;
     m_binds[nIndex].buffer_type = MYSQL_TYPE_LONGLONG;
     mysqlc_sdbc_driver::resetSqlVar(&m_binds[nIndex].buffer, &aVal, 
MYSQL_TYPE_LONGLONG);
-    m_bindMetas[nIndex].is_null = 0;
+    m_bindMetas[nIndex].is_null = false;
 }
 
 void SAL_CALL OPreparedStatement::setNull(sal_Int32 parameter, sal_Int32 
/*sqlType*/)
@@ -355,7 +355,7 @@ void SAL_CALL OPreparedStatement::setNull(sal_Int32 
parameter, sal_Int32 /*sqlTy
     checkParameterIndex(parameter);
 
     const sal_Int32 nIndex = parameter - 1;
-    m_bindMetas[nIndex].is_null = 1;
+    m_bindMetas[nIndex].is_null = true;
     free(m_binds[nIndex].buffer);
     m_binds[nIndex].buffer = nullptr;
 }
@@ -408,7 +408,7 @@ void SAL_CALL 
OPreparedStatement::setObjectWithInfo(sal_Int32 parameterIndex, co
     {
         free(m_binds[nIndex].buffer);
         m_binds[nIndex].buffer = nullptr;
-        m_bindMetas[parameterIndex - 1].is_null = 1;
+        m_bindMetas[parameterIndex - 1].is_null = true;
         return;
     }
 
@@ -433,7 +433,7 @@ void SAL_CALL 
OPreparedStatement::setObjectWithInfo(sal_Int32 parameterIndex, co
                 m_binds[nIndex].buffer_type = MYSQL_TYPE_DOUBLE;
                 mysqlc_sdbc_driver::resetSqlVar(&m_binds[nIndex].buffer, 
&nValue, MYSQL_TYPE_DOUBLE,
                                                 sValue.getLength());
-                m_bindMetas[nIndex].is_null = 0;
+                m_bindMetas[nIndex].is_null = false;
                 break;
             }
 
@@ -478,7 +478,7 @@ void SAL_CALL OPreparedStatement::setShort(sal_Int32 
parameter, sal_Int16 x)
     const sal_Int32 nIndex = parameter - 1;
     m_binds[nIndex].buffer_type = MYSQL_TYPE_SHORT;
     mysqlc_sdbc_driver::resetSqlVar(&m_binds[nIndex].buffer, &x, 
MYSQL_TYPE_SHORT);
-    m_bindMetas[nIndex].is_null = 0;
+    m_bindMetas[nIndex].is_null = false;
 }
 
 void SAL_CALL OPreparedStatement::setBytes(sal_Int32 parameter, const 
Sequence<sal_Int8>& x)
@@ -490,7 +490,7 @@ void SAL_CALL OPreparedStatement::setBytes(sal_Int32 
parameter, const Sequence<s
     const sal_Int32 nIndex = parameter - 1;
     m_binds[nIndex].buffer_type = MYSQL_TYPE_BLOB; // FIXME
     mysqlc_sdbc_driver::resetSqlVar(&m_binds[nIndex].buffer, &x, 
MYSQL_TYPE_BLOB);
-    m_bindMetas[nIndex].is_null = 0;
+    m_bindMetas[nIndex].is_null = false;
 }
 
 void SAL_CALL OPreparedStatement::setCharacterStream(sal_Int32 parameter,
@@ -524,7 +524,7 @@ void SAL_CALL OPreparedStatement::clearParameters()
 
     for (size_t i = 0; i < m_binds.size(); ++i)
     {
-        m_bindMetas[i].is_null = 1;
+        m_bindMetas[i].is_null = true;
         free(m_binds[i].buffer);
         m_binds[i].buffer = nullptr;
     }
diff --git a/connectivity/source/drivers/mysqlc/mysqlc_preparedstatement.hxx 
b/connectivity/source/drivers/mysqlc/mysqlc_preparedstatement.hxx
index 660fd17de2b2..f488e285bc41 100644
--- a/connectivity/source/drivers/mysqlc/mysqlc_preparedstatement.hxx
+++ b/connectivity/source/drivers/mysqlc/mysqlc_preparedstatement.hxx
@@ -47,9 +47,9 @@ using my_bool = char;
 
 struct BindMetaData
 {
-    my_bool is_null = 0;
+    my_bool is_null = false;
     unsigned long length = 0;
-    my_bool error = 0;
+    my_bool error = false;
 };
 
 typedef ::cppu::ImplHelper5<css::sdbc::XPreparedStatement, 
css::sdbc::XParameters,
diff --git a/javaunohelper/source/javaunohelper.cxx 
b/javaunohelper/source/javaunohelper.cxx
index 7081ecbc5538..823d069d769e 100644
--- a/javaunohelper/source/javaunohelper.cxx
+++ b/javaunohelper/source/javaunohelper.cxx
@@ -124,7 +124,7 @@ jboolean 
Java_com_sun_star_comp_helper_SharedLibraryLoader_component_1writeInfo(
         lib.release();
     }
 #endif
-    return bRet ? JNI_TRUE : JNI_FALSE;
+    return bRet;
 }
 
 /*
diff --git a/libreofficekit/qa/gtktiledviewer/gtv-calc-header-bar.cxx 
b/libreofficekit/qa/gtktiledviewer/gtv-calc-header-bar.cxx
index ee75100464f3..68c3e881caa4 100644
--- a/libreofficekit/qa/gtktiledviewer/gtv-calc-header-bar.cxx
+++ b/libreofficekit/qa/gtktiledviewer/gtv-calc-header-bar.cxx
@@ -101,7 +101,7 @@ static void gtv_calc_header_bar_draw_text(cairo_t* pCairo, 
const GdkRectangle& r
     cairo_show_text(pCairo, rText.c_str());
 }
 
-static gboolean gtv_calc_header_bar_draw_impl(GtkWidget* pWidget, cairo_t* 
pCairo)
+static bool gtv_calc_header_bar_draw_impl(GtkWidget* pWidget, cairo_t* pCairo)
 {
     GtvCalcHeaderBar* self = GTV_CALC_HEADER_BAR(pWidget);
     GtvCalcHeaderBarPrivate& priv = getPrivate(GTV_CALC_HEADER_BAR(self));
diff --git 
a/libreofficekit/qa/gtktiledviewer/gtv-lokdocview-signal-handlers.cxx 
b/libreofficekit/qa/gtktiledviewer/gtv-lokdocview-signal-handlers.cxx
index 73d945420ab0..4a9df33d6ba2 100644
--- a/libreofficekit/qa/gtktiledviewer/gtv-lokdocview-signal-handlers.cxx
+++ b/libreofficekit/qa/gtktiledviewer/gtv-lokdocview-signal-handlers.cxx
@@ -43,7 +43,7 @@ static gboolean destroyLokDialog(GtkWidget* pWidget, gpointer 
userdata)
 void LOKDocViewSigHandlers::editChanged(LOKDocView* pDocView, gboolean 
bWasEdit, gpointer)
 {
     GtvApplicationWindow* window = 
GTV_APPLICATION_WINDOW(gtk_widget_get_toplevel(GTK_WIDGET(pDocView)));
-    gboolean bEdit = lok_doc_view_get_edit(LOK_DOC_VIEW(window->lokdocview));
+    bool bEdit = lok_doc_view_get_edit(LOK_DOC_VIEW(window->lokdocview));
     g_info("signalEdit: %d -> %d", bWasEdit, bEdit);
 
     // Let the main toolbar know, so that it can enable disable the button
@@ -64,8 +64,8 @@ void LOKDocViewSigHandlers::commandChanged(LOKDocView* 
pDocView, char* pPayload,
         if (pItem != nullptr)
         {
             if (aValue == "true" || aValue == "false") {
-                gboolean bEdit = aValue == "true";
-                if 
(gtk_toggle_tool_button_get_active(GTK_TOGGLE_TOOL_BUTTON(pItem)) != bEdit)
+                bool bEdit = aValue == "true";
+                if 
(bool(gtk_toggle_tool_button_get_active(GTK_TOGGLE_TOOL_BUTTON(pItem))) != 
bEdit)
                 {
                     // Avoid invoking lok_doc_view_post_command().
                     // FIXME: maybe block/unblock the signal (see
@@ -76,7 +76,7 @@ void LOKDocViewSigHandlers::commandChanged(LOKDocView* 
pDocView, char* pPayload,
 
                 }
             } else if (aValue == "enabled" || aValue == "disabled") {
-                gboolean bSensitive = aValue == "enabled";
+                bool bSensitive = aValue == "enabled";
                 gtk_widget_set_sensitive(GTK_WIDGET(pItem), bSensitive);
 
                 // Remember state, so in case edit is disable and enabled
diff --git a/libreofficekit/source/gtk/lokdocview.cxx 
b/libreofficekit/source/gtk/lokdocview.cxx
index 5dd0457479af..b4fe85f2c939 100644
--- a/libreofficekit/source/gtk/lokdocview.cxx
+++ b/libreofficekit/source/gtk/lokdocview.cxx
@@ -359,7 +359,7 @@ static void
 LOKPostCommand (LOKDocView* pDocView,
                 const gchar* pCommand,
                 const gchar* pArguments,
-                gboolean bNotifyWhenFinished)
+                bool bNotifyWhenFinished)
 {
     LOKDocViewPrivate& priv = getPrivate(pDocView);
     GTask* task = g_task_new(pDocView, nullptr, nullptr, nullptr);
@@ -903,7 +903,7 @@ globalCallback (gpointer pData)
 {
     CallbackData* pCallback = static_cast<CallbackData*>(pData);
     LOKDocViewPrivate& priv = getPrivate(pCallback->m_pDocView);
-    gboolean bModify = false;
+    bool bModify = false;
 
     switch (pCallback->m_nType)
     {
@@ -1111,7 +1111,7 @@ callback (gpointer pData)
     case LOK_CALLBACK_TEXT_SELECTION:
     {
         priv->m_aTextSelectionRectangles = payloadToRectangles(pDocView, 
pCallback->m_aPayload.c_str());
-        gboolean bIsTextSelected = !priv->m_aTextSelectionRectangles.empty();
+        bool bIsTextSelected = !priv->m_aTextSelectionRectangles.empty();
         // In case the selection is empty, then we get no 
LOK_CALLBACK_TEXT_SELECTION_START/END events.
         if (!bIsTextSelected)
         {
@@ -1545,7 +1545,7 @@ paintTileCallback(GObject* sourceObject, GAsyncResult* 
res, gpointer userData)
 }
 
 
-static gboolean
+static bool
 renderDocument(LOKDocView* pDocView, cairo_t* pCairo)
 {
     LOKDocViewPrivate& priv = getPrivate(pDocView);
@@ -1665,7 +1665,7 @@ static const GdkRGBA& getDarkColor(int nViewId, 
LOKDocViewPrivate& priv)
     return aColorMap[nViewId];
 }
 
-static gboolean
+static bool
 renderOverlay(LOKDocView* pDocView, cairo_t* pCairo)
 {
     LOKDocViewPrivate& priv = getPrivate(pDocView);
@@ -2267,8 +2267,8 @@ setEditInThread(gpointer data)
     LOKDocView* pDocView = LOK_DOC_VIEW(g_task_get_source_object(task));
     LOKDocViewPrivate& priv = getPrivate(pDocView);
     LOEvent* pLOEvent = static_cast<LOEvent*>(g_task_get_task_data(task));
-    gboolean bWasEdit = priv->m_bEdit;
-    gboolean bEdit = pLOEvent->m_bEdit;
+    bool bWasEdit = priv->m_bEdit;
+    bool bEdit = pLOEvent->m_bEdit;
 
     if (!priv->m_bEdit && bEdit)
         g_info("lok_doc_view_set_edit: entering edit mode");
@@ -2463,9 +2463,9 @@ static void lok_doc_view_set_property (GObject* object, 
guint propId, const GVal
 {
     LOKDocView* pDocView = LOK_DOC_VIEW (object);
     LOKDocViewPrivate& priv = getPrivate(pDocView);
-    gboolean bDocPasswordEnabled = priv->m_nLOKFeatures & 
LOK_FEATURE_DOCUMENT_PASSWORD;
-    gboolean bDocPasswordToModifyEnabled = priv->m_nLOKFeatures & 
LOK_FEATURE_DOCUMENT_PASSWORD_TO_MODIFY;
-    gboolean bTiledAnnotationsEnabled = !(priv->m_nLOKFeatures & 
LOK_FEATURE_NO_TILED_ANNOTATIONS);
+    bool bDocPasswordEnabled = priv->m_nLOKFeatures & 
LOK_FEATURE_DOCUMENT_PASSWORD;
+    bool bDocPasswordToModifyEnabled = priv->m_nLOKFeatures & 
LOK_FEATURE_DOCUMENT_PASSWORD_TO_MODIFY;
+    bool bTiledAnnotationsEnabled = !(priv->m_nLOKFeatures & 
LOK_FEATURE_NO_TILED_ANNOTATIONS);
 
     switch (propId)
     {
@@ -2502,21 +2502,21 @@ static void lok_doc_view_set_property (GObject* object, 
guint propId, const GVal
         priv->m_nDocumentHeightTwips = g_value_get_long (value);
         break;
     case PROP_DOC_PASSWORD:
-        if (g_value_get_boolean (value) != bDocPasswordEnabled)
+        if (bool(g_value_get_boolean (value)) != bDocPasswordEnabled)
         {
             priv->m_nLOKFeatures = priv->m_nLOKFeatures ^ 
LOK_FEATURE_DOCUMENT_PASSWORD;
             priv->m_pOffice->pClass->setOptionalFeatures(priv->m_pOffice, 
priv->m_nLOKFeatures);
         }
         break;
     case PROP_DOC_PASSWORD_TO_MODIFY:
-        if ( g_value_get_boolean (value) != bDocPasswordToModifyEnabled)
+        if ( bool(g_value_get_boolean (value)) != bDocPasswordToModifyEnabled)
         {
             priv->m_nLOKFeatures = priv->m_nLOKFeatures ^ 
LOK_FEATURE_DOCUMENT_PASSWORD_TO_MODIFY;
             priv->m_pOffice->pClass->setOptionalFeatures(priv->m_pOffice, 
priv->m_nLOKFeatures);
         }
         break;
     case PROP_TILED_ANNOTATIONS:
-        if ( g_value_get_boolean (value) != bTiledAnnotationsEnabled)
+        if ( bool(g_value_get_boolean (value)) != bTiledAnnotationsEnabled)
         {
             priv->m_nLOKFeatures = priv->m_nLOKFeatures ^ 
LOK_FEATURE_NO_TILED_ANNOTATIONS;
             priv->m_pOffice->pClass->setOptionalFeatures(priv->m_pOffice, 
priv->m_nLOKFeatures);
@@ -2580,10 +2580,10 @@ static void lok_doc_view_get_property (GObject* object, 
guint propId, GValue *va
         g_value_set_boolean (value, priv->m_bCanZoomOut);
         break;
     case PROP_DOC_PASSWORD:
-        g_value_set_boolean (value, priv->m_nLOKFeatures & 
LOK_FEATURE_DOCUMENT_PASSWORD);
+        g_value_set_boolean (value, (priv->m_nLOKFeatures & 
LOK_FEATURE_DOCUMENT_PASSWORD) != 0);
         break;
     case PROP_DOC_PASSWORD_TO_MODIFY:
-        g_value_set_boolean (value, priv->m_nLOKFeatures & 
LOK_FEATURE_DOCUMENT_PASSWORD_TO_MODIFY);
+        g_value_set_boolean (value, (priv->m_nLOKFeatures & 
LOK_FEATURE_DOCUMENT_PASSWORD_TO_MODIFY) != 0);
         break;
     case PROP_TILED_ANNOTATIONS:
         g_value_set_boolean (value, !(priv->m_nLOKFeatures & 
LOK_FEATURE_NO_TILED_ANNOTATIONS));
@@ -3780,7 +3780,7 @@ lok_doc_view_paste (LOKDocView* pDocView,
 {
     LOKDocViewPrivate& priv = getPrivate(pDocView);
     LibreOfficeKitDocument* pDocument = priv->m_pDocument;
-    gboolean ret = 0;
+    bool ret = 0;
 
     if (!pDocument)
         return false;
diff --git a/solenv/CompilerTest_compilerplugins_clang.mk 
b/solenv/CompilerTest_compilerplugins_clang.mk
index 1014d3f8c909..6766e3821bf2 100644
--- a/solenv/CompilerTest_compilerplugins_clang.mk
+++ b/solenv/CompilerTest_compilerplugins_clang.mk
@@ -36,6 +36,7 @@ $(eval $(call 
gb_CompilerTest_add_exception_objects,compilerplugins_clang, \
     compilerplugins/clang/test/expressionalwayszero \
     compilerplugins/clang/test/intvsfloat \
     compilerplugins/clang/test/faileddyncast \
+    compilerplugins/clang/test/fakebool \
     compilerplugins/clang/test/finalprotected \
     compilerplugins/clang/test/flatten \
     compilerplugins/clang/test/fragiledestructor \
@@ -60,7 +61,6 @@ $(eval $(call 
gb_CompilerTest_add_exception_objects,compilerplugins_clang, \
     compilerplugins/clang/test/refcounting \
     compilerplugins/clang/test/referencecasting \
     compilerplugins/clang/test/returnconstval \
-    compilerplugins/clang/test/salbool \
     compilerplugins/clang/test/salcall \
     compilerplugins/clang/test/sallogareas \
     compilerplugins/clang/test/salunicodeliteral \
diff --git a/solenv/clang-format/blacklist b/solenv/clang-format/blacklist
index 9f390fc07640..6f092e83d27b 100644
--- a/solenv/clang-format/blacklist
+++ b/solenv/clang-format/blacklist
@@ -1679,6 +1679,7 @@ compilerplugins/clang/expressionalwayszero.cxx
 compilerplugins/clang/externandnotdefined.cxx
 compilerplugins/clang/externvar.cxx
 compilerplugins/clang/faileddyncast.cxx
+compilerplugins/clang/fakebool.cxx
 compilerplugins/clang/finalclasses.cxx
 compilerplugins/clang/finalprotected.cxx
 compilerplugins/clang/flatten.cxx
@@ -1714,7 +1715,6 @@ compilerplugins/clang/redundantpointerops.cxx
 compilerplugins/clang/refcounting.cxx
 compilerplugins/clang/rendercontext.cxx
 compilerplugins/clang/reservedid.cxx
-compilerplugins/clang/salbool.cxx
 compilerplugins/clang/sallogareas.cxx
 compilerplugins/clang/salunicodeliteral.cxx
 compilerplugins/clang/sfxpoolitem.cxx
@@ -1787,6 +1787,7 @@ compilerplugins/clang/test/expressionalwayszero.cxx
 compilerplugins/clang/test/externvar.cxx
 compilerplugins/clang/test/externvar.hxx
 compilerplugins/clang/test/faileddyncast.cxx
+compilerplugins/clang/test/fakebool.cxx
 compilerplugins/clang/test/finalprotected.cxx
 compilerplugins/clang/test/flatten.cxx
 compilerplugins/clang/test/indentation.cxx
@@ -1803,7 +1804,6 @@ compilerplugins/clang/test/redundantinline.cxx
 compilerplugins/clang/test/redundantinline.hxx
 compilerplugins/clang/test/redundantpointerops.cxx
 compilerplugins/clang/test/refcounting.cxx
-compilerplugins/clang/test/salbool.cxx
 compilerplugins/clang/test/salunicodeliteral.cxx
 compilerplugins/clang/test/salunicodeliteral.hxx
 compilerplugins/clang/test/stringconcatauto.cxx
diff --git a/ucb/source/ucp/gio/gio_content.cxx 
b/ucb/source/ucp/gio/gio_content.cxx
index 053f30fec50a..05c26c42760f 100644
--- a/ucb/source/ucp/gio/gio_content.cxx
+++ b/ucb/source/ucp/gio/gio_content.cxx
@@ -1084,7 +1084,7 @@ void Content::transfer( const css::ucb::TransferInfo& 
aTransferInfo, const css::
     GFile *pDest = g_file_new_for_uri(OUStringToOString(sDest, 
RTL_TEXTENCODING_UTF8).getStr());
     GFile *pSource = 
g_file_new_for_uri(OUStringToOString(aTransferInfo.SourceURL, 
RTL_TEXTENCODING_UTF8).getStr());
 
-    gboolean bSuccess = false;
+    bool bSuccess = false;
     GError *pError = nullptr;
     if (aTransferInfo.MoveData)
         bSuccess = g_file_move(pSource, pDest, G_FILE_COPY_OVERWRITE, nullptr, 
nullptr, nullptr, &pError);
diff --git a/vcl/source/gdi/scrptrun.cxx b/vcl/source/gdi/scrptrun.cxx
index cee6fb27eb15..b18816cac26c 100644
--- a/vcl/source/gdi/scrptrun.cxx
+++ b/vcl/source/gdi/scrptrun.cxx
@@ -137,7 +137,7 @@ namespace vcl {
 
 const char ScriptRun::fgClassID=0;
 
-static UBool sameScript(int32_t scriptOne, int32_t scriptTwo)
+static bool sameScript(int32_t scriptOne, int32_t scriptTwo)
 {
     return scriptOne <= USCRIPT_INHERITED || scriptTwo <= USCRIPT_INHERITED || 
scriptOne == scriptTwo;
 }
diff --git a/vcl/unx/gtk3/a11y/gtk3atklistener.cxx 
b/vcl/unx/gtk3/a11y/gtk3atklistener.cxx
index 4a7d41638479..f690edfe62e3 100644
--- a/vcl/unx/gtk3/a11y/gtk3atklistener.cxx
+++ b/vcl/unx/gtk3/a11y/gtk3atklistener.cxx
@@ -468,7 +468,7 @@ void AtkListener::notifyEvent( const 
accessibility::AccessibleEventObject& aEven
             AtkStateType eOldState = mapState( aEvent.OldValue );
             AtkStateType eNewState = mapState( aEvent.NewValue );
 
-            gboolean bState = eNewState != ATK_STATE_INVALID;
+            bool bState = eNewState != ATK_STATE_INVALID;
             AtkStateType eRealState = bState ? eNewState : eOldState;
 
             atk_object_notify_state_change( atk_obj, eRealState, bState );
diff --git a/vcl/unx/gtk3/fpicker/SalGtkFilePicker.cxx 
b/vcl/unx/gtk3/fpicker/SalGtkFilePicker.cxx
index 1892155527bc..75f832cc815a 100644
--- a/vcl/unx/gtk3/fpicker/SalGtkFilePicker.cxx
+++ b/vcl/unx/gtk3/fpicker/SalGtkFilePicker.cxx
@@ -1480,7 +1480,7 @@ void SalGtkFilePicker::selection_changed_cb( 
GtkFileChooser *, SalGtkFilePicker
 
 void SalGtkFilePicker::update_preview_cb( GtkFileChooser *file_chooser, 
SalGtkFilePicker* pobjFP )
 {
-    gboolean have_preview = false;
+    bool have_preview = false;
 
     GtkWidget* preview = pobjFP->m_pPreview;
     char* filename = gtk_file_chooser_get_preview_filename( file_chooser );
@@ -1794,7 +1794,7 @@ extern "C"
 static gboolean
 case_insensitive_filter (const GtkFileFilterInfo *filter_info, gpointer data)
 {
-    gboolean bRetval = false;
+    bool bRetval = false;
     const char *pFilter = static_cast<const char *>(data);
 
     g_return_val_if_fail( data != nullptr, false );
diff --git a/vcl/unx/gtk3/gtk3gloactiongroup.cxx 
b/vcl/unx/gtk3/gtk3gloactiongroup.cxx
index 88189f34e23e..ca315b07e01b 100644
--- a/vcl/unx/gtk3/gtk3gloactiongroup.cxx
+++ b/vcl/unx/gtk3/gtk3gloactiongroup.cxx
@@ -187,7 +187,7 @@ g_lo_action_group_perform_submenu_action (GLOActionGroup 
*group,
                                           const gchar    *action_name,
                                           GVariant       *state)
 {
-    gboolean bState = g_variant_get_boolean (state);
+    bool bState = g_variant_get_boolean (state);
     SAL_INFO("vcl.unity", "g_lo_action_group_perform_submenu_action on " << 
group << " to " << bState);
 
     if (bState)
@@ -217,7 +217,7 @@ g_lo_action_group_change_state (GActionGroup *group,
                 g_lo_action_group_perform_submenu_action (lo_group, 
action_name, value);
             else
             {
-                gboolean is_new = FALSE;
+                bool is_new = FALSE;
 
                 /* If action already exists but has no state, it should be 
removed and added again. */
                 if (action->state_type == nullptr)
diff --git a/vcl/unx/gtk3/gtk3glomenu.cxx b/vcl/unx/gtk3/gtk3glomenu.cxx
index d6ac0d0a89ae..a82c6946422c 100644
--- a/vcl/unx/gtk3/gtk3glomenu.cxx
+++ b/vcl/unx/gtk3/gtk3glomenu.cxx
@@ -52,7 +52,7 @@ g_lo_menu_struct_item_init (struct item *menu_item)
  * - no consecutive '-'
  * - not longer than 1024 chars
  */
-static gboolean
+static bool
 valid_attribute_name (const gchar *name)
 {
     gint i;
diff --git a/vcl/unx/gtk3/gtk3gtkdata.cxx b/vcl/unx/gtk3/gtk3gtkdata.cxx
index e1c19825de3c..66a5dfcce890 100644
--- a/vcl/unx/gtk3/gtk3gtkdata.cxx
+++ b/vcl/unx/gtk3/gtk3gtkdata.cxx
@@ -375,7 +375,7 @@ bool GtkSalData::Yield( bool bWait, bool 
bHandleAllCurrentEvents )
         if( bDispatchThread )
         {
             int nMaxEvents = bHandleAllCurrentEvents ? 100 : 1;
-            gboolean wasOneEvent = TRUE;
+            bool wasOneEvent = TRUE;
             while( nMaxEvents-- && wasOneEvent )
             {
                 wasOneEvent = g_main_context_iteration( nullptr, bWait && 
!bWasEvent );
diff --git a/vcl/unx/gtk3/gtk3gtkframe.cxx b/vcl/unx/gtk3/gtk3gtkframe.cxx
index deeaac3140cd..4c4005dc9a7c 100644
--- a/vcl/unx/gtk3/gtk3gtkframe.cxx
+++ b/vcl/unx/gtk3/gtk3gtkframe.cxx
@@ -490,7 +490,7 @@ static void hud_activated( gboolean hud_active, gpointer 
user_data )
     }
 }
 
-static gboolean ensure_dbus_setup( gpointer data )
+static bool ensure_dbus_setup( gpointer data )
 {
     GtkSalFrame* pSalFrame = static_cast< GtkSalFrame* >( data );
     GdkWindow* gdkWindow = widget_get_window( pSalFrame->getWindow() );
@@ -3429,7 +3429,7 @@ gboolean GtkDropTarget::signalDragDrop(GtkWidget* 
pWidget, GdkDragContext* conte
 {
     // remove the deferred dragExit, as we'll do a drop
 #ifndef NDEBUG
-    gboolean res =
+    bool res =
 #endif
         g_idle_remove_by_data(this);
     assert(res);
@@ -3808,7 +3808,7 @@ bool GtkSalFrame::IMHandler::handleKeyEvent( GdkEventKey* 
pEvent )
         if( aDel.isDeleted() )
             return true;
 
-        gboolean bResult = gtk_im_context_filter_keypress( m_pIMContext, 
pEvent );
+        bool bResult = gtk_im_context_filter_keypress( m_pIMContext, pEvent );
         g_object_unref( pRef );
 
         if( aDel.isDeleted() )
@@ -3839,7 +3839,7 @@ bool GtkSalFrame::IMHandler::handleKeyEvent( GdkEventKey* 
pEvent )
     if (pEvent->type == GDK_KEY_RELEASE)
     {
         GObject* pRef = G_OBJECT( g_object_ref( G_OBJECT( m_pIMContext ) ) );
-        gboolean bResult = gtk_im_context_filter_keypress( m_pIMContext, 
pEvent );
+        bool bResult = gtk_im_context_filter_keypress( m_pIMContext, pEvent );
         g_object_unref( pRef );
 
         if( aDel.isDeleted() )
diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index 83c6bbaf9f63..f3ec6ddfb71e 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -2521,7 +2521,7 @@ public:
     {
         //for toplevel windows this is sadly futile under wayland, so we can't 
tell where a dialog is in order to allow
         //the document underneath to auto-scroll to place content in a visible 
location
-        gboolean ret = gtk_widget_translate_coordinates(m_pWidget,
+        bool ret = gtk_widget_translate_coordinates(m_pWidget,
                                                         
dynamic_cast<GtkInstanceWidget&>(rRelative).getWidget(),
                                                         0, 0, &x, &y);
         width = gtk_widget_get_allocated_width(m_pWidget);
@@ -7385,7 +7385,7 @@ private:
         pThis->signal_activated();
     }
 
-    gboolean signal_key_press(GdkEventKey* pEvent)
+    bool signal_key_press(GdkEventKey* pEvent)
     {
         if (pEvent->keyval == GDK_KEY_Return)
         {
@@ -8101,7 +8101,7 @@ private:
 
     bool get_bool(int pos, int col) const
     {
-        gboolean bRet(false);
+        bool bRet(false);
         GtkTreeModel *pModel = GTK_TREE_MODEL(m_pTreeStore);
         GtkTreeIter iter;
         if (gtk_tree_model_iter_nth_child(pModel, &iter, nullptr, pos))
@@ -8358,7 +8358,7 @@ private:
         g_DragSource = nullptr;
     }
 
-    gboolean signal_key_press(GdkEventKey* pEvent)
+    bool signal_key_press(GdkEventKey* pEvent)
     {
         if (pEvent->keyval != GDK_KEY_Left && pEvent->keyval != GDK_KEY_Right)
             return false;
@@ -9322,7 +9322,7 @@ public:
         GtkInstanceTreeIter& rGtkIter = 
static_cast<GtkInstanceTreeIter&>(rIter);
         GtkTreeModel *pModel = GTK_TREE_MODEL(m_pTreeStore);
         GtkTreeIter tmp;
-        gboolean ret = gtk_tree_model_iter_children(pModel, &tmp, 
&rGtkIter.iter);
+        bool ret = gtk_tree_model_iter_children(pModel, &tmp, &rGtkIter.iter);
         rGtkIter.iter = tmp;
         if (ret)
         {
@@ -11094,7 +11094,7 @@ private:
     std::unique_ptr<comphelper::string::NaturalStringSorter> m_xSorter;
     vcl::QuickSelectionEngine m_aQuickSelectionEngine;
     std::vector<int> m_aSeparatorRows;
-    gboolean m_bPopupActive;
+    bool m_bPopupActive;
     bool m_bAutoComplete;
     bool m_bAutoCompleteCaseSensitive;
     gulong m_nToggleFocusInSignalId;
@@ -11217,7 +11217,7 @@ private:
         m_aQuickSelectionEngine.Reset();
         gboolean bIsShown(false);
         g_object_get(m_pComboBox, "popup-shown", &bIsShown, nullptr);
-        if (m_bPopupActive != bIsShown)
+        if (m_bPopupActive != bool(bIsShown))
         {
             m_bPopupActive = bIsShown;
             ComboBox::signal_popup_toggled();
@@ -11965,7 +11965,7 @@ private:
     guint m_nAutoCompleteIdleId;
     bool m_bAutoCompleteCaseSensitive;
 
-    gboolean signal_key_press(GdkEventKey* pEvent)
+    bool signal_key_press(GdkEventKey* pEvent)
     {
         if (pEvent->keyval == GDK_KEY_KP_Up || pEvent->keyval == GDK_KEY_Up || 
pEvent->keyval == GDK_KEY_KP_Page_Up || pEvent->keyval == GDK_KEY_Page_Up ||
             pEvent->keyval == GDK_KEY_KP_Down || pEvent->keyval == 
GDK_KEY_Down || pEvent->keyval == GDK_KEY_KP_Page_Down || pEvent->keyval == 
GDK_KEY_Page_Down)
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to