@@ -1028,6 +1028,10 @@ static ValueDecl *getFenceOperation(ASTContext &ctx, Identifier id) {
10281028 return getBuiltinFunction (ctx, id, _thin, _parameters (), _void);
10291029}
10301030
1031+ static ValueDecl *getIfdefOperation (ASTContext &ctx, Identifier id) {
1032+ return getBuiltinFunction (ctx, id, _thin, _parameters (), _int (1 ));
1033+ }
1034+
10311035static ValueDecl *getVoidErrorOperation (ASTContext &ctx, Identifier id) {
10321036 return getBuiltinFunction (ctx, id, _thin, _parameters (_error), _void);
10331037}
@@ -2280,6 +2284,14 @@ ValueDecl *swift::getBuiltinValueDecl(ASTContext &Context, Identifier Id) {
22802284 if (getSwiftFunctionTypeForIntrinsic (ID, Types, Context, ArgElts, ResultTy))
22812285 return getBuiltinFunction (Id, ArgElts, ResultTy);
22822286 }
2287+
2288+ // If this starts with fence, we have special suffixes to handle.
2289+ if (OperationName.startswith (" ifdef_" )) {
2290+ OperationName = OperationName.drop_front (strlen (" ifdef_" ));
2291+ if (!Types.empty ()) return nullptr ;
2292+ if (OperationName.empty ()) return nullptr ;
2293+ return getIfdefOperation (Context, Id);
2294+ }
22832295
22842296 // If this starts with fence, we have special suffixes to handle.
22852297 if (OperationName.startswith (" fence_" )) {
@@ -2469,6 +2481,7 @@ ValueDecl *swift::getBuiltinValueDecl(ASTContext &Context, Identifier Id) {
24692481
24702482 switch (BV) {
24712483 case BuiltinValueKind::Fence:
2484+ case BuiltinValueKind::Ifdef:
24722485 case BuiltinValueKind::CmpXChg:
24732486 case BuiltinValueKind::AtomicRMW:
24742487 case BuiltinValueKind::AtomicLoad:
0 commit comments