Skip to content

Commit 3bcc072

Browse files
Changing diagnose from error to warning, updating message and tests
1 parent 0d8da23 commit 3bcc072

File tree

3 files changed

+27
-17
lines changed

3 files changed

+27
-17
lines changed

include/swift/AST/DiagnosticsDriver.def

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,9 @@ ERROR(error_sdk_too_old,none,
114114
ERROR(error_ios_maximum_deployment_32,none,
115115
"iOS %0 does not support 32-bit programs", (unsigned))
116116

117-
ERROR(error_arclite_not_found_when_link_objc_runtime,none,
118-
"unable to find the 'arclite' library", ())
117+
WARNING(warn_arclite_not_found_when_link_objc_runtime,none,
118+
"Unable to find Objective-C runtime support library 'arclite'. "
119+
"consider '-no-link-objc-runtime' flag", ())
119120

120121
ERROR(error_two_files_same_name,none,
121122
"filename \"%0\" used twice: '%1' and '%2'",

lib/Driver/DarwinToolChains.cpp

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -336,16 +336,18 @@ toolchains::Darwin::constructInvocation(const DynamicLinkJobAction &job,
336336
llvm::SmallString<128> ARCLiteLib;
337337
findARCLiteLibPath(*this, ARCLiteLib);
338338

339-
llvm::sys::path::append(ARCLiteLib, "libarclite_");
340-
ARCLiteLib += getPlatformNameForTriple(Triple);
341-
ARCLiteLib += ".a";
342-
343-
Arguments.push_back("-force_load");
344-
Arguments.push_back(context.Args.MakeArgString(ARCLiteLib));
345-
346-
// Arclite depends on CoreFoundation.
347-
Arguments.push_back("-framework");
348-
Arguments.push_back("CoreFoundation");
339+
if (!ARCLiteLib.empty()) {
340+
llvm::sys::path::append(ARCLiteLib, "libarclite_");
341+
ARCLiteLib += getPlatformNameForTriple(Triple);
342+
ARCLiteLib += ".a";
343+
344+
Arguments.push_back("-force_load");
345+
Arguments.push_back(context.Args.MakeArgString(ARCLiteLib));
346+
347+
// Arclite depends on CoreFoundation.
348+
Arguments.push_back("-framework");
349+
Arguments.push_back("CoreFoundation");
350+
}
349351
}
350352

351353
for (const Arg *arg :
@@ -599,7 +601,7 @@ static void validateLinkObjcRuntimeARCLiteLib(const toolchains::Darwin &TC,
599601

600602
if (ARCLiteLib.empty()) {
601603
diags.diagnose(SourceLoc(),
602-
diag::error_arclite_not_found_when_link_objc_runtime);
604+
diag::warn_arclite_not_found_when_link_objc_runtime);
603605
}
604606
}
605607
}

test/Driver/options-interpreter.swift

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,10 @@
2727
// RUN: %swift_driver -### -target x86_64-apple-macosx10.9 -L/foo/ -L/bar/ %s | %FileCheck -check-prefix=CHECK-L2 %s
2828
// CHECK-L2: # DYLD_LIBRARY_PATH={{/foo/:/bar/:[^:]+/lib/swift/macosx$}}
2929

30-
// RUN: not env DYLD_LIBRARY_PATH=/abc/ SDKROOT=/sdkroot %swift_driver_plain -### -target x86_64-apple-macosx10.9 -L/foo/ -L/bar/ %s 2>&1 | %FileCheck -check-prefix=CHECK-L2-ENV %s
31-
// CHECK-L2-ENV: error: unable to find the 'arclite' library
30+
// RUN: env DYLD_LIBRARY_PATH=/abc/ SDKROOT=/sdkroot %swift_driver_plain -### -target x86_64-apple-macosx10.9 -L/foo/ -L/bar/ %s 2>&1 | %FileCheck -check-prefix=CHECK-L2-ENV %s
31+
// CHECK-L2-ENV: warning: Unable to find Objective-C runtime support library 'arclite'. consider '-no-link-objc-runtime' flag
32+
// CHECK-L2-ENV: # DYLD_LIBRARY_PATH={{/foo/:/bar/:[^:]+/lib/swift/macosx:/sdkroot/usr/lib/swift:/abc/$}}
33+
3234
// RUN: %swift_driver -### -target x86_64-apple-macosx10.9 %s | %FileCheck -check-prefix=CHECK-NO-FRAMEWORKS %s
3335
// RUN: env DYLD_FRAMEWORK_PATH=/abc/ %swift_driver_plain -### -target x86_64-apple-macosx10.9 %s | %FileCheck -check-prefix=CHECK-NO-FRAMEWORKS %s
3436
// CHECK-NO-FRAMEWORKS-NOT: DYLD_FRAMEWORK_PATH
@@ -50,8 +52,13 @@
5052
// CHECK-F2-ENV: #
5153
// CHECK-F2-ENV: DYLD_FRAMEWORK_PATH=/foo/:/bar/:/abc/{{$}}
5254

53-
// RUN: not env DYLD_FRAMEWORK_PATH=/abc/ SDKROOT=/sdkroot %swift_driver_plain -### -target x86_64-apple-macosx10.9 -F/foo/ -F/bar/ -L/foo2/ -L/bar2/ %s 2>&1 | %FileCheck -check-prefix=CHECK-COMPLEX %s
54-
// CHECK-COMPLEX: error: unable to find the 'arclite' library
55+
// RUN: env DYLD_FRAMEWORK_PATH=/abc/ SDKROOT=/sdkroot %swift_driver_plain -### -target x86_64-apple-macosx10.9 -F/foo/ -F/bar/ -L/foo2/ -L/bar2/ %s 2>&1 | %FileCheck -check-prefix=CHECK-COMPLEX %s
56+
// CHECK-COMPLEX: warning: Unable to find Objective-C runtime support library 'arclite'. consider '-no-link-objc-runtime' flag
57+
// CHECK-COMPLEX: -F /foo/
58+
// CHECK-COMPLEX: -F /bar/
59+
// CHECK-COMPLEX: #
60+
// CHECK-COMPLEX-DAG: DYLD_FRAMEWORK_PATH=/foo/:/bar/:/abc/{{$| }}
61+
// CHECK-COMPLEX-DAG: DYLD_LIBRARY_PATH={{/foo2/:/bar2/:[^:]+/lib/swift/macosx:/sdkroot/usr/lib/swift($| )}}
5562

5663
// RUN: %swift_driver -### -target x86_64-unknown-linux-gnu -L/foo/ %s | %FileCheck -check-prefix=CHECK-L-LINUX${LD_LIBRARY_PATH+_LAX} %s
5764
// CHECK-L-LINUX: # LD_LIBRARY_PATH={{/foo/:[^:]+/lib/swift/linux$}}

0 commit comments

Comments
 (0)