diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2014-02-13 10:49:01 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2014-02-13 10:49:13 +0100 |
commit | d19598b56c8bec688d1944cd167f32a369344100 (patch) | |
tree | da2a388e49a04db66c269970257bffaa00699011 /compilerplugins | |
parent | 08ab57473236b0a34917d8c24c56f157e9ae5be6 (diff) |
Adapt ImplicitBoolConversion to 32-bit builds (where sal_Int32 is long)
Change-Id: I64480e6026e7e39fe89f90c7d269f6bb1d02968d
Diffstat (limited to 'compilerplugins')
-rw-r--r-- | compilerplugins/clang/implicitboolconversion.cxx | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/compilerplugins/clang/implicitboolconversion.cxx b/compilerplugins/clang/implicitboolconversion.cxx index 5a44ad6b7bfa..34eaec8c0ccc 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; |