mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
60 lines
2.4 KiB
Swift
60 lines
2.4 KiB
Swift
// RUN: split-file %s %t
|
|
// RUN: %target-swift-frontend -typecheck -verify -suppress-remarks %t/some/subdir/file1.swift -verify-additional-file %t/Cxx/include/cxx-header.h -I %t/Cxx/include -cxx-interoperability-mode=default -module-name main
|
|
|
|
// This test uses -verify-additional-file, which do not work well on Windows:
|
|
// UNSUPPORTED: OS=windows-msvc
|
|
|
|
//--- Cxx/include/module.modulemap
|
|
module CxxModule {
|
|
requires cplusplus
|
|
header "cxx-header.h"
|
|
}
|
|
|
|
//--- Cxx/include/cxx-header.h
|
|
#ifndef __CXX_HEADER_H
|
|
#define __CXX_HEADER_H
|
|
class __attribute__((__swift_attr__("private_fileid:main/file1.swift"))) OK {
|
|
private:
|
|
void priv(void) const {}
|
|
};
|
|
|
|
class
|
|
__attribute__((__swift_attr__("private_fileid:main/file1.swift"))) // expected-note {{SWIFT_PRIVATE_FILEID annotation found here}}
|
|
__attribute__((__swift_attr__("private_fileid:main/file2.swift"))) // expected-note {{SWIFT_PRIVATE_FILEID annotation found here}}
|
|
MultipleAnnotations {}; // expected-error {{multiple SWIFT_PRIVATE_FILEID annotations were found on 'MultipleAnnotations'}}
|
|
|
|
class
|
|
__attribute__((__swift_attr__("private_fileid:main/file1.swift"))) // expected-note {{SWIFT_PRIVATE_FILEID annotation found here}}
|
|
__attribute__((__swift_attr__("private_fileid:main/file1.swift"))) // expected-note {{SWIFT_PRIVATE_FILEID annotation found here}}
|
|
RepeatedAnnotations {}; // expected-error {{multiple SWIFT_PRIVATE_FILEID annotations were found on 'RepeatedAnnotations'}}
|
|
|
|
class
|
|
__attribute__((__swift_attr__("private_fileid:main/some/subdir/file1.swift")))
|
|
WithSubdir {}; // expected-warning@-1 {{SWIFT_PRIVATE_FILEID annotation on 'WithSubdir' does not have a valid file ID}}
|
|
|
|
class
|
|
__attribute__((__swift_attr__("private_fileid:main/file1")))
|
|
MissingExtension {}; // expected-warning@-1 {{SWIFT_PRIVATE_FILEID annotation on 'MissingExtension' does not have a valid file ID}}
|
|
|
|
class
|
|
__attribute__((__swift_attr__("private_fileid:main/file1.swift")))
|
|
IncompleteType;
|
|
class IncompleteType {};
|
|
|
|
#endif /* CXX_HEADER_H */
|
|
|
|
//--- some/subdir/file1.swift
|
|
import CxxModule
|
|
extension OK { func ext() { priv() } } // should work as expected
|
|
extension MultipleAnnotations {}
|
|
extension RepeatedAnnotations {}
|
|
extension WithSubdir {}
|
|
extension MissingExtension {}
|
|
extension IncompleteType {}
|
|
|
|
//--- some/subdir/file2.swift
|
|
import CxxModule
|
|
|
|
// This file is referenced in the MultipleAnnotations test case.
|
|
// We don't need to create it here but we may as well do so.
|