Files
swift-mirror/test/PrintAsObjC/interfering-macros.swift
Jordan Rose 01add3aec1 [PrintAsObjC] Defend against macros named 'any' (#12396)
SourceKit uses a clever pragma to automatically attach an attribute to
every declaration in the file. However, the form of this pragma (clang
attribute push) uses a parenthesized list marked with 'any', which turns
out to be a name that people sometimes use for macros. Guard against this
using the push_macro pragma (originally from MSVC), under the assumption
that anyone who supports the highly-use-specific 'external_source_symbol'
attribute probably implements this more common extension. This does make
the generated header a little uglier, but it's not like it was really
pretty to begin with.

rdar://problem/34168022
2017-10-12 13:39:07 -07:00

20 lines
1.0 KiB
Swift

// RUN: %empty-directory(%t)
// FIXME: BEGIN -enable-source-import hackaround
// RUN: %target-swift-frontend(mock-sdk: -sdk %S/../Inputs/clang-importer-sdk -I %t) -emit-module -o %t %S/../Inputs/clang-importer-sdk/swift-modules/ObjectiveC.swift
// RUN: %target-swift-frontend(mock-sdk: -sdk %S/../Inputs/clang-importer-sdk -I %t) -emit-module -o %t %S/../Inputs/clang-importer-sdk/swift-modules/CoreGraphics.swift
// RUN: %target-swift-frontend(mock-sdk: -sdk %S/../Inputs/clang-importer-sdk -I %t) -emit-module -o %t %S/../Inputs/clang-importer-sdk/swift-modules/Foundation.swift
// FIXME: END -enable-source-import hackaround
// RUN: %target-swift-frontend(mock-sdk: -sdk %S/../Inputs/clang-importer-sdk -I %t) %s -typecheck -emit-objc-header-path %t/interfering-macros.h
// RUN: %check-in-clang -fsyntax-only -Werror %t/interfering-macros.h -D'any=UNWANTED_MACRO_SUBSTITUTION'
// REQUIRES: objc_interop
import Foundation
@objc public class Test : NSObject {
public var str: String = ""
public var strongProp: Any?
}