         // This feature is not widely available in OSS clang. So, we only enable
         // index store for Apple's clang or if explicitly asked to.
         if ProcessEnv.vars.keys.contains("SWIFTPM_ENABLE_CLANG_INDEX_STORE") {
-            args += buildParameters.indexStoreArguments
+            args += buildParameters.indexStoreArguments(for: target)
         } else if buildParameters.triple.isDarwin(), (try? buildParameters.toolchain._isClangCompilerVendorApple()) == true {
-            args += buildParameters.indexStoreArguments
+            args += buildParameters.indexStoreArguments(for: target)
         }
 
         if !buildParameters.triple.isWindows() {

        result += buildParameters.targetTripleArgs(for: target)
        result += ["-swift-version", swiftVersion.rawValue]

        result += buildParameters.indexStoreArguments
        result += buildParameters.toolchain.extraSwiftCFlags
        result += optimizationArguments
        result += ["-g"]

        case .release: break
        }

        args += buildParameters.indexStoreArguments(for: target)
        args += buildParameters.toolchain.extraSwiftCFlags
        args += optimizationArguments
        args += ["-g"]
