Skip to content

Commit 797a965

Browse files
committed
fixup! add comment; move test to shell test
1 parent 08c1395 commit 797a965

File tree

7 files changed

+49
-44
lines changed

7 files changed

+49
-44
lines changed

lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -379,6 +379,9 @@ static void SetupDeclVendor(ExecutionContext &exe_ctx, Target *target,
379379
if (!err)
380380
return;
381381

382+
// Module load errors aren't fatal to the expression evaluator. Printing
383+
// them as diagnostics to the console would be too noisy and misleading
384+
// Hence just print them to the expression log.
382385
llvm::handleAllErrors(
383386
std::move(err), [](const llvm::StringError &e) {
384387
LLDB_LOG(GetLog(LLDBLog::Expressions), "{0}", e.getMessage());

lldb/test/API/lang/objc/modules-compile-error/Makefile

Lines changed: 0 additions & 5 deletions
This file was deleted.

lldb/test/API/lang/objc/modules-compile-error/TestModulesCompileError.py

Lines changed: 0 additions & 28 deletions
This file was deleted.

lldb/test/API/lang/objc/modules-compile-error/main.m

Lines changed: 0 additions & 5 deletions
This file was deleted.

lldb/test/API/lang/objc/modules-compile-error/module.h

Lines changed: 0 additions & 5 deletions
This file was deleted.

lldb/test/API/lang/objc/modules-compile-error/module.modulemap

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
## Tests the case where module compilation fails.
2+
#
3+
# REQUIRES: system-darwin
4+
#
5+
# RUN: split-file %s %t/sources
6+
# RUN: %clang_host -g %t/sources/main.m -fmodules -fcxx-modules \
7+
# RUN: -DSHOULD_COMPILE=1 \
8+
# RUN: -fmodule-map-file=%t/sources/module.modulemap \
9+
# RUN: -fmodules-cache-path=%t/ModuleCache -o %t.out
10+
#
11+
# RUN: %lldb -x -o "settings set interpreter.stop-command-source-on-error false" \
12+
# RUN: -s %t/sources/commands.input %t.out -o exit 2>&1 | FileCheck %s
13+
14+
#--- main.m
15+
@import foo;
16+
17+
int main() { __builtin_debugtrap(); }
18+
19+
#--- foo.h
20+
struct foo {};
21+
22+
#ifndef SHOULD_COMPILE
23+
#error "Compilation failure."
24+
#endif
25+
26+
#--- module.modulemap
27+
module foo {
28+
header "foo.h"
29+
export *
30+
}
31+
32+
#--- commands.input
33+
log enable lldb expr
34+
run
35+
## Make sure expression fails so the 'note' diagnostics get printed.
36+
expr blah
37+
38+
# CHECK: Finished building Clang module foo
39+
# CHECK: couldn't load top-level module foo:
40+
# CHECK: While building module 'foo' imported from LLDBModulesMemoryBuffer
41+
# CHEKC: {{.*}}sources/foo.h{{.*}}: error: "Compilation failure."
42+
# CHECK: LLDBModulesMemoryBuffer:1:1: fatal error: could not build module 'foo'
43+
44+
# CHECK: Error while loading hand-imported modules:
45+
# CHECK: couldn't load top-level module foo:
46+
# CHECK-NOT: Compilation failure

0 commit comments

Comments
 (0)