loplugins ignoreLocation() is unreliable with PCH
Change-Id: Ic12cacb6e058a8725ea6d722399e3afe6ea458c6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132115 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
parent
2029b2f6dd
commit
ace70dae44
@ -180,8 +180,7 @@ bool SingleValFields::VisitFieldDecl( const FieldDecl* fieldDecl )
|
||||
{
|
||||
auto canonicalDecl = fieldDecl->getCanonicalDecl();
|
||||
|
||||
if( ignoreLocation( canonicalDecl )
|
||||
|| isInUnoIncludeFile( compiler.getSourceManager().getSpellingLoc(canonicalDecl->getLocation())) )
|
||||
if( isInUnoIncludeFile( compiler.getSourceManager().getSpellingLoc(canonicalDecl->getLocation())) )
|
||||
return true;
|
||||
|
||||
MyFieldInfo aInfo;
|
||||
@ -212,8 +211,7 @@ bool SingleValFields::VisitVarDecl( const VarDecl* varDecl )
|
||||
if (!canonicalDecl->getLocation().isValid())
|
||||
return true;
|
||||
|
||||
if( ignoreLocation( canonicalDecl )
|
||||
|| isInUnoIncludeFile( compiler.getSourceManager().getSpellingLoc(canonicalDecl->getLocation())) )
|
||||
if( isInUnoIncludeFile( compiler.getSourceManager().getSpellingLoc(canonicalDecl->getLocation())) )
|
||||
return true;
|
||||
|
||||
MyFieldInfo aInfo;
|
||||
@ -233,9 +231,6 @@ bool SingleValFields::VisitVarDecl( const VarDecl* varDecl )
|
||||
|
||||
bool SingleValFields::VisitCXXConstructorDecl( const CXXConstructorDecl* decl )
|
||||
{
|
||||
if( ignoreLocation( decl ) )
|
||||
return true;
|
||||
|
||||
// doesn't count as a write to fields because it's self->self
|
||||
if (decl->isCopyOrMoveConstructor())
|
||||
return true;
|
||||
@ -266,8 +261,6 @@ bool SingleValFields::VisitMemberExpr( const MemberExpr* memberExpr )
|
||||
const FieldDecl* fieldDecl = dyn_cast<FieldDecl>(decl);
|
||||
if (!fieldDecl)
|
||||
return true;
|
||||
if (ignoreLocation(memberExpr))
|
||||
return true;
|
||||
walkPotentialAssign(fieldDecl, memberExpr);
|
||||
return true;
|
||||
}
|
||||
@ -283,8 +276,6 @@ bool SingleValFields::VisitDeclRefExpr( const DeclRefExpr* declRefExpr )
|
||||
return true;
|
||||
if (!(varDecl->isStaticLocal() || varDecl->isStaticDataMember() || varDecl->hasGlobalStorage()))
|
||||
return true;
|
||||
if (ignoreLocation(declRefExpr))
|
||||
return true;
|
||||
walkPotentialAssign(varDecl, declRefExpr);
|
||||
return true;
|
||||
}
|
||||
|
@ -108,9 +108,6 @@ std::string niceName(const CXXMethodDecl* cxxMethodDecl)
|
||||
|
||||
bool UnnecessaryVirtual::VisitCXXMethodDecl( const CXXMethodDecl* methodDecl )
|
||||
{
|
||||
if (ignoreLocation(methodDecl)) {
|
||||
return true;
|
||||
}
|
||||
if (!methodDecl->isVirtual() || methodDecl->isDeleted()) {
|
||||
return true;
|
||||
}
|
||||
@ -132,6 +129,8 @@ bool UnnecessaryVirtual::VisitCXXMethodDecl( const CXXMethodDecl* methodDecl )
|
||||
return true;
|
||||
|
||||
methodDecl = methodDecl->getCanonicalDecl();
|
||||
if (!methodDecl)
|
||||
return true;
|
||||
std::string aNiceName = niceName(methodDecl);
|
||||
|
||||
// for destructors, we need to check if any of the superclass' destructors are virtual
|
||||
@ -147,8 +146,11 @@ bool UnnecessaryVirtual::VisitCXXMethodDecl( const CXXMethodDecl* methodDecl )
|
||||
if (baseSpecifier->getType()->isRecordType())
|
||||
{
|
||||
const CXXRecordDecl* superclassCXXRecordDecl = baseSpecifier->getType()->getAsCXXRecordDecl();
|
||||
std::string aOverriddenNiceName = niceName(superclassCXXRecordDecl->getDestructor());
|
||||
overridingSet.insert(aOverriddenNiceName);
|
||||
if (superclassCXXRecordDecl->getDestructor())
|
||||
{
|
||||
std::string aOverriddenNiceName = niceName(superclassCXXRecordDecl->getDestructor());
|
||||
overridingSet.insert(aOverriddenNiceName);
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
@ -174,6 +176,8 @@ bool UnnecessaryVirtual::VisitCXXMethodDecl( const CXXMethodDecl* methodDecl )
|
||||
|
||||
void UnnecessaryVirtual::MarkRootOverridesNonEmpty( const CXXMethodDecl* methodDecl )
|
||||
{
|
||||
if (!methodDecl)
|
||||
return;
|
||||
if (methodDecl->size_overridden_methods() == 0) {
|
||||
nonEmptySet.insert(niceName(methodDecl));
|
||||
return;
|
||||
|
@ -117,8 +117,6 @@ std::string niceName(const CXXMethodDecl* cxxMethodDecl)
|
||||
|
||||
bool VirtualDead::VisitCXXMethodDecl(const CXXMethodDecl* methodDecl)
|
||||
{
|
||||
if (ignoreLocation(methodDecl))
|
||||
return true;
|
||||
if (!methodDecl->isVirtual() || methodDecl->isDeleted())
|
||||
return true;
|
||||
if (isa<CXXDestructorDecl>(methodDecl))
|
||||
|
Loading…
x
Reference in New Issue
Block a user