Files
TheRock/compiler/amd-llvm/lldb/test/API/commands/expression/inline-namespace/TestInlineNamespace.py
T
derek.holloway 7502bf64a4
CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
Flatten subprojects into a single base monorepo
2026-09-02 16:34:47 -07:00

81 lines
3.0 KiB
Python

"""
Test that we correctly handle inline namespaces.
"""
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
@skipIfWasm # no expression evaluation
class TestInlineNamespace(TestBase):
def test(self):
self.build()
lldbutil.run_to_source_breakpoint(
self, "// Set break point at this line.", lldb.SBFileSpec("main.cpp")
)
# The 'A::B::f' function must be found via 'A::f' as 'B' is an inline
# namespace.
self.expect_expr("A::f()", result_type="int", result_value="3")
# But we should still find the function when we pretend the inline
# namespace is not inline.
self.expect_expr("A::B::f()", result_type="int", result_value="3")
self.expect_expr("A::B::global_var", result_type="int", result_value="0")
# FIXME: should be ambiguous lookup but ClangExpressionDeclMap takes
# first global variable that the lookup found, which in this case
# is A::B::global_var
self.expect_expr("A::global_var", result_type="int", result_value="0")
self.expect_expr("A::B::C::global_var", result_type="int", result_value="1")
self.expect_expr("A::C::global_var", result_type="int", result_value="1")
self.expect_expr("A::B::D::nested_var", result_type="int", result_value="2")
self.expect_expr("A::D::nested_var", result_type="int", result_value="2")
self.expect_expr("A::B::nested_var", result_type="int", result_value="2")
self.expect_expr("A::nested_var", result_type="int", result_value="2")
self.expect_expr("A::E::F::other_var", result_type="int", result_value="3")
self.expect_expr("A::E::other_var", result_type="int", result_value="3")
self.expect(
"expr A::E::global_var",
error=True,
substrs=["no member named 'global_var' in namespace 'A::E'"],
)
self.expect(
"expr A::E::F::global_var",
error=True,
substrs=["no member named 'global_var' in namespace 'A::E::F'"],
)
self.expect(
"expr A::other_var",
error=True,
substrs=["no member named 'other_var' in namespace 'A'"],
)
self.expect(
"expr A::B::other_var",
error=True,
substrs=["no member named 'other_var' in namespace 'A::B'"],
)
self.expect(
"expr B::other_var",
error=True,
substrs=["no member named 'other_var' in namespace 'A::B'"],
)
# 'frame variable' can correctly distinguish between A::B::global_var and A::global_var
gvars = self.target().FindGlobalVariables("A::global_var", 10)
self.assertEqual(len(gvars), 1)
self.assertEqual(gvars[0].GetValueAsSigned(), 4)
self.expect("frame variable A::global_var", substrs=["(int) A::global_var = 4"])
self.expect(
"frame variable A::B::global_var", substrs=["(int) A::B::global_var = 0"]
)