summaryrefslogtreecommitdiff
path: root/compilerplugins
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2015-04-28 22:36:48 +0200
committerStephan Bergmann <sbergman@redhat.com>2015-04-28 22:40:06 +0200
commitcd41fa43089d0977cbf62071c9bfe2322de5d012 (patch)
treecfa625b06d4794b6744f4e2f1d0f558c107d17c8 /compilerplugins
parentb3acc2944862ff9def6c19c2687a6209a4a191bb (diff)
Work around FieldDecl::getParent raising assertion
...when inside an ObjCInterfaceDecl, cf. thread starting at <http://lists.cs.uiuc.edu/pipermail/cfe-dev/2015-April/042629.html> "FieldDecl::getParent() not working in Objective C code?" Change-Id: Ifa9b4925979123c6b6fee1b46a1f57803207d3c8
Diffstat (limited to 'compilerplugins')
-rw-r--r--compilerplugins/clang/vclwidgets.cxx2
1 files changed, 1 insertions, 1 deletions
diff --git a/compilerplugins/clang/vclwidgets.cxx b/compilerplugins/clang/vclwidgets.cxx
index e12e9572b385..f984dcb2ec7b 100644
--- a/compilerplugins/clang/vclwidgets.cxx
+++ b/compilerplugins/clang/vclwidgets.cxx
@@ -265,7 +265,7 @@ bool VCLWidgets::VisitFieldDecl(const FieldDecl * fieldDecl) {
if (fieldDecl->isBitField()) {
return true;
}
- const CXXRecordDecl *pParentRecordDecl = dyn_cast<CXXRecordDecl>(fieldDecl->getParent());
+ const CXXRecordDecl *pParentRecordDecl = isa<RecordDecl>(fieldDecl->getDeclContext()) ? dyn_cast<CXXRecordDecl>(fieldDecl->getParent()) : nullptr;
if (containsWindowSubclass(fieldDecl->getType())) {
// have to ignore this for now, nasty reverse dependency from tools->vcl
if (!(pParentRecordDecl != nullptr && pParentRecordDecl->getQualifiedNameAsString() == "ErrorContextImpl")) {