Skip to content

Commit f131fec

Browse files
committed
[NFC] Bridging: Rework include caveats
1 parent b803861 commit f131fec

File tree

12 files changed

+52
-44
lines changed

12 files changed

+52
-44
lines changed

include/swift/AST/ASTBridging.h

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,10 @@
1313
#ifndef SWIFT_AST_ASTBRIDGING_H
1414
#define SWIFT_AST_ASTBRIDGING_H
1515

16-
// Do not add other C++/llvm/swift header files here!
17-
// Function implementations should be placed into ASTBridging.cpp and required header files should be added there.
18-
//
19-
// Pure bridging mode does not permit including any C++/llvm/swift headers.
20-
// See also the comments for `BRIDGING_MODE` in the top-level CMakeLists.txt file.
21-
//
22-
16+
/// `ASTBridging.h` is imported into Swift. Be *very* careful with what you
17+
/// include here and keep these includes minimal!
18+
///
19+
/// See include guidelines and caveats in `BasicBridging.h`.
2320
#include "swift/AST/AccessorKind.h"
2421
#include "swift/AST/AttrKind.h"
2522
#include "swift/AST/DiagnosticKind.h"

include/swift/AST/AccessorKind.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,10 @@
1313
#ifndef SWIFT_AST_ACCESSOR_KIND_H
1414
#define SWIFT_AST_ACCESSOR_KIND_H
1515

16-
/// This header is included in a bridging header. Be *very* careful with what
17-
/// you include here! See include caveats in `ASTBridging.h`.
16+
/// `AccessorKind.h` is imported into Swift. Be *very* careful with what you
17+
/// include here and keep these includes minimal!
18+
///
19+
/// See include guidelines and caveats in `BasicBridging.h`.
1820
#include "swift/Basic/SwiftBridging.h"
1921

2022
namespace swift {

include/swift/AST/AttrKind.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,10 @@
1717
#ifndef SWIFT_ATTRKIND_H
1818
#define SWIFT_ATTRKIND_H
1919

20-
/// This header is included in a bridging header. Be *very* careful with what
21-
/// you include here! See include caveats in `ASTBridging.h`.
20+
/// `AttrKind.h` is imported into Swift. Be *very* careful with what you
21+
/// include here and keep these includes minimal!
22+
///
23+
/// See include guidelines and caveats in `BasicBridging.h`.
2224
#include "swift/Basic/SwiftBridging.h"
2325
#include <stdint.h>
2426

include/swift/AST/DiagnosticKind.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,10 @@
1313
#ifndef SWIFT_AST_DIAGNOSTIC_KIND_H
1414
#define SWIFT_AST_DIAGNOSTIC_KIND_H
1515

16-
/// This header is included in a bridging header. Be *very* careful with what
17-
/// you include here! See include caveats in `ASTBridging.h`.
16+
/// `DiagnosticKind.h` is imported into Swift. Be *very* careful with what you
17+
/// include here and keep these includes minimal!
18+
///
19+
/// See include guidelines and caveats in `BasicBridging.h`.
1820
#include "swift/Basic/SwiftBridging.h"
1921
#include <stdint.h>
2022

include/swift/AST/DiagnosticList.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,10 @@
1717
#ifndef SWIFT_DIAGNOSTICLIST_H
1818
#define SWIFT_DIAGNOSTICLIST_H
1919

20-
/// Be *very* careful with what you include here! See include caveats in
21-
/// `ASTBridging.h`.
20+
/// `DiagnosticList.h` is imported into Swift. Be *very* careful with what you
21+
/// include here and keep these includes minimal!
22+
///
23+
/// See include guidelines and caveats in `BasicBridging.h`.
2224
#include "swift/Basic/SwiftBridging.h"
2325
#include <stdint.h>
2426

include/swift/AST/GenericTypeParamKind.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,10 @@
1717
#ifndef SWIFT_AST_GENERICTYPEPARAMKIND_H
1818
#define SWIFT_AST_GENERICTYPEPARAMKIND_H
1919

20-
/// This header is included in a bridging header. Be *very* careful with what
21-
/// you include here! See include caveats in `ASTBridging.h`.
20+
/// `GenericTypeParamKind.h` is imported into Swift. Be *very* careful with
21+
/// what you include here and keep these includes minimal!
22+
///
23+
/// See include caveats in `BasicBridging.h`.
2224
#include "swift/Basic/SwiftBridging.h"
2325
#include <stdint.h>
2426

include/swift/AST/LayoutConstraintKind.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,10 @@
1313
#ifndef SWIFT_LAYOUT_CONSTRAINTKIND_H
1414
#define SWIFT_LAYOUT_CONSTRAINTKIND_H
1515

16-
/// This header is included in a bridging header. Be *very* careful with what
17-
/// you include here! See include caveats in `ASTBridging.h`.
16+
/// `LayoutConstraintKind.h` is imported into Swift. Be *very* careful with
17+
/// what you include here and keep these includes minimal!
18+
///
19+
/// See include caveats in `BasicBridging.h`.
1820
#include "swift/Basic/SwiftBridging.h"
1921
#include <stdint.h>
2022

include/swift/AST/PlatformKind.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,10 @@
1717
#ifndef SWIFT_AST_PLATFORM_KIND_H
1818
#define SWIFT_AST_PLATFORM_KIND_H
1919

20-
/// This header is included in a bridging header. Be *very* careful with what
21-
/// you include here! See include caveats in `ASTBridging.h`.
20+
/// `PlatformKind.h` is imported into Swift. Be *very* careful with what you
21+
/// include here and keep these includes minimal!
22+
///
23+
/// See include guidelines and caveats in `BasicBridging.h`.
2224
#include "swift/Basic/SwiftBridging.h"
2325
#include <stdint.h>
2426

include/swift/Basic/BasicBridging.h

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,13 @@
1313
#ifndef SWIFT_BASIC_BASICBRIDGING_H
1414
#define SWIFT_BASIC_BASICBRIDGING_H
1515

16-
// Do not add other C++/llvm/swift header files here!
17-
// Function implementations should be placed into BasicBridging.cpp and required header files should be added there.
16+
// Do not add other std/llvm header files here!
17+
// Function implementations should be placed into BasicBridging.cpp and
18+
// required header files should be added there.
1819
//
19-
// Pure bridging mode does not permit including any C++/llvm/swift headers.
20-
// See also the comments for `BRIDGING_MODE` in the top-level CMakeLists.txt file.
20+
// Pure bridging mode does not permit including any std/llvm headers.
21+
// See also the comments for `BRIDGING_MODE` in the top-level CMakeLists.txt
22+
// file.
2123
//
2224
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
2325
// !! Do not put any constructors inside an !!

include/swift/Basic/SwiftBridging.h

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,11 @@
1111
//===----------------------------------------------------------------------===//
1212
///
1313
/// This is a wrapper around `<swift/bridging>` that redefines `SWIFT_NAME` to
14-
/// accept a string literal, and some other macros in case the header is
15-
/// unavailable (e.g. during bootstrapping). String literals enable us to
16-
/// properly format the long Swift declaration names that many of our bridging
17-
/// functions have.
14+
/// accept a string literal, and some other helpful macros, including fallbacks
15+
/// for when `<swift/bridging>` is unavailable (e.g. during bootstrapping).
16+
///
17+
/// String literals enable us to properly format the long Swift declaration
18+
/// names specified via `SWIFT_NAME` that many of our bridging functions have.
1819
///
1920
//===----------------------------------------------------------------------===//
2021

0 commit comments

Comments
 (0)