Skip to content

Commit

Permalink
Revert "[Flang][Driver] Add -print-resource-dir command line flag to …
Browse files Browse the repository at this point in the history
…emit Flang's resource directory" (llvm#96557)

Reverts llvm#90886

These changes broke linking to compiler-rt on Windows
  • Loading branch information
DavidTruby authored Jun 24, 2024
1 parent 361543e commit a2d340b
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 30 deletions.
3 changes: 0 additions & 3 deletions clang/include/clang/Driver/Driver.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
5 changes: 1 addition & 4 deletions clang/include/clang/Driver/Options.td
Original file line number Diff line number Diff line change
Expand Up @@ -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]>;
Expand Down
22 changes: 3 additions & 19 deletions clang/lib/Driver/Driver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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");
Expand Down Expand Up @@ -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.
Expand Down
4 changes: 0 additions & 4 deletions flang/test/Driver/print-resource-dir.F90

This file was deleted.

0 comments on commit a2d340b

Please sign in to comment.