[Libreoffice-commits] core.git: compilerplugins/clang

Stephan Bergmann sbergman at redhat.com
Thu Feb 13 10:49:44 CET 2014


 compilerplugins/clang/implicitboolconversion.cxx |   23 +++++++++++++++++------
 1 file changed, 17 insertions(+), 6 deletions(-)

New commits:
commit d19598b56c8bec688d1944cd167f32a369344100
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Thu Feb 13 10:49:01 2014 +0100

    Adapt ImplicitBoolConversion to 32-bit builds (where sal_Int32 is long)
    
    Change-Id: I64480e6026e7e39fe89f90c7d269f6bb1d02968d

diff --git a/compilerplugins/clang/implicitboolconversion.cxx b/compilerplugins/clang/implicitboolconversion.cxx
index 5a44ad6..34eaec8 100644
--- a/compilerplugins/clang/implicitboolconversion.cxx
+++ b/compilerplugins/clang/implicitboolconversion.cxx
@@ -493,12 +493,23 @@ bool ImplicitBoolConversion::TraverseReturnStmt(ReturnStmt * stmt) {
 }
 
 bool ImplicitBoolConversion::TraverseFunctionDecl(FunctionDecl * decl) {
-    bool ext = hasCLanguageLinkageType(decl)
-        && decl->isThisDeclarationADefinition()
-        && (compat::getReturnType(*decl)->isSpecificBuiltinType(
-                BuiltinType::Int)
-            || compat::getReturnType(*decl)->isSpecificBuiltinType(
-                BuiltinType::UInt));
+    bool ext = false;
+    if (hasCLanguageLinkageType(decl) && decl->isThisDeclarationADefinition()) {
+        QualType t { compat::getReturnType(*decl) };
+        if (t->isSpecificBuiltinType(BuiltinType::Int)
+            || t->isSpecificBuiltinType(BuiltinType::UInt))
+        {
+            ext = true;
+        } else {
+            TypedefType const * t2 = t->getAs<TypedefType>();
+            // cf. rtl_locale_equals (and sal_Int32 can be long):
+            if (t2 != nullptr
+                && t2->getDecl()->getNameAsString() == "sal_Int32")
+            {
+                ext = true;
+            }
+        }
+    }
     if (ext) {
         assert(!externCIntFunctionDefinition);
         externCIntFunctionDefinition = true;


More information about the Libreoffice-commits mailing list