diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2022-04-04 15:41:16 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2022-04-04 17:30:52 +0200 |
commit | 88bba21f83ce47a517dabc637fb421ac9bad5416 (patch) | |
tree | b6b193eaa7bc2ade7108805b9d171c7a4cd344c9 /compilerplugins | |
parent | bd992ae1228b2f7e556f89f95949da0aeade5b91 (diff) |
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<locale_t>(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 <sbergman@redhat.com>
Diffstat (limited to 'compilerplugins')
-rw-r--r-- | compilerplugins/clang/check.cxx | 5 |
1 files changed, 4 insertions, 1 deletions
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(); } } |