From 88bba21f83ce47a517dabc637fb421ac9bad5416 Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Mon, 4 Apr 2022 15:41:16 +0200 Subject: Fix GlobalNamespace check ...so that e.g. building on F36 with -stdlib=libc++ doesn't fail with > i18nutil/source/utility/paper.cxx:311:75: error: NullToPointer ValueDependentIsNotNull ZeroLiteral -> nullptr [loplugin:nullptr] > locale_t loc = newlocale(LC_PAPER_MASK, "", static_cast(0)); > ^ when the locale_t typedef declaration is nested in extern "C" (from /usr/include/stdlib.h) which in turn is nested in extern "C++" (from LLVM's include/c++/v1/math.h) Change-Id: Ie81d7425cda231954bdbab47c3a0431dc7c27f5f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132520 Tested-by: Jenkins Reviewed-by: Stephan Bergmann --- compilerplugins/clang/check.cxx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'compilerplugins') diff --git a/compilerplugins/clang/check.cxx b/compilerplugins/clang/check.cxx index 003224a21ba1..9952e285b2b5 100644 --- a/compilerplugins/clang/check.cxx +++ b/compilerplugins/clang/check.cxx @@ -191,7 +191,10 @@ namespace { bool isGlobalNamespace(clang::DeclContext const * context) { assert(context != nullptr); - return (context->isLookupContext() ? context : context->getLookupParent())->isTranslationUnit(); + while (!context->isLookupContext()) { + context = context->getLookupParent(); + } + return context->isTranslationUnit(); } } -- cgit