aboutsummaryrefslogtreecommitdiff
path: root/lldb/test/Shell/Expr/TestClangModuleLoadError_InvalidNestedSubmodule.test
blob: 1e8075dd20fad42c4d57a4a76f6e8cd8c115797a (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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
## Tests the case where we fail to load a submodule of a submodule. We force this
## by removing the submodule 'module qux' of 'module baz' from the modulemap.
#
# REQUIRES: system-darwin
#
# RUN: split-file %s %t/sources
# RUN: %clang_host -g %t/sources/main.m -fmodules -fcxx-modules \
# RUN:             -fmodule-map-file=%t/sources/module.modulemap \
# RUN:             -fmodules-cache-path=%t/ModuleCache -o %t.out
# RUN: sed -i '' -e 's/module qux/module quz/' %t/sources/module.modulemap
#
# 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 --check-prefix=NO_LOG
#
# RUN: %lldb -x -o "settings set interpreter.stop-command-source-on-error false" \
# RUN:       -s %t/sources/commands-with-log.input %t.out -o exit 2>&1 | FileCheck %s --check-prefix=LOG

#--- main.m
@import foo.baz.qux;
@import bar;

int main() { __builtin_debugtrap(); }

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

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

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

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

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

    module baz {
        header "baz.h"
        export *

        module qux {
            header "qux.h"
            export *
        }
    }
}

module bar {
    header "bar.h"
    export *
}

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

# NO_LOG-NOT: couldn't load submodule 'qux' of module 'foo.baz'

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

# LOG: couldn't load submodule 'qux' of module 'foo.baz'