diff --git a/lld/MachO/Driver.cpp b/lld/MachO/Driver.cpp index 879fd25eb1b2..23f9f1f1459d 100644 --- a/lld/MachO/Driver.cpp +++ b/lld/MachO/Driver.cpp @@ -408,7 +408,8 @@ static void addFramework(StringRef name, bool isNeeded, bool isWeak, config->hasReexports = true; dylibFile->reexport = true; } - } else if (isa(file) || isa(file)) { + } else if (isa_and_nonnull(file) || + isa_and_nonnull(file)) { // Cache frameworks containing object or bitcode files to avoid duplicate // symbols. Frameworks containing static archives are cached separately // in addFile() to share caching with libraries, and frameworks diff --git a/lld/test/MachO/invalid/invalid-stub.s b/lld/test/MachO/invalid/invalid-stub.s index 546c91a53798..997594918cd5 100644 --- a/lld/test/MachO/invalid/invalid-stub.s +++ b/lld/test/MachO/invalid/invalid-stub.s @@ -1,11 +1,14 @@ # REQUIRES: x86 -# RUN: mkdir -p %t +# RUN: mkdir -p %t/invalidYAML.framework # RUN: echo "--- !tapi-tbd-v3" > %t/libinvalidYAML.tbd # RUN: echo "invalid YAML" >> %t/libinvalidYAML.tbd +# RUN: cp %t/libinvalidYAML.tbd %t/invalidYAML.framework/invalidYAML.tbd # RUN: llvm-mc -filetype obj -triple x86_64-apple-darwin %s -o %t/test.o # RUN: not %lld -L%t -linvalidYAML %t/test.o -o %t/test 2>&1 | FileCheck %s -DDIR=%t +# RUN: not %lld -F%t -framework invalidYAML %t/test.o -o %t/test 2>&1 | FileCheck %s -DDIR=%t --check-prefix=CHECK-FRAMEWORK # CHECK: could not load TAPI file at [[DIR]]{{[\\/]}}libinvalidYAML.tbd: malformed file +# CHECK-FRAMEWORK: could not load TAPI file at [[DIR]]{{[\\/]}}invalidYAML.framework{{[\\/]}}invalidYAML.tbd: malformed file .globl _main _main: