|
| 1 | +# RUN: split-file %s %t |
| 2 | +# RUN: %clang_host -g %t/main.cpp -o %t.out |
| 3 | +# |
| 4 | +# RUN: %lldb -x -b -o "settings set interpreter.stop-command-source-on-error false" \ |
| 5 | +# RUN: -s %t/no-target.input 2>&1 | FileCheck %s --check-prefix=CHECK-NO-TARGET |
| 6 | +# |
| 7 | +# RUN: %lldb %t.out -x -b -o "settings set interpreter.stop-command-source-on-error false" \ |
| 8 | +# RUN: -s %t/with-target.input 2>&1 | FileCheck %s --check-prefix=CHECK-TARGET |
| 9 | + |
| 10 | +#--- main.cpp |
| 11 | + |
| 12 | +int main() { |
| 13 | + int x = 10; |
| 14 | + __builtin_debugtrap(); |
| 15 | +} |
| 16 | + |
| 17 | +#--- with-target.input |
| 18 | + |
| 19 | +expr blah |
| 20 | + |
| 21 | +# CHECK-TARGET: (lldb) expr |
| 22 | +# CHECK-TARGET: note: Falling back to default language. Ran expression as 'Objective C++'. |
| 23 | + |
| 24 | +run |
| 25 | + |
| 26 | +expr blah |
| 27 | + |
| 28 | +# CHECK-TARGET: (lldb) expr |
| 29 | +# CHECK-TARGET: note: Ran expression as 'C++14'. |
| 30 | + |
| 31 | +expr -l objc -- blah |
| 32 | + |
| 33 | +# CHECK-TARGET: (lldb) expr |
| 34 | +# CHECK-TARGET: note: Expression evaluation in pure Objective-C not supported. Ran expression as 'Objective C++'. |
| 35 | + |
| 36 | +expr -l c -- blah |
| 37 | + |
| 38 | +# CHECK-TARGET: (lldb) expr |
| 39 | +# CHECK-TARGET: note: Expression evaluation in pure C not supported. Ran expression as 'ISO C++'. |
| 40 | + |
| 41 | +expr -l c++14 -- blah |
| 42 | + |
| 43 | +# CHECK-TARGET: (lldb) expr |
| 44 | +# CHECK-TARGET: note: Ran expression as 'C++14' |
| 45 | + |
| 46 | +expr -l c++20 -- blah |
| 47 | + |
| 48 | +# CHECK-TARGET: (lldb) expr |
| 49 | +# CHECK-TARGET: note: Ran expression as 'C++20' |
| 50 | + |
| 51 | +expr -l objective-c++ -- blah |
| 52 | + |
| 53 | +# CHECK-TARGET: (lldb) expr |
| 54 | +# CHECK-TARGET: note: Ran expression as 'Objective C++' |
| 55 | + |
| 56 | +# D uses TypeSystemClang but running expressions in it isn't supported. Test that we warn about this. |
| 57 | +expr -l D -- blah |
| 58 | + |
| 59 | +# CHECK-TARGET: (lldb) expr |
| 60 | +# CHECK-TARGET: note: Expression evaluation in D not supported. Falling back to default language. Ran expression as 'Objective C++'. |
| 61 | + |
| 62 | +expr -l c++17 -- x = 5 |
| 63 | + |
| 64 | +# CHECK-TARGET: (lldb) expr |
| 65 | +# CHECK-TARGET-NOT: note: |
| 66 | + |
| 67 | +#--- no-target.input |
| 68 | + |
| 69 | +expr blah |
| 70 | + |
| 71 | +# CHECK-NO-TARGET: (lldb) expr |
| 72 | +# CHECK-NO-TARGET: note: Falling back to default language. Ran expression as 'Objective C++'. |
| 73 | + |
| 74 | +expr -l c++ -- 1 + 1 |
| 75 | + |
| 76 | +# CHECK-NO-TARGET: (lldb) expr |
| 77 | +# CHECK-NO-TARGET-NOT: note: |
0 commit comments