More loplugin::TypeCheck use

Change-Id: I2f4a26a918134568f541cd45bdcf5a12b1f1d2ee
This commit is contained in:
Stephan Bergmann
2015-12-08 22:56:02 +01:00
parent 8d2c9a60b2
commit bb24492c76
5 changed files with 80 additions and 116 deletions

View File

@@ -20,6 +20,7 @@
#include <fstream>
#include <regex>
#include "plugin.hxx"
#include "typecheck.hxx"
#include "clang/Frontend/CompilerInstance.h"
namespace {
@@ -45,11 +46,6 @@ clang::Expr const * ignoreParenImplicitComma(clang::Expr const * expr) {
}
}
bool isPlainChar(clang::QualType type) {
return type->isSpecificBuiltinType(clang::BuiltinType::Char_S)
|| type->isSpecificBuiltinType(clang::BuiltinType::Char_U);
}
bool overridesXServiceInfo(clang::CXXMethodDecl const * decl) {
for (auto i = decl->begin_overridden_methods();
i != decl->end_overridden_methods(); ++i)
@@ -145,7 +141,8 @@ bool GetImplementationName::isStringConstant(
{
QualType t = expr->getType();
if (!(t->isConstantArrayType() && t.isConstQualified()
&& isPlainChar(t->getAsArrayTypeUnsafe()->getElementType())))
&& (loplugin::TypeCheck(t->getAsArrayTypeUnsafe()->getElementType())
.Char())))
{
return false;
}