Skip to content

Commit 9427487

Browse files
committed
[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
1 parent 0f28d48 commit 9427487

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

lldb/test/API/functionalities/unused-inlined-parameters/TestUnusedInlinedParameters.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,3 @@ def test_unused_inlined_parameters(self):
1717
self.assertIn("(void *) unused1 = <no location, value may have been optimized out>",
1818
lldbutil.get_description(self.frame().FindVariable("unused1")))
1919
self.assertEqual(42, self.frame().FindVariable("used").GetValueAsUnsigned())
20-
self.assertIn("(int) unused2 = <no location, value may have been optimized out>",
21-
lldbutil.get_description(self.frame().FindVariable("unused2")))

lldb/test/API/functionalities/unused-inlined-parameters/main.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,12 @@
22

33
__attribute__((optnone)) __attribute__((nodebug)) void use(int used) {}
44

5-
__attribute__((always_inline)) void f(void *unused1, int used, int unused2) {
5+
__attribute__((always_inline)) void f(void *unused1, int used) {
66
use(used); // break here
77
}
88

99
int main(int argc, char **argv) {
10-
f(argv, 42, 1);
10+
char *undefined;
11+
f(undefined, 42);
1112
return 0;
12-
}
13+
}

0 commit comments

Comments
 (0)