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 {
5555 foundFeature = true ;
5656 }
5757
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+
5867 return { !foundFeature, expr };
5968 }
6069};
@@ -128,10 +137,9 @@ struct ExtractInactiveRanges : public ASTWalker {
128137 return false ;
129138 }
130139
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.
133142 if (anyClauseIsFeatureCheck (icd->getClauses ())) {
134- addRange (start, end);
135143 return false ;
136144 }
137145
Original file line number Diff line number Diff line change @@ -109,3 +109,19 @@ public func hasClosureDefaultArgWithSinglePoundIf(_ x: () -> Void = {
109109 #endif
110110} ) {
111111}
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