blob: 6d8e665102b178566d943cbec72cf3f82c983ca1 [file] [log] [blame] [edit]
## Tests the case where the modulemap is semantically invalid and thus
## Clang fails to load it on behalf of LLDB. We force this error by
## creating a redefinition of 'module bar'.
#
# 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 foo/module bar/' %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;
@import bar;
int main() { __builtin_debugtrap(); }
#--- foo.h
struct foo {};
#--- bar.h
struct bar {};
#--- module.modulemap
module foo {
header "foo.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: failed to parse and load
# NO_LOG-NOT: failed to parse and load
#--- commands-with-log.input
log enable lldb expr
run
## Make sure expression fails so the 'note' diagnostics get printed.
expr blah
# LOG: failed to parse and load modulemap file in {{.*}}sources
# LOG: failed to parse and load modulemap file in {{.*}}sources