Skip to content

Commit 25546d2

Browse files
committed
[AST] Remove redundant typedefs
These aren't needed in C++
1 parent 28b7fd7 commit 25546d2

File tree

2 files changed

+40
-40
lines changed

2 files changed

+40
-40
lines changed

include/swift/AST/ASTBridging.h

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -34,17 +34,17 @@ namespace swift {
3434
// Identifier
3535
//===----------------------------------------------------------------------===//
3636

37-
typedef struct BridgedIdentifier {
37+
struct BridgedIdentifier {
3838
const void *_Nullable raw;
39-
} BridgedIdentifier;
39+
};
4040

4141
//===----------------------------------------------------------------------===//
4242
// ASTContext
4343
//===----------------------------------------------------------------------===//
4444

45-
typedef struct BridgedASTContext {
45+
struct BridgedASTContext {
4646
void *_Nonnull raw;
47-
} BridgedASTContext;
47+
};
4848

4949
SWIFT_NAME("BridgedASTContext.getIdentifier(self:_:)")
5050
BridgedIdentifier ASTContext_getIdentifier(BridgedASTContext cContext,
@@ -120,10 +120,10 @@ namespace swift {
120120

121121
// NOTE: This must be the same underlying value as C++ 'swift::DiagID' defined
122122
// in 'DiagnosticList.cpp'.
123-
typedef enum ENUM_EXTENSIBILITY_ATTR(open) BridgedDiagID : uint32_t {
123+
enum ENUM_EXTENSIBILITY_ATTR(open) BridgedDiagID : uint32_t {
124124
#define DIAG(KIND, ID, Options, Text, Signature) BridgedDiagID_##ID,
125125
#include "swift/AST/DiagnosticsAll.def"
126-
} BridgedDiagID;
126+
};
127127

128128
class BridgedDiagnosticArgument {
129129
int64_t storage[3];
@@ -159,17 +159,17 @@ class BridgedDiagnosticFixIt {
159159
};
160160

161161
/// Diagnostic severity when reporting diagnostics.
162-
typedef enum ENUM_EXTENSIBILITY_ATTR(open) BridgedDiagnosticSeverity : size_t {
162+
enum ENUM_EXTENSIBILITY_ATTR(open) BridgedDiagnosticSeverity : size_t {
163163
BridgedFatalError,
164164
BridgedError,
165165
BridgedWarning,
166166
BridgedRemark,
167167
BridgedNote,
168-
} BridgedDiagnosticSeverity;
168+
};
169169

170-
typedef struct BridgedDiagnostic {
170+
struct BridgedDiagnostic {
171171
void *_Nonnull raw;
172-
} BridgedDiagnostic;
172+
};
173173

174174
// FIXME: Can we bridge InFlightDiagnostic?
175175
void DiagnosticEngine_diagnose(BridgedDiagnosticEngine, BridgedSourceLoc loc,
@@ -239,7 +239,7 @@ BridgedStringRef BridgedVarDecl_getUserFacingName(BridgedVarDecl decl);
239239
// Misc
240240
//===----------------------------------------------------------------------===//
241241

242-
typedef struct {
242+
struct BridgedTupleTypeElement {
243243
BridgedIdentifier Name;
244244
BridgedSourceLoc NameLoc;
245245
BridgedIdentifier SecondName;
@@ -248,9 +248,9 @@ typedef struct {
248248
BridgedSourceLoc ColonLoc;
249249
BridgedTypeRepr Type;
250250
BridgedSourceLoc TrailingCommaLoc;
251-
} BridgedTupleTypeElement;
251+
};
252252

253-
typedef enum ENUM_EXTENSIBILITY_ATTR(open) BridgedRequirementReprKind : size_t {
253+
enum ENUM_EXTENSIBILITY_ATTR(open) BridgedRequirementReprKind : size_t {
254254
/// A type bound T : P, where T is a type that depends on a generic
255255
/// parameter and P is some type that should bound T, either as a concrete
256256
/// supertype or a protocol to which T must conform.
@@ -266,39 +266,39 @@ typedef enum ENUM_EXTENSIBILITY_ATTR(open) BridgedRequirementReprKind : size_t {
266266

267267
// Note: there is code that packs this enum in a 2-bit bitfield. Audit users
268268
// when adding enumerators.
269-
} BridgedRequirementReprKind;
269+
};
270270

271-
typedef struct {
271+
struct BridgedRequirementRepr {
272272
BridgedSourceLoc SeparatorLoc;
273273
BridgedRequirementReprKind Kind;
274274
BridgedTypeRepr FirstType;
275275
BridgedTypeRepr SecondType;
276276
// FIXME: Handle Layout Requirements
277-
} BridgedRequirementRepr;
277+
};
278278

279-
typedef enum ENUM_EXTENSIBILITY_ATTR(open) BridgedMacroDefinitionKind : size_t {
279+
enum ENUM_EXTENSIBILITY_ATTR(open) BridgedMacroDefinitionKind : size_t {
280280
/// An expanded macro.
281281
BridgedExpandedMacro = 0,
282282
/// An external macro, spelled with either the old spelling (Module.Type)
283283
/// or the new spelling `#externalMacro(module: "Module", type: "Type")`.
284284
BridgedExternalMacro,
285285
/// The builtin definition for "externalMacro".
286286
BridgedBuiltinExternalMacro
287-
} BridgedMacroDefinitionKind;
287+
};
288288

289289
/// Bridged parameter specifiers
290-
typedef enum ENUM_EXTENSIBILITY_ATTR(open) BridgedAttributedTypeSpecifier : size_t {
290+
enum ENUM_EXTENSIBILITY_ATTR(open) BridgedAttributedTypeSpecifier : size_t {
291291
BridgedAttributedTypeSpecifierInOut,
292292
BridgedAttributedTypeSpecifierBorrowing,
293293
BridgedAttributedTypeSpecifierConsuming,
294294
BridgedAttributedTypeSpecifierLegacyShared,
295295
BridgedAttributedTypeSpecifierLegacyOwned,
296296
BridgedAttributedTypeSpecifierConst,
297297
BridgedAttributedTypeSpecifierIsolated,
298-
} BridgedAttributedTypeSpecifier;
298+
};
299299

300300
// Bridged type attribute kinds, which mirror TypeAttrKind exactly.
301-
typedef enum ENUM_EXTENSIBILITY_ATTR(closed) BridgedTypeAttrKind : size_t {
301+
enum ENUM_EXTENSIBILITY_ATTR(closed) BridgedTypeAttrKind : size_t {
302302
BridgedTypeAttrKind_autoclosure,
303303
BridgedTypeAttrKind_convention,
304304
BridgedTypeAttrKind_noescape,
@@ -351,18 +351,18 @@ typedef enum ENUM_EXTENSIBILITY_ATTR(closed) BridgedTypeAttrKind : size_t {
351351
BridgedTypeAttrKind_thin,
352352
BridgedTypeAttrKind_thick,
353353
BridgedTypeAttrKind_Count
354-
} BridgedTypeAttrKind;
354+
};
355355

356-
typedef enum ENUM_EXTENSIBILITY_ATTR(open) ASTNodeKind : size_t {
356+
enum ENUM_EXTENSIBILITY_ATTR(open) ASTNodeKind : size_t {
357357
ASTNodeKindExpr,
358358
ASTNodeKindStmt,
359359
ASTNodeKindDecl
360-
} ASTNodeKind;
360+
};
361361

362-
typedef struct BridgedASTNode {
362+
struct BridgedASTNode {
363363
void *_Nonnull ptr;
364364
ASTNodeKind kind;
365-
} BridgedASTNode;
365+
};
366366

367367
struct BridgedIdentifierAndSourceLoc {
368368
BridgedIdentifier name;
@@ -628,11 +628,11 @@ BridgedExtensionDecl ExtensionDecl_createParsed(
628628
BridgedNullableTrailingWhereClause genericWhereClause,
629629
BridgedSourceRange cBraceRange);
630630

631-
typedef enum ENUM_EXTENSIBILITY_ATTR(closed) {
631+
enum ENUM_EXTENSIBILITY_ATTR(closed) BridgedOperatorFixity {
632632
BridgedOperatorFixityInfix,
633633
BridgedOperatorFixityPrefix,
634634
BridgedOperatorFixityPostfix,
635-
} BridgedOperatorFixity;
635+
};
636636

637637
SWIFT_NAME("BridgedOperatorDecl.createParsed(_:declContext:fixity:"
638638
"operatorKeywordLoc:name:nameLoc:colonLoc:precedenceGroupName:"
@@ -644,11 +644,11 @@ BridgedOperatorDecl OperatorDecl_createParsed(
644644
BridgedSourceLoc cColonLoc, BridgedIdentifier cPrecedenceGroupName,
645645
BridgedSourceLoc cPrecedenceGroupLoc);
646646

647-
typedef enum ENUM_EXTENSIBILITY_ATTR(closed) {
647+
enum ENUM_EXTENSIBILITY_ATTR(closed) BridgedAssociativity {
648648
BridgedAssociativityNone,
649649
BridgedAssociativityLeft,
650650
BridgedAssociativityRight,
651-
} BridgedAssociativity;
651+
};
652652

653653
SWIFT_NAME("BridgedPrecedenceGroupDecl.createParsed(declContext:"
654654
"precedencegroupKeywordLoc:name:nameLoc:leftBraceLoc:"
@@ -668,7 +668,7 @@ BridgedPrecedenceGroupDecl PrecedenceGroupDecl_createParsed(
668668
BridgedSourceLoc cLowerThanKeywordLoc, BridgedArrayRef cLowerThanNames,
669669
BridgedSourceLoc cRightBraceLoc);
670670

671-
typedef enum ENUM_EXTENSIBILITY_ATTR(open) {
671+
enum ENUM_EXTENSIBILITY_ATTR(open) BridgedImportKind {
672672
BridgedImportKindModule,
673673
BridgedImportKindType,
674674
BridgedImportKindStruct,
@@ -677,7 +677,7 @@ typedef enum ENUM_EXTENSIBILITY_ATTR(open) {
677677
BridgedImportKindProtocol,
678678
BridgedImportKindVar,
679679
BridgedImportKindFunc,
680-
} BridgedImportKind;
680+
};
681681

682682
SWIFT_NAME("BridgedImportDecl.createParsed(_:declContext:importKeywordLoc:"
683683
"importKind:importKindLoc:path:)")

include/swift/Basic/BasicBridging.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -112,22 +112,22 @@ struct BridgedArrayRef {
112112
// Data
113113
//===----------------------------------------------------------------------===//
114114

115-
typedef struct BridgedData {
115+
struct BridgedData {
116116
const char *_Nullable baseAddress;
117117
size_t size;
118-
} BridgedData;
118+
};
119119

120120
void BridgedData_free(BridgedData data);
121121

122122
//===----------------------------------------------------------------------===//
123123
// Feature
124124
//===----------------------------------------------------------------------===//
125125

126-
typedef enum ENUM_EXTENSIBILITY_ATTR(open) BridgedFeature {
126+
enum ENUM_EXTENSIBILITY_ATTR(open) BridgedFeature {
127127
#define LANGUAGE_FEATURE(FeatureName, SENumber, Description, Option) \
128128
FeatureName,
129129
#include "swift/Basic/Features.def"
130-
} BridgedFeature;
130+
};
131131

132132
//===----------------------------------------------------------------------===//
133133
// OStream
@@ -231,15 +231,15 @@ BRIDGED_INLINE bool BridgedSourceLoc_isValid(BridgedSourceLoc str);
231231
// SourceRange
232232
//===----------------------------------------------------------------------===//
233233

234-
typedef struct {
234+
struct BridgedSourceRange {
235235
BridgedSourceLoc startLoc;
236236
BridgedSourceLoc endLoc;
237-
} BridgedSourceRange;
237+
};
238238

239-
typedef struct {
239+
struct BridgedCharSourceRange {
240240
void *_Nonnull start;
241241
size_t byteLength;
242-
} BridgedCharSourceRange;
242+
};
243243

244244
//===----------------------------------------------------------------------===//
245245
// Plugins

0 commit comments

Comments
 (0)