summaryrefslogtreecommitdiff
path: root/compilerplugins
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2016-11-22 10:36:24 +0200
committerAshod Nakashian <ashod.nakashian@collabora.co.uk>2017-11-28 00:12:44 -0500
commit330dc55f4923bb88c3e7dbc75a2c935477b92928 (patch)
treebec5c2736476553872112d6fa05f505514dbb584 /compilerplugins
parenta0417abfb7a468310587132e84fe1ea3a2e955bd (diff)
loplugin field-can-be-private in include/vcl..xmlscript
Change-Id: Ia03f7cccb256d825daa4dc6f4c0598448e46e6cf Reviewed-on: https://gerrit.libreoffice.org/31069 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> (cherry picked from commit 29a9e97db65bcf5914aed9bf8cb8e8f38c3c5fc0)
Diffstat (limited to 'compilerplugins')
-rw-r--r--compilerplugins/clang/unusedfields.cxx13
1 files changed, 12 insertions, 1 deletions
diff --git a/compilerplugins/clang/unusedfields.cxx b/compilerplugins/clang/unusedfields.cxx
index 1bf71cdea13b..94a1cb6300d9 100644
--- a/compilerplugins/clang/unusedfields.cxx
+++ b/compilerplugins/clang/unusedfields.cxx
@@ -106,7 +106,18 @@ private:
MyFieldInfo UnusedFields::niceName(const FieldDecl* fieldDecl)
{
MyFieldInfo aInfo;
- aInfo.parentClass = fieldDecl->getParent()->getQualifiedNameAsString();
+
+ const RecordDecl* recordDecl = fieldDecl->getParent();
+
+ if (const CXXRecordDecl* cxxRecordDecl = dyn_cast<CXXRecordDecl>(recordDecl))
+ {
+ if (cxxRecordDecl->getTemplateInstantiationPattern())
+ cxxRecordDecl = cxxRecordDecl->getTemplateInstantiationPattern();
+ aInfo.parentClass = cxxRecordDecl->getQualifiedNameAsString();
+ }
+ else
+ aInfo.parentClass = recordDecl->getQualifiedNameAsString();
+
aInfo.fieldName = fieldDecl->getNameAsString();
aInfo.fieldType = fieldDecl->getType().getAsString();