summaryrefslogtreecommitdiff
path: root/compilerplugins
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2022-04-04 15:41:16 +0200
committerStephan Bergmann <sbergman@redhat.com>2022-04-04 17:30:52 +0200
commit88bba21f83ce47a517dabc637fb421ac9bad5416 (patch)
treeb6b193eaa7bc2ade7108805b9d171c7a4cd344c9 /compilerplugins
parentbd992ae1228b2f7e556f89f95949da0aeade5b91 (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.cxx5
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();
}
}