summaryrefslogtreecommitdiff
path: root/compilerplugins/clang/unreffun.cxx
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2019-07-17 15:06:43 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2019-07-17 19:32:43 +0200
commitdd969ad6e006adb4a9585c0d1b3378f29bbe5787 (patch)
treea4f479f3f7170205c075e5ce6837949b41acc604 /compilerplugins/clang/unreffun.cxx
parent7598810d6372bac07e503728ee28c4600a1c9b5d (diff)
make some plugins used the shared framework
Change-Id: Ie283a4774564f25e0fde8ca35212f92be786d671 Reviewed-on: https://gerrit.libreoffice.org/75785 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'compilerplugins/clang/unreffun.cxx')
-rw-r--r--compilerplugins/clang/unreffun.cxx23
1 files changed, 1 insertions, 22 deletions
diff --git a/compilerplugins/clang/unreffun.cxx b/compilerplugins/clang/unreffun.cxx
index 3321037c8580..ab0e01b70ecb 100644
--- a/compilerplugins/clang/unreffun.cxx
+++ b/compilerplugins/clang/unreffun.cxx
@@ -20,27 +20,6 @@
namespace {
-// It appears that, given a function declaration, there is no way to determine
-// the language linkage of the function's type, only of the function's name
-// (via FunctionDecl::isExternC); however, in a case like
-//
-// extern "C" { static void f(); }
-//
-// the function's name does not have C language linkage while the function's
-// type does (as clarified in C++11 [decl.link]); cf. <http://clang-developers.
-// 42468.n3.nabble.com/Language-linkage-of-function-type-tt4037248.html>
-// "Language linkage of function type":
-bool hasCLanguageLinkageType(FunctionDecl const * decl) {
- assert(decl != nullptr);
- if (decl->isExternC()) {
- return true;
- }
- if (decl->isInExternCContext()) {
- return true;
- }
- return false;
-}
-
bool isFriendDecl(Decl const * decl) {
return decl->getFriendObjectKind() != Decl::FOK_None;
}
@@ -173,7 +152,7 @@ bool UnrefFun::VisitFunctionDecl(FunctionDecl const * decl) {
}
LinkageInfo info(canon->getLinkageAndVisibility());
if (info.getLinkage() == ExternalLinkage
- && hasCLanguageLinkageType(canon) && canon->isDefined()
+ && loplugin::hasCLanguageLinkageType(canon) && canon->isDefined()
&& ((decl == canon && info.getVisibility() == DefaultVisibility)
|| ((canon->hasAttr<ConstructorAttr>()
|| canon->hasAttr<DestructorAttr>())