https://github.com/aviralg updated https://github.com/llvm/llvm-project/pull/195756
>From 9a537fd998a7f9802c24537dcb0d4b4585d4022c Mon Sep 17 00:00:00 2001 From: Aviral Goel <[email protected]> Date: Mon, 4 May 2026 15:51:53 -0700 Subject: [PATCH] Add accessor for LUNamespace --- .../Core/EntityLinker/LUSummary.h | 2 ++ .../CMakeLists.txt | 1 + .../LUSummaryTest.cpp | 25 +++++++++++++++++++ 3 files changed, 28 insertions(+) create mode 100644 clang/unittests/ScalableStaticAnalysisFramework/LUSummaryTest.cpp diff --git a/clang/include/clang/ScalableStaticAnalysisFramework/Core/EntityLinker/LUSummary.h b/clang/include/clang/ScalableStaticAnalysisFramework/Core/EntityLinker/LUSummary.h index a36002006430c..372f689a00f4e 100644 --- a/clang/include/clang/ScalableStaticAnalysisFramework/Core/EntityLinker/LUSummary.h +++ b/clang/include/clang/ScalableStaticAnalysisFramework/Core/EntityLinker/LUSummary.h @@ -48,6 +48,8 @@ class LUSummary { public: explicit LUSummary(NestedBuildNamespace LUNamespace) : LUNamespace(std::move(LUNamespace)) {} + + const NestedBuildNamespace &getNamespace() const { return LUNamespace; } }; } // namespace clang::ssaf diff --git a/clang/unittests/ScalableStaticAnalysisFramework/CMakeLists.txt b/clang/unittests/ScalableStaticAnalysisFramework/CMakeLists.txt index 5ae0a5de35e21..dc027fa580151 100644 --- a/clang/unittests/ScalableStaticAnalysisFramework/CMakeLists.txt +++ b/clang/unittests/ScalableStaticAnalysisFramework/CMakeLists.txt @@ -8,6 +8,7 @@ add_distinct_clang_unittest(ClangScalableAnalysisTests EntityLinkageTest.cpp EntityLinkerTest.cpp EntityNameTest.cpp + LUSummaryTest.cpp ErrorBuilderTest.cpp Frontend/TUSummaryExtractorFrontendActionTest.cpp ModelStringConversionsTest.cpp diff --git a/clang/unittests/ScalableStaticAnalysisFramework/LUSummaryTest.cpp b/clang/unittests/ScalableStaticAnalysisFramework/LUSummaryTest.cpp new file mode 100644 index 0000000000000..db29eaa8a5919 --- /dev/null +++ b/clang/unittests/ScalableStaticAnalysisFramework/LUSummaryTest.cpp @@ -0,0 +1,25 @@ +//===- LUSummaryTest.cpp -------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#include "clang/ScalableStaticAnalysisFramework/Core/EntityLinker/LUSummary.h" +#include "clang/ScalableStaticAnalysisFramework/Core/Model/BuildNamespace.h" +#include "gtest/gtest.h" + +namespace clang::ssaf { +namespace { + +TEST(LUSummaryTest, GetNamespace) { + BuildNamespace LU(BuildNamespaceKind::LinkUnit, "app"); + NestedBuildNamespace NS(LU); + LUSummary Summary(NS); + + EXPECT_EQ(Summary.getNamespace(), NS); +} + +} // namespace +} // namespace clang::ssaf _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
