aboutsummaryrefslogtreecommitdiff
path: root/lldb/test/Shell/Expr/TestClangModuleLoadError_CompileFailure.test
blob: 49ee2778ea18ba5a80347932ebd44ba601f6073f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
## Tests the case where module compilation fails.
#
# REQUIRES: system-darwin
#
# RUN: split-file %s %t/sources
# RUN: %clang_host -g %t/sources/main.m -fmodules -fcxx-modules \
# RUN:             -DSHOULD_COMPILE=1 \
# RUN:             -fmodule-map-file=%t/sources/module.modulemap \
# RUN:             -fmodules-cache-path=%t/ModuleCache -o %t.out
#
# RUN: %lldb -x -o "settings set interpreter.stop-command-source-on-error false" \
# RUN:       -s %t/sources/commands.input %t.out -o exit 2>&1 | FileCheck %s

#--- main.m
@import foo;

int main() { __builtin_debugtrap(); }

#--- foo.h
struct foo {};

#ifndef SHOULD_COMPILE
#error "Compilation failure."
#endif

#--- module.modulemap
module foo {
    header "foo.h"
    export *
}

#--- commands.input
log enable lldb expr
run
## Make sure expression fails so the 'note' diagnostics get printed.
expr blah

# CHECK: Finished building Clang module foo
# CHECK: couldn't load top-level module foo:
# CHECK: While building module 'foo' imported from LLDBModulesMemoryBuffer
# CHEKC: {{.*}}sources/foo.h{{.*}}: error: "Compilation failure."
# CHECK: LLDBModulesMemoryBuffer:1:1: fatal error: could not build module 'foo'

# CHECK: Error while loading hand-imported modules:
# CHECK: couldn't load top-level module foo:
# CHECK-NOT: Compilation failure