Files
clang-p2996/lldb/test/API/functionalities/unused-inlined-parameters/TestUnusedInlinedParameters.py
Michael Buch 9427487fdb [lldb][Test] Prevent generating DW_AT_location for unused argument
This test simply checks whether we can print an optimized
function argument. With recent changes to Clang the assumption
that we don't generate a `DW_AT_location` attribute for the
unused funciton parameter breaks.

This patch tries harder to get Clang to drop the location
from DWARF by making it generate an `undef` for `unused1`.
Drop the check for `unused2` since it adds no benefit.

Differential Revision: https://reviews.llvm.org/D132635
2022-08-25 08:49:13 +01:00

20 lines
677 B
Python

"""
Test that unused inlined parameters are displayed.
"""
import lldb
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
class TestUnusedInlinedParameters(TestBase):
def test_unused_inlined_parameters(self):
self.build()
lldbutil.run_to_source_breakpoint(self, "// break here", lldb.SBFileSpec("main.c"))
# For the unused parameters, only check the types.
self.assertIn("(void *) unused1 = <no location, value may have been optimized out>",
lldbutil.get_description(self.frame().FindVariable("unused1")))
self.assertEqual(42, self.frame().FindVariable("used").GetValueAsUnsigned())