@@ -612,7 +612,15 @@ public class ClangCompilerSpec : CompilerSpec, SpecIdentifierType, GCCCompatible
612
612
var commandLine = Array < String > ( )
613
613
614
614
// Add the arguments from the specification.
615
- commandLine += self . commandLineFromOptions ( producer, scope: scope, inputFileType: inputFileType, optionContext: optionContext) . map ( \. asString)
615
+ commandLine += self . commandLineFromOptions ( producer, scope: scope, inputFileType: inputFileType, optionContext: optionContext, lookup: { declaration in
616
+ if declaration. name == " CLANG_INDEX_STORE_ENABLE " && optionContext is DiscoveredClangToolSpecInfo {
617
+ let clangToolInfo = optionContext as! DiscoveredClangToolSpecInfo
618
+ if !clangToolInfo. isAppleClang {
619
+ return BuiltinMacros . namespace. parseString ( " NO " )
620
+ }
621
+ }
622
+ return nil
623
+ } ) . map ( \. asString)
616
624
617
625
// Add the common header search paths.
618
626
let headerSearchPaths = GCCCompatibleCompilerSpecSupport . headerSearchPathArguments ( producer, scope, usesModules: scope. evaluate ( BuiltinMacros . CLANG_ENABLE_MODULES) )
@@ -653,19 +661,6 @@ public class ClangCompilerSpec : CompilerSpec, SpecIdentifierType, GCCCompatible
653
661
let sparseSDKSearchPaths = GCCCompatibleCompilerSpecSupport . sparseSDKSearchPathArguments ( producer. sparseSDKs, headerSearchPaths. headerSearchPaths, frameworkSearchPaths. frameworkSearchPaths)
654
662
commandLine += sparseSDKSearchPaths. searchPathArguments ( for: self , scope: scope)
655
663
656
- if let clangInfo = optionContext as? DiscoveredClangToolSpecInfo , !clangInfo. isAppleClang {
657
- var filteredCommandLine : [ String ] = [ ]
658
- var iterator = commandLine. makeIterator ( )
659
- while let arg = iterator. next ( ) {
660
- if arg == " -index-store-path " {
661
- _ = iterator. next ( )
662
- } else {
663
- filteredCommandLine. append ( arg)
664
- }
665
- }
666
- commandLine = filteredCommandLine
667
- }
668
-
669
664
if scope. evaluate ( BuiltinMacros . CLANG_USE_RESPONSE_FILE) && ( optionContext? . toolPath. basenameWithoutSuffix == " clang " || optionContext? . toolPath. basenameWithoutSuffix == " clang++ " ) {
670
665
var responseFileCommandLine : [ String ] = [ ]
671
666
var regularCommandLine : [ String ] = [ ]
0 commit comments