[Libreoffice-commits] core.git: Branch 'feature/vclptr' - compilerplugins/clang

Noel Grandin noel at peralex.com
Fri Apr 17 01:29:08 PDT 2015


 compilerplugins/clang/vclwidgets.cxx |   17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)

New commits:
commit e0686cb7564eb2eeab62ac35a2a36da8f83ed90a
Author: Noel Grandin <noel at peralex.com>
Date:   Fri Apr 17 09:59:18 2015 +0200

    workaround ErrorContextImpl in vclwidget clang plugin
    
    Change-Id: I6c0265f33a88169708d0812639169b665a95fc1f

diff --git a/compilerplugins/clang/vclwidgets.cxx b/compilerplugins/clang/vclwidgets.cxx
index 2c171d0..e12e957 100644
--- a/compilerplugins/clang/vclwidgets.cxx
+++ b/compilerplugins/clang/vclwidgets.cxx
@@ -265,13 +265,17 @@ bool VCLWidgets::VisitFieldDecl(const FieldDecl * fieldDecl) {
     if (fieldDecl->isBitField()) {
         return true;
     }
+    const CXXRecordDecl *pParentRecordDecl = dyn_cast<CXXRecordDecl>(fieldDecl->getParent());
     if (containsWindowSubclass(fieldDecl->getType())) {
-        report(
-            DiagnosticsEngine::Warning,
-            "OutputDevice subclass declared as a pointer field, should be wrapped in VclPtr." + fieldDecl->getType().getAsString(),
-            fieldDecl->getLocation())
-          << fieldDecl->getSourceRange();
-        return true;
+        // have to ignore this for now, nasty reverse dependency from tools->vcl
+        if (!(pParentRecordDecl != nullptr && pParentRecordDecl->getQualifiedNameAsString() == "ErrorContextImpl")) {
+            report(
+                DiagnosticsEngine::Warning,
+                "OutputDevice subclass declared as a pointer field, should be wrapped in VclPtr." + fieldDecl->getType().getAsString(),
+                fieldDecl->getLocation())
+              << fieldDecl->getSourceRange();
+            return true;
+       }
     }
     const RecordType *recordType = fieldDecl->getType()->getAs<RecordType>();
     if (recordType == nullptr) {
@@ -292,7 +296,6 @@ bool VCLWidgets::VisitFieldDecl(const FieldDecl * fieldDecl) {
     }
 
     // If this field is a VclPtr field, then the class MUST have a dispose method
-    const CXXRecordDecl *pParentRecordDecl = dyn_cast<CXXRecordDecl>(fieldDecl->getParent());
     if (pParentRecordDecl && isDerivedFromWindow(pParentRecordDecl)
         && startsWith(recordDecl->getQualifiedNameAsString(), "VclPtr"))
     {


More information about the Libreoffice-commits mailing list