From a010011fd362536beb8d1cd44cf058180f7c06ec Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Thu, 2 May 2019 20:55:04 +0200 Subject: Fix building compilerplugins with Clang trunk towards Clang 9 ...after "Replace ad-hoc tracking of pattern for an instantiated class-scope" removed ASTContext::getClassScopeSpecializationPattern. None of the affected plugins are enabled by default (nor checked by solenv/CompilerTest_compilerplugins_clang.mk), so just make sure they still compile, leaving any potentially necessary adaptions to another commit. Change-Id: I7102851409e78eff284b50337f7ad0f721e1e548 Reviewed-on: https://gerrit.libreoffice.org/71702 Reviewed-by: Noel Grandin Tested-by: Jenkins Reviewed-by: Stephan Bergmann --- compilerplugins/clang/constantparam.cxx | 4 ++++ compilerplugins/clang/countusersofdefaultparams.cxx | 6 ++++++ compilerplugins/clang/expandablemethods.cxx | 2 ++ compilerplugins/clang/methodcycles.cxx | 2 ++ compilerplugins/clang/unusedmethods.cxx | 2 ++ 5 files changed, 16 insertions(+) (limited to 'compilerplugins') diff --git a/compilerplugins/clang/constantparam.cxx b/compilerplugins/clang/constantparam.cxx index ffacf1102022..7fab25406236 100644 --- a/compilerplugins/clang/constantparam.cxx +++ b/compilerplugins/clang/constantparam.cxx @@ -104,8 +104,10 @@ void ConstantParam::addToCallSet(const FunctionDecl* functionDecl, int paramInde { if (functionDecl->getInstantiatedFromMemberFunction()) functionDecl = functionDecl->getInstantiatedFromMemberFunction(); +#if CLANG_VERSION < 90000 else if (functionDecl->getClassScopeSpecializationPattern()) functionDecl = functionDecl->getClassScopeSpecializationPattern(); +#endif else if (functionDecl->getTemplateInstantiationPattern()) functionDecl = functionDecl->getTemplateInstantiationPattern(); @@ -252,8 +254,10 @@ bool ConstantParam::VisitCallExpr(const CallExpr * callExpr) { // work our way back to the root definition for template methods if (functionDecl->getInstantiatedFromMemberFunction()) functionDecl = functionDecl->getInstantiatedFromMemberFunction(); +#if CLANG_VERSION < 90000 else if (functionDecl->getClassScopeSpecializationPattern()) functionDecl = functionDecl->getClassScopeSpecializationPattern(); +#endif else if (functionDecl->getTemplateInstantiationPattern()) functionDecl = functionDecl->getTemplateInstantiationPattern(); diff --git a/compilerplugins/clang/countusersofdefaultparams.cxx b/compilerplugins/clang/countusersofdefaultparams.cxx index 0f434689a6c2..b469833b27b9 100644 --- a/compilerplugins/clang/countusersofdefaultparams.cxx +++ b/compilerplugins/clang/countusersofdefaultparams.cxx @@ -93,8 +93,10 @@ void CountUsersOfDefaultParams::niceName(const FunctionDecl* functionDecl, MyFun { if (functionDecl->getInstantiatedFromMemberFunction()) functionDecl = functionDecl->getInstantiatedFromMemberFunction(); +#if CLANG_VERSION < 90000 else if (functionDecl->getClassScopeSpecializationPattern()) functionDecl = functionDecl->getClassScopeSpecializationPattern(); +#endif else if (functionDecl->getTemplateInstantiationPattern()) functionDecl = functionDecl->getTemplateInstantiationPattern(); @@ -155,8 +157,10 @@ bool CountUsersOfDefaultParams::VisitCallExpr(const CallExpr * callExpr) { // work our way back to the root definition for template methods if (functionDecl->getInstantiatedFromMemberFunction()) functionDecl = functionDecl->getInstantiatedFromMemberFunction(); +#if CLANG_VERSION < 90000 else if (functionDecl->getClassScopeSpecializationPattern()) functionDecl = functionDecl->getClassScopeSpecializationPattern(); +#endif else if (functionDecl->getTemplateInstantiationPattern()) functionDecl = functionDecl->getTemplateInstantiationPattern(); int n = functionDecl->getNumParams() - 1; @@ -184,8 +188,10 @@ bool CountUsersOfDefaultParams::VisitCXXConstructExpr(const CXXConstructExpr * c // work our way back to the root definition for template methods if (constructorDecl->getInstantiatedFromMemberFunction()) constructorDecl = dyn_cast(constructorDecl->getInstantiatedFromMemberFunction()); +#if CLANG_VERSION < 90000 else if (constructorDecl->getClassScopeSpecializationPattern()) constructorDecl = dyn_cast(constructorDecl->getClassScopeSpecializationPattern()); +#endif else if (constructorDecl->getTemplateInstantiationPattern()) constructorDecl = dyn_cast(constructorDecl->getTemplateInstantiationPattern()); int n = constructorDecl->getNumParams() - 1; diff --git a/compilerplugins/clang/expandablemethods.cxx b/compilerplugins/clang/expandablemethods.cxx index 8277ae838028..e91a3c0ecf4c 100644 --- a/compilerplugins/clang/expandablemethods.cxx +++ b/compilerplugins/clang/expandablemethods.cxx @@ -114,8 +114,10 @@ MyFuncInfo ExpandableMethods::niceName(const FunctionDecl* functionDecl) { if (functionDecl->getInstantiatedFromMemberFunction()) functionDecl = functionDecl->getInstantiatedFromMemberFunction(); +#if CLANG_VERSION < 90000 else if (functionDecl->getClassScopeSpecializationPattern()) functionDecl = functionDecl->getClassScopeSpecializationPattern(); +#endif else if (functionDecl->getTemplateInstantiationPattern()) functionDecl = functionDecl->getTemplateInstantiationPattern(); diff --git a/compilerplugins/clang/methodcycles.cxx b/compilerplugins/clang/methodcycles.cxx index fb1a88b80a94..0a57e5d38a7b 100644 --- a/compilerplugins/clang/methodcycles.cxx +++ b/compilerplugins/clang/methodcycles.cxx @@ -126,8 +126,10 @@ MyFuncInfo MethodCycles::niceName(const FunctionDecl* functionDecl) { if (functionDecl->getInstantiatedFromMemberFunction()) functionDecl = functionDecl->getInstantiatedFromMemberFunction(); +#if CLANG_VERSION < 90000 else if (functionDecl->getClassScopeSpecializationPattern()) functionDecl = functionDecl->getClassScopeSpecializationPattern(); +#endif else if (functionDecl->getTemplateInstantiationPattern()) functionDecl = functionDecl->getTemplateInstantiationPattern(); diff --git a/compilerplugins/clang/unusedmethods.cxx b/compilerplugins/clang/unusedmethods.cxx index 8ca645335c43..e24fec99c3d2 100644 --- a/compilerplugins/clang/unusedmethods.cxx +++ b/compilerplugins/clang/unusedmethods.cxx @@ -132,8 +132,10 @@ MyFuncInfo UnusedMethods::niceName(const FunctionDecl* functionDecl) { if (functionDecl->getInstantiatedFromMemberFunction()) functionDecl = functionDecl->getInstantiatedFromMemberFunction(); +#if CLANG_VERSION < 90000 else if (functionDecl->getClassScopeSpecializationPattern()) functionDecl = functionDecl->getClassScopeSpecializationPattern(); +#endif else if (functionDecl->getTemplateInstantiationPattern()) functionDecl = functionDecl->getTemplateInstantiationPattern(); -- cgit