summaryrefslogtreecommitdiff
path: root/compilerplugins/clang/vclwidgets.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'compilerplugins/clang/vclwidgets.cxx')
-rw-r--r--compilerplugins/clang/vclwidgets.cxx33
1 files changed, 19 insertions, 14 deletions
diff --git a/compilerplugins/clang/vclwidgets.cxx b/compilerplugins/clang/vclwidgets.cxx
index a09f8dbbd73d..22d722cd7417 100644
--- a/compilerplugins/clang/vclwidgets.cxx
+++ b/compilerplugins/clang/vclwidgets.cxx
@@ -228,23 +228,10 @@ bool VCLWidgets::VisitVarDecl(const VarDecl * pVarDecl) {
if (ignoreLocation(pVarDecl)) {
return true;
}
- const RecordType *recordType = pVarDecl->getType()->getAs<RecordType>();
- if (recordType == nullptr) {
- return true;
- }
- const CXXRecordDecl *recordDecl = dyn_cast<CXXRecordDecl>(recordType->getDecl());
- if (recordDecl == nullptr) {
+ if ( isa<ParmVarDecl>(pVarDecl) || pVarDecl->isLocalVarDecl() ) {
return true;
}
- // check if this field is derived from Window
- if (isDerivedFromWindow(recordDecl)) {
- report(
- DiagnosticsEngine::Warning,
- "OutputDevice subclass allocated on stack, should be allocated via VclPtr or via *.",
- pVarDecl->getLocation())
- << pVarDecl->getSourceRange();
- }
if ( !startsWith(pVarDecl->getType().getAsString(), "std::vector<vcl::Window *>")
&& !startsWith(pVarDecl->getType().getAsString(), "std::map<vcl::Window *, Size>")
&& !startsWith(pVarDecl->getType().getAsString(), "std::map<vcl::Window *, class Size>")
@@ -270,6 +257,24 @@ bool VCLWidgets::VisitVarDecl(const VarDecl * pVarDecl) {
"OutputDevice subclass should be wrapped in VclPtr. " + pVarDecl->getType().getAsString(),
pVarDecl->getLocation())
<< pVarDecl->getSourceRange();
+ return true;
+ }
+
+ const RecordType *recordType = pVarDecl->getType()->getAs<RecordType>();
+ if (recordType == nullptr) {
+ return true;
+ }
+ const CXXRecordDecl *recordDecl = dyn_cast<CXXRecordDecl>(recordType->getDecl());
+ if (recordDecl == nullptr) {
+ return true;
+ }
+ // check if this field is derived from Window
+ if (isDerivedFromWindow(recordDecl)) {
+ report(
+ DiagnosticsEngine::Warning,
+ "OutputDevice subclass allocated on stack, should be allocated via VclPtr or via *.",
+ pVarDecl->getLocation())
+ << pVarDecl->getSourceRange();
}
return true;
}