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
|
# REQUIRES: system-darwin
# REQUIRES: swift
# This tests that RemoteAST querying the dynamic type of a variable
# doesn't import any modules into a module SwiftASTContext that
# weren't imported by that module in the source code. Unfortunately
# this test is extremely sensitive to the side effects of the command
# interpreter and the debug info format, which is why it is written as
# a LIT test.
# RUN: rm -rf %t && mkdir %t && cd %t
# RUN: %target-swift-frontend -c -g -serialize-debugging-options \
# RUN: -module-cache-path %t/cache \
# RUN: -primary-file %S/Inputs/Library.swift \
# RUN: -emit-module-path Library.part.swiftmodule \
# RUN: -parse-as-library -module-name Library -o Library.o -I.
# RUN: %target-swift-frontend -serialize-debugging-options \
# RUN: -module-cache-path %t/cache \
# RUN: -merge-modules -emit-module \
# RUN: -parse-as-library \
# RUN: -disable-diagnostic-passes -disable-sil-perf-optzns \
# RUN: -module-name Library Library.part.swiftmodule \
# RUN: -o Library.swiftmodule -I%t
# RUN: %target-swiftc -Xlinker -dylib -o libLibrary.dylib Library.o \
# RUN: -Xlinker -add_ast_path -Xlinker Library.swiftmodule \
# RUN: -Xlinker -install_name -Xlinker @executable_path/libLibrary.dylib
# RUN: %target-swift-frontend -c -g -serialize-debugging-options \
# RUN: -module-cache-path %t/cache \
# RUN: -primary-file %S/Inputs/RemoteASTImport.swift \
# RUN: -module-name RemoteASTImport -o RemoteASTImport.o \
# RUN: -emit-module-path RemoteASTImport.part.swiftmodule \
# RUN: -import-objc-header %S/Inputs/BridgingHeader.h \
# RUN: -I. -Xcc -DSYNTAX_ERROR=1
# RUN: %target-swift-frontend -serialize-debugging-options -merge-modules \
# RUN: -module-cache-path %t/cache \
# RUN: -emit-module RemoteASTImport.part.swiftmodule \
# RUN: -parse-as-library \
# RUN: -disable-diagnostic-passes -disable-sil-perf-optzns \
# RUN: -import-objc-header %S/Inputs/BridgingHeader.h \
# RUN: -I%t -Xcc -DSYNTAX_ERROR=1 \
# RUN: -module-name RemoteASTImport -o RemoteASTImport.swiftmodule
# RUN: %target-swiftc -o %t/a.out RemoteASTImport.o -Xlinker -add_ast_path \
# RUN: -Xlinker RemoteASTImport.swiftmodule -L. -lLibrary
# RUN: %lldb %t/a.out -s %s | FileCheck %s
b Library.swift:10
run
expression input
# FIXME: This test previously only worked because the erro reporting
# wasn't wired up correctly, but actually failed at testing what is
# mentioned in the comment!
#
# swift::Demangle::ASTBuilder::findDeclContext() calls
# ModuleDecl *ASTContext::getModuleByName() which will end up
# importing any missing module by name. Even in a per-module SwiftASTContext!
#
# The {{ }} avoids accidentally matching the input script!
# FIXME-NOT: undeclared identifier {{'SYNTAX_ERROR'}}
# This is the dynamic type of 'input'.
# CHECK: (RemoteASTImport.FromMainModule) ${{R0}}{{.*}}(i = 1)
|