From 19d623d54503327e47f6effa3507342ddbea3d73 Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Tue, 5 Apr 2022 11:53:16 +0200 Subject: Simplify GlobalNamespace check Change-Id: Id70abc5d1ccdc41dc771fe77ad0e7584efe76826 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132569 Tested-by: Jenkins Reviewed-by: Stephan Bergmann --- compilerplugins/clang/check.cxx | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'compilerplugins') 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(); } } -- cgit