File tree Expand file tree Collapse file tree 2 files changed +27
-3
lines changed Expand file tree Collapse file tree 2 files changed +27
-3
lines changed Original file line number Diff line number Diff line change @@ -55,6 +55,15 @@ class IsFeatureCheck : public ASTWalker {
55
55
foundFeature = true ;
56
56
}
57
57
58
+ if (auto call = dyn_cast<CallExpr>(expr)) {
59
+ if (auto unresolved = dyn_cast<UnresolvedDeclRefExpr>(call->getFn ())) {
60
+ StringRef userFacing = unresolved->getName ().getBaseName ()
61
+ .userFacingName ();
62
+ if (userFacing == " compiler" || userFacing == " _compiler_version" )
63
+ foundFeature = true ;
64
+ }
65
+ }
66
+
58
67
return { !foundFeature, expr };
59
68
}
60
69
};
@@ -128,10 +137,9 @@ struct ExtractInactiveRanges : public ASTWalker {
128
137
return false ;
129
138
}
130
139
131
- // If the clause is checking for a particular feature with $, keep
132
- // the whole thing.
140
+ // If the clause is checking for a particular feature with $ or a compiler
141
+ // version, keep the whole thing.
133
142
if (anyClauseIsFeatureCheck (icd->getClauses ())) {
134
- addRange (start, end);
135
143
return false ;
136
144
}
137
145
Original file line number Diff line number Diff line change @@ -109,3 +109,19 @@ public func hasClosureDefaultArgWithSinglePoundIf(_ x: () -> Void = {
109
109
#endif
110
110
} ) {
111
111
}
112
+
113
+ // CHECK: func hasIfCompilerCheck
114
+ // CHECK: #if compiler(>=5.3)
115
+ // CHECK-NEXT: return true
116
+ // CHECK-NEXT: #else
117
+ // CHECK-NEXT: return false
118
+ // CHECK-NEXT: #endif
119
+ @_alwaysEmitIntoClient
120
+ public func hasIfCompilerCheck( _ x: ( ) -> Bool = {
121
+ #if compiler(>=5.3)
122
+ return true
123
+ #else
124
+ return false
125
+ #endif
126
+ } ) {
127
+ }
You can’t perform that action at this time.
0 commit comments