Skip to content

Commit 8f7c68e

Browse files
authored
Merge pull request #37805 from apple/revert-36749-clang-executable-path
2 parents b58d773 + fe870d0 commit 8f7c68e

File tree

7 files changed

+2
-37
lines changed

7 files changed

+2
-37
lines changed

include/swift/Basic/LangOptions.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -629,10 +629,6 @@ namespace swift {
629629
/// Options for controlling the behavior of the Clang importer.
630630
class ClangImporterOptions final {
631631
public:
632-
/// The path to the Clang compiler executable.
633-
/// Used to detect the default include paths.
634-
std::string clangPath = "clang";
635-
636632
/// The module cache path which the Clang importer should use.
637633
std::string ModuleCachePath;
638634

lib/ClangImporter/ClangImporter.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -953,7 +953,7 @@ ClangImporter::getClangArguments(ASTContext &ctx) {
953953
std::vector<std::string> invocationArgStrs;
954954
// Clang expects this to be like an actual command line. So we need to pass in
955955
// "clang" for argv[0]
956-
invocationArgStrs.push_back(ctx.ClangImporterOpts.clangPath);
956+
invocationArgStrs.push_back("clang");
957957
switch (ctx.ClangImporterOpts.Mode) {
958958
case ClangImporterOptions::Modes::Normal:
959959
case ClangImporterOptions::Modes::PrecompiledModule:

lib/Driver/ToolChains.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,6 @@ void ToolChain::addCommonFrontendArgs(const OutputInfo &OI,
259259
inputArgs.AddLastArg(arguments, options::OPT_swift_version);
260260
inputArgs.AddLastArg(arguments, options::OPT_enforce_exclusivity_EQ);
261261
inputArgs.AddLastArg(arguments, options::OPT_stats_output_dir);
262-
inputArgs.AddLastArg(arguments, options::OPT_tools_directory);
263262
inputArgs.AddLastArg(arguments, options::OPT_trace_stats_events);
264263
inputArgs.AddLastArg(arguments, options::OPT_profile_stats_events);
265264
inputArgs.AddLastArg(arguments, options::OPT_profile_stats_entities);

lib/Frontend/CompilerInvocation.cpp

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -66,11 +66,6 @@ void CompilerInvocation::setMainExecutablePath(StringRef Path) {
6666
Path, FrontendOpts.UseSharedResourceFolder, LibPath);
6767
setRuntimeResourcePath(LibPath.str());
6868

69-
llvm::SmallString<128> clangPath(Path);
70-
llvm::sys::path::remove_filename(clangPath);
71-
llvm::sys::path::append(clangPath, "clang");
72-
ClangImporterOpts.clangPath = std::string(clangPath);
73-
7469
llvm::SmallString<128> DiagnosticDocsPath(Path);
7570
llvm::sys::path::remove_filename(DiagnosticDocsPath); // Remove /swift
7671
llvm::sys::path::remove_filename(DiagnosticDocsPath); // Remove /bin
@@ -941,18 +936,6 @@ static bool ParseClangImporterArgs(ClangImporterOptions &Opts,
941936
StringRef workingDirectory) {
942937
using namespace options;
943938

944-
if (const Arg *a = Args.getLastArg(OPT_tools_directory)) {
945-
// If a custom tools directory is specified, try to find Clang there.
946-
// This is useful when the Swift executable is located in a different
947-
// directory than the Clang/LLVM executables, for example, when building
948-
// the Swift project itself.
949-
llvm::SmallString<128> clangPath(a->getValue());
950-
llvm::sys::path::append(clangPath, "clang");
951-
if (llvm::sys::fs::exists(clangPath)) {
952-
Opts.clangPath = std::string(clangPath);
953-
}
954-
}
955-
956939
if (const Arg *A = Args.getLastArg(OPT_module_cache_path)) {
957940
Opts.ModuleCachePath = A->getValue();
958941
}

stdlib/cmake/modules/SwiftSource.cmake

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -403,8 +403,6 @@ function(_compile_swift_files
403403
compute_library_subdir(library_subdir
404404
"${library_subdir_sdk}" "${SWIFTFILE_ARCHITECTURE}")
405405

406-
list(APPEND swift_flags "-tools-directory" "${SWIFT_NATIVE_CLANG_TOOLS_PATH}")
407-
408406
# If we have a custom module cache path, use it.
409407
if (SWIFT_MODULE_CACHE_PATH)
410408
list(APPEND swift_flags "-module-cache-path" "${SWIFT_MODULE_CACHE_PATH}")

test/ScanDependencies/module_deps.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ import SubE
122122
// CHECK-NEXT: "-frontend"
123123
// CHECK-NEXT: "-only-use-extra-clang-opts"
124124
// CHECK-NEXT: "-Xcc"
125-
// CHECK-NEXT: "BUILD_DIR/bin/clang"
125+
// CHECK-NEXT: "clang"
126126
// CHECK: "-fsystem-module",
127127
// CHECK-NEXT: "-emit-pcm",
128128
// CHECK-NEXT: "-module-name",

tools/swift-ide-test/swift-ide-test.cpp

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -277,11 +277,6 @@ static llvm::cl::list<std::string>
277277
SwiftVersion("swift-version", llvm::cl::desc("Swift version"),
278278
llvm::cl::cat(Category));
279279

280-
static llvm::cl::opt<std::string>
281-
ToolsDirectory("tools-directory",
282-
llvm::cl::desc("Path to external executables (ld, clang, binutils)"),
283-
llvm::cl::cat(Category));
284-
285280
static llvm::cl::list<std::string>
286281
ModuleCachePath("module-cache-path", llvm::cl::desc("Clang module cache path"),
287282
llvm::cl::cat(Category));
@@ -3882,12 +3877,6 @@ int main(int argc, char *argv[]) {
38823877
InitInvok.getLangOptions().EffectiveLanguageVersion = actual.getValue();
38833878
}
38843879
}
3885-
if (!options::ToolsDirectory.empty()) {
3886-
SmallString<128> toolsDir(options::ToolsDirectory);
3887-
llvm::sys::path::append(toolsDir, "clang");
3888-
InitInvok.getClangImporterOptions().clangPath =
3889-
std::string(toolsDir);
3890-
}
38913880
if (!options::ModuleCachePath.empty()) {
38923881
// Honor the *last* -module-cache-path specified.
38933882
InitInvok.getClangImporterOptions().ModuleCachePath =

0 commit comments

Comments
 (0)