Files
swift-mirror/test/IRGen/linker_options_objc.swift
Arnold Schwaighofer 15ff698409 IRGen: Give ClangCodeGen a chance to emit its translation unit's global state
We need this because that global state includes tables like llvm[.compiler].used
which would otherwise be sorely missed.

This fixes an issue of the clang importer that would cause us to fail whenever
we imported a function (say it is marked as static inline) that performs an
objective-c method call and we optimize the code. The optimizer would not see
the objective-c selector global variable (which is marked private) as being
"used by unkown i.e the objc runtime" and would rightly assume it could
propagate the value of the global variable's initializer value as a constant to
loads of the global variable.

Now we call the ClangCodeGenerators translation unit finalization code which
will emit these tables and other module flags. We need to take care that we
merge those datastrutures with datastructures that we emit from swift's IRGen.

rdar://21115194

Swift SVN r29176
2015-05-31 00:01:29 +00:00

16 lines
511 B
Swift

// RUN: rm -rf %t
// RUN: mkdir %t
// RUN: %target-swiftc_driver -emit-module -o %t -module-name Empty -module-link-name swiftEmpty %S/../Inputs/empty.swift
// RUN: %target-swiftc_driver %s -I %t -emit-ir | FileCheck %s
// REQUIRES: objc_interop
import Empty
// Check that libobjc is always autolinked together with libswiftCore on
// platforms that support Objective-C.
// CHECK: !{{.*}} = !{i32 6, !"Linker Options", !{{.*}}}
// CHECK-DAG: !{{.*}} = !{!"-lswiftCore"}
// CHECK-DAG: !{{.*}} = !{!"-lobjc"}