From 2e0bb9676d70c9df21743623c4b2022da217c2f2 Mon Sep 17 00:00:00 2001 From: David Grove Date: Thu, 28 Jul 2016 17:51:40 -0400 Subject: [PATCH] ClangImporter: enable -fblocks on non-Darwin platforms We need to enable blocks support in the ClangImporter on non-Darwin platforms for libdispatch (and transitively foundation). The simplest way to do this is to just enable blocks unconditionally. Also enable two Linux tests that are no longer XFAILS --- lib/ClangImporter/ClangImporter.cpp | 5 ++++- test/ClangModules/cfuncs_parse.swift | 2 -- test/ClangModules/cstring_parse.swift | 2 -- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/lib/ClangImporter/ClangImporter.cpp b/lib/ClangImporter/ClangImporter.cpp index bc187858d0f28..4b5f9014e9a57 100644 --- a/lib/ClangImporter/ClangImporter.cpp +++ b/lib/ClangImporter/ClangImporter.cpp @@ -332,6 +332,9 @@ getNormalInvocationArguments(std::vector &invocationArgStrs, // Don't emit LLVM IR. "-fsyntax-only", + // enable block support + "-fblocks", + "-fretain-comments-from-system-headers", SHIMS_INCLUDE_FLAG, searchPathOpts.RuntimeResourcePath, @@ -341,7 +344,7 @@ getNormalInvocationArguments(std::vector &invocationArgStrs, if (triple.isOSDarwin()) { invocationArgStrs.insert(invocationArgStrs.end(), { // Darwin uses Objective-C ARC. - "-x", "objective-c", "-std=gnu11", "-fobjc-arc", "-fblocks", + "-x", "objective-c", "-std=gnu11", "-fobjc-arc", // Define macros that Swift bridging headers use. "-DSWIFT_CLASS_EXTRA=__attribute__((annotate(\"" diff --git a/test/ClangModules/cfuncs_parse.swift b/test/ClangModules/cfuncs_parse.swift index 9ada150b81482..1075c1990b879 100644 --- a/test/ClangModules/cfuncs_parse.swift +++ b/test/ClangModules/cfuncs_parse.swift @@ -1,7 +1,5 @@ // RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -parse -verify -I %S/Inputs %s -// XFAIL: linux - import cfuncs func test_cfunc1(_ i: Int) { diff --git a/test/ClangModules/cstring_parse.swift b/test/ClangModules/cstring_parse.swift index 912d8a65c71c8..5c6bdf0159fb1 100644 --- a/test/ClangModules/cstring_parse.swift +++ b/test/ClangModules/cstring_parse.swift @@ -5,8 +5,6 @@ // RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -parse -verify -module-cache-path %t/clang-module-cache -I %S/Inputs %s // RUN: ls -lR %t/clang-module-cache | %FileCheck %s -// XFAIL: linux - // CHECK: cfuncs{{.*}}.pcm import cfuncs