workaround ErrorContextImpl in vclwidget clang plugin

Change-Id: I6c0265f33a88169708d0812639169b665a95fc1f
This commit is contained in:
Noel Grandin
2015-04-17 09:59:18 +02:00
parent 5cc560f6c2
commit e0686cb756

View File

@@ -265,13 +265,17 @@ bool VCLWidgets::VisitFieldDecl(const FieldDecl * fieldDecl) {
if (fieldDecl->isBitField()) { if (fieldDecl->isBitField()) {
return true; return true;
} }
const CXXRecordDecl *pParentRecordDecl = dyn_cast<CXXRecordDecl>(fieldDecl->getParent());
if (containsWindowSubclass(fieldDecl->getType())) { if (containsWindowSubclass(fieldDecl->getType())) {
report( // have to ignore this for now, nasty reverse dependency from tools->vcl
DiagnosticsEngine::Warning, if (!(pParentRecordDecl != nullptr && pParentRecordDecl->getQualifiedNameAsString() == "ErrorContextImpl")) {
"OutputDevice subclass declared as a pointer field, should be wrapped in VclPtr." + fieldDecl->getType().getAsString(), report(
fieldDecl->getLocation()) DiagnosticsEngine::Warning,
<< fieldDecl->getSourceRange(); "OutputDevice subclass declared as a pointer field, should be wrapped in VclPtr." + fieldDecl->getType().getAsString(),
return true; fieldDecl->getLocation())
<< fieldDecl->getSourceRange();
return true;
}
} }
const RecordType *recordType = fieldDecl->getType()->getAs<RecordType>(); const RecordType *recordType = fieldDecl->getType()->getAs<RecordType>();
if (recordType == nullptr) { 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 // 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) if (pParentRecordDecl && isDerivedFromWindow(pParentRecordDecl)
&& startsWith(recordDecl->getQualifiedNameAsString(), "VclPtr")) && startsWith(recordDecl->getQualifiedNameAsString(), "VclPtr"))
{ {