summaryrefslogtreecommitdiff
path: root/compilerplugins
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2022-04-05 11:53:16 +0200
committerStephan Bergmann <sbergman@redhat.com>2022-04-05 14:40:07 +0200
commit19d623d54503327e47f6effa3507342ddbea3d73 (patch)
tree7e82831e32b843852ad7e70dbdc3bf933bae7102 /compilerplugins
parentaf2741223e21128e95cb7df1ac0f5942b35b3365 (diff)
Simplify GlobalNamespace check
Change-Id: Id70abc5d1ccdc41dc771fe77ad0e7584efe76826 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132569 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'compilerplugins')
-rw-r--r--compilerplugins/clang/check.cxx5
1 files changed, 1 insertions, 4 deletions
diff --git a/compilerplugins/clang/check.cxx b/compilerplugins/clang/check.cxx
index 9952e285b2b5..93fd7c7f7307 100644
--- a/compilerplugins/clang/check.cxx
+++ b/compilerplugins/clang/check.cxx
@@ -191,10 +191,7 @@ namespace {
bool isGlobalNamespace(clang::DeclContext const * context) {
assert(context != nullptr);
- while (!context->isLookupContext()) {
- context = context->getLookupParent();
- }
- return context->isTranslationUnit();
+ return context->getEnclosingNamespaceContext()->isTranslationUnit();
}
}