summaryrefslogtreecommitdiffstats
path: root/compilerplugins/clang/vclwidgets.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'compilerplugins/clang/vclwidgets.cxx')
-rw-r--r--compilerplugins/clang/vclwidgets.cxx30
1 files changed, 16 insertions, 14 deletions
diff --git a/compilerplugins/clang/vclwidgets.cxx b/compilerplugins/clang/vclwidgets.cxx
index 804b4cc26489..422041688a78 100644
--- a/compilerplugins/clang/vclwidgets.cxx
+++ b/compilerplugins/clang/vclwidgets.cxx
@@ -13,6 +13,8 @@
#include "plugin.hxx"
#include "check.hxx"
+#include "compat.hxx"
+#include "config_clang.h"
#include "clang/AST/CXXInheritance.h"
// Final goal: Checker for VCL widget references. Makes sure that VCL Window subclasses are properly referenced counted and dispose()'ed.
@@ -189,7 +191,7 @@ bool VCLWidgets::VisitCXXDestructorDecl(const CXXDestructorDecl* pCXXDestructorD
report(
DiagnosticsEngine::Warning,
BASE_REF_COUNTED_CLASS " subclass with VclPtr field must call disposeOnce() from its destructor",
- compat::getBeginLoc(pCXXDestructorDecl))
+ pCXXDestructorDecl->getBeginLoc())
<< pCXXDestructorDecl->getSourceRange();
return true;
}
@@ -207,7 +209,7 @@ bool VCLWidgets::VisitCXXDestructorDecl(const CXXDestructorDecl* pCXXDestructorD
// assert(true), ...;
//
auto skip = false;
- for (auto loc = compat::getBeginLoc(*i);
+ for (auto loc = (*i)->getBeginLoc();
compiler.getSourceManager().isMacroBodyExpansion(loc);
loc = compiler.getSourceManager().getImmediateMacroCallerLoc(
loc))
@@ -238,7 +240,7 @@ bool VCLWidgets::VisitCXXDestructorDecl(const CXXDestructorDecl* pCXXDestructorD
}
if (!bOk) {
SourceLocation spellingLocation = compiler.getSourceManager().getSpellingLoc(
- compat::getBeginLoc(pCXXDestructorDecl));
+ pCXXDestructorDecl->getBeginLoc());
StringRef filename = getFilenameOfLocation(spellingLocation);
if ( !(loplugin::isSamePathname(filename, SRCDIR "/vcl/source/window/window.cxx"))
&& !(loplugin::isSamePathname(filename, SRCDIR "/vcl/source/gdi/virdev.cxx"))
@@ -248,7 +250,7 @@ bool VCLWidgets::VisitCXXDestructorDecl(const CXXDestructorDecl* pCXXDestructorD
report(
DiagnosticsEngine::Warning,
BASE_REF_COUNTED_CLASS " subclass should have nothing in its destructor but a call to disposeOnce()",
- compat::getBeginLoc(pCXXDestructorDecl))
+ pCXXDestructorDecl->getBeginLoc())
<< pCXXDestructorDecl->getSourceRange();
}
}
@@ -264,7 +266,7 @@ bool VCLWidgets::VisitBinaryOperator(const BinaryOperator * binaryOperator)
return true;
}
SourceLocation spellingLocation = compiler.getSourceManager().getSpellingLoc(
- compat::getBeginLoc(binaryOperator));
+ binaryOperator->getBeginLoc());
checkAssignmentForVclPtrToRawConversion(spellingLocation, binaryOperator->getLHS()->getType().getTypePtr(), binaryOperator->getRHS());
return true;
}
@@ -357,7 +359,7 @@ bool VCLWidgets::VisitVarDecl(const VarDecl * pVarDecl) {
return true;
}
SourceLocation spellingLocation = compiler.getSourceManager().getSpellingLoc(
- compat::getBeginLoc(pVarDecl));
+ pVarDecl->getBeginLoc());
if (pVarDecl->getInit()) {
checkAssignmentForVclPtrToRawConversion(spellingLocation, pVarDecl->getType().getTypePtr(), pVarDecl->getInit());
}
@@ -414,7 +416,7 @@ bool VCLWidgets::VisitFieldDecl(const FieldDecl * fieldDecl) {
return true;
}
StringRef aFileName = getFilenameOfLocation(
- compiler.getSourceManager().getSpellingLoc(compat::getBeginLoc(fieldDecl)));
+ compiler.getSourceManager().getSpellingLoc(fieldDecl->getBeginLoc()));
if (loplugin::isSamePathname(aFileName, SRCDIR "/include/vcl/vclptr.hxx"))
return true;
if (loplugin::isSamePathname(aFileName, SRCDIR "/include/rtl/ref.hxx"))
@@ -601,7 +603,7 @@ bool VCLWidgets::VisitFunctionDecl( const FunctionDecl* functionDecl )
report(
DiagnosticsEngine::Warning,
BASE_REF_COUNTED_CLASS " subclass dispose() function MUST call dispose() of its superclass as the last thing it does",
- compat::getBeginLoc(functionDecl))
+ functionDecl->getBeginLoc())
<< functionDecl->getSourceRange();
}
}
@@ -655,7 +657,7 @@ bool VCLWidgets::VisitFunctionDecl( const FunctionDecl* functionDecl )
report(
DiagnosticsEngine::Warning,
aMessage,
- compat::getBeginLoc(functionDecl))
+ functionDecl->getBeginLoc())
<< functionDecl->getSourceRange();
}
}
@@ -672,14 +674,14 @@ bool VCLWidgets::VisitCXXDeleteExpr(const CXXDeleteExpr *pCXXDeleteExpr)
const CXXRecordDecl *pPointee = pCXXDeleteExpr->getArgument()->getType()->getPointeeCXXRecordDecl();
if (pPointee && isDerivedFromVclReferenceBase(pPointee)) {
SourceLocation spellingLocation = compiler.getSourceManager().getSpellingLoc(
- compat::getBeginLoc(pCXXDeleteExpr));
+ pCXXDeleteExpr->getBeginLoc());
StringRef filename = getFilenameOfLocation(spellingLocation);
if ( !(loplugin::isSamePathname(filename, SRCDIR "/include/vcl/vclreferencebase.hxx")))
{
report(
DiagnosticsEngine::Warning,
"calling delete on instance of " BASE_REF_COUNTED_CLASS " subclass, must rather call disposeAndClear()",
- compat::getBeginLoc(pCXXDeleteExpr))
+ pCXXDeleteExpr->getBeginLoc())
<< pCXXDeleteExpr->getSourceRange();
}
}
@@ -698,7 +700,7 @@ bool VCLWidgets::VisitCXXDeleteExpr(const CXXDeleteExpr *pCXXDeleteExpr)
report(
DiagnosticsEngine::Warning,
"calling delete on instance of VclPtr, must rather call disposeAndClear()",
- compat::getBeginLoc(pCXXDeleteExpr))
+ pCXXDeleteExpr->getBeginLoc())
<< pCXXDeleteExpr->getSourceRange();
return true;
}
@@ -848,14 +850,14 @@ bool VCLWidgets::VisitCXXConstructExpr( const CXXConstructExpr* constructExpr )
if (ignoreLocation(constructExpr)) {
return true;
}
- if (constructExpr->getConstructionKind() != CXXConstructExpr::CK_Complete) {
+ if (constructExpr->getConstructionKind() != compat::CXXConstructionKind::Complete) {
return true;
}
const CXXConstructorDecl* pConstructorDecl = constructExpr->getConstructor();
const CXXRecordDecl* recordDecl = pConstructorDecl->getParent();
if (isDerivedFromVclReferenceBase(recordDecl)) {
StringRef aFileName = getFilenameOfLocation(
- compiler.getSourceManager().getSpellingLoc(compat::getBeginLoc(constructExpr)));
+ compiler.getSourceManager().getSpellingLoc(constructExpr->getBeginLoc()));
if (!loplugin::isSamePathname(aFileName, SRCDIR "/include/vcl/vclptr.hxx")) {
report(
DiagnosticsEngine::Warning,