[flang-commits] [flang] a2d340b - Revert "[Flang][Driver] Add -print-resource-dir command line flag to emit Flang's resource directory" (#96557)
via flang-commits
flang-commits at lists.llvm.org
Mon Jun 24 16:46:53 PDT 2024
Author: David Truby
Date: 2024-06-25T00:46:50+01:00
New Revision: a2d340ba161fe48ee4ff736c6e7877038a7388cd
URL: https://github.com/llvm/llvm-project/commit/a2d340ba161fe48ee4ff736c6e7877038a7388cd
DIFF: https://github.com/llvm/llvm-project/commit/a2d340ba161fe48ee4ff736c6e7877038a7388cd.diff
LOG: Revert "[Flang][Driver] Add -print-resource-dir command line flag to emit Flang's resource directory" (#96557)
Reverts llvm/llvm-project#90886
These changes broke linking to compiler-rt on Windows
Added:
Modified:
clang/include/clang/Driver/Driver.h
clang/include/clang/Driver/Options.td
clang/lib/Driver/Driver.cpp
Removed:
flang/test/Driver/print-resource-dir.F90
################################################################################
diff --git a/clang/include/clang/Driver/Driver.h b/clang/include/clang/Driver/Driver.h
index 084c3ffe69ae8..cc1538372d5f8 100644
--- a/clang/include/clang/Driver/Driver.h
+++ b/clang/include/clang/Driver/Driver.h
@@ -747,9 +747,6 @@ class Driver {
/// option.
void setDriverMode(StringRef DriverModeValue);
- /// Set the resource directory, depending on which driver is being used.
- void setResourceDirectory();
-
/// Parse the \p Args list for LTO options and record the type of LTO
/// compilation based on which -f(no-)?lto(=.*)? option occurs last.
void setLTOMode(const llvm::opt::ArgList &Args);
diff --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td
index 6416261077ed1..dfdf0741e28eb 100644
--- a/clang/include/clang/Driver/Options.td
+++ b/clang/include/clang/Driver/Options.td
@@ -5535,10 +5535,7 @@ def print_prog_name_EQ : Joined<["-", "--"], "print-prog-name=">,
Visibility<[ClangOption, CLOption]>;
def print_resource_dir : Flag<["-", "--"], "print-resource-dir">,
HelpText<"Print the resource directory pathname">,
- HelpTextForVariants<[FlangOption],
- "Print the resource directory pathname that contains lib and "
- "include directories with the runtime libraries and MODULE files.">,
- Visibility<[ClangOption, CLOption, FlangOption]>;
+ Visibility<[ClangOption, CLOption]>;
def print_search_dirs : Flag<["-", "--"], "print-search-dirs">,
HelpText<"Print the paths used for finding libraries and programs">,
Visibility<[ClangOption, CLOption]>;
diff --git a/clang/lib/Driver/Driver.cpp b/clang/lib/Driver/Driver.cpp
index 0298d22203d9d..33ab7cc3f3968 100644
--- a/clang/lib/Driver/Driver.cpp
+++ b/clang/lib/Driver/Driver.cpp
@@ -229,6 +229,9 @@ Driver::Driver(StringRef ClangExecutable, StringRef TargetTriple,
UserConfigDir = static_cast<std::string>(P);
}
#endif
+
+ // Compute the path to the resource directory.
+ ResourceDir = GetResourcesPath(ClangExecutable, CLANG_RESOURCE_DIR);
}
void Driver::setDriverMode(StringRef Value) {
@@ -247,24 +250,6 @@ void Driver::setDriverMode(StringRef Value) {
Diag(diag::err_drv_unsupported_option_argument) << OptName << Value;
}
-void Driver::setResourceDirectory() {
- // Compute the path to the resource directory, depending on the driver mode.
- switch (Mode) {
- case GCCMode:
- case GXXMode:
- case CPPMode:
- case CLMode:
- case DXCMode:
- ResourceDir = GetResourcesPath(ClangExecutable, CLANG_RESOURCE_DIR);
- break;
- case FlangMode:
- SmallString<64> customResourcePathRelativeToDriver{".."};
- ResourceDir =
- GetResourcesPath(ClangExecutable, customResourcePathRelativeToDriver);
- break;
- }
-}
-
InputArgList Driver::ParseArgStrings(ArrayRef<const char *> ArgStrings,
bool UseDriverMode, bool &ContainsError) {
llvm::PrettyStackTraceString CrashInfo("Command line argument parsing");
@@ -1217,7 +1202,6 @@ Compilation *Driver::BuildCompilation(ArrayRef<const char *> ArgList) {
if (!DriverMode.empty())
setDriverMode(DriverMode);
- setResourceDirectory();
// FIXME: What are we going to do with -V and -b?
// Arguments specified in command line.
diff --git a/flang/test/Driver/print-resource-dir.F90 b/flang/test/Driver/print-resource-dir.F90
deleted file mode 100644
index 8fd35f1800df2..0000000000000
--- a/flang/test/Driver/print-resource-dir.F90
+++ /dev/null
@@ -1,4 +0,0 @@
-! DEFINE: %{resource_dir} = %S/Inputs/resource_dir
-! RUN: %flang -print-resource-dir -resource-dir=%{resource_dir}.. \
-! RUN: | FileCheck -check-prefix=PRINT-RESOURCE-DIR -DFILE=%{resource_dir} %s
-! PRINT-RESOURCE-DIR: [[FILE]]
More information about the flang-commits
mailing list