xref: /llvm-project/lldb/test/API/functionalities/tail_call_frames/ambiguous_tail_call_seq1/main.cpp (revision fdea9a4ec9b0d9585b8fe8a612686d9f44f40ddc)
1 volatile int x;
2 
sink()3 void __attribute__((noinline)) sink() {
4   x++; //% self.filecheck("bt", "main.cpp")
5   // CHECK-NOT: func{{[23]}}_amb
6 }
7 
func3_amb()8 void __attribute__((noinline)) func3_amb() { sink(); /* tail */ }
9 
func2_amb()10 void __attribute__((noinline)) func2_amb() { sink(); /* tail */ }
11 
func1()12 void __attribute__((noinline)) func1() {
13   if (x > 0)
14     func2_amb(); /* tail */
15   else
16     func3_amb(); /* tail */
17 }
18 
main(int argc,char **)19 int __attribute__((disable_tail_calls)) main(int argc, char **) {
20   // The sequences `main -> func1 -> f{2,3}_amb -> sink` are both plausible. Test
21   // that lldb doesn't attempt to guess which one occurred.
22   func1();
23   return 0;
24 }
25