Skip to content

Commit

Permalink
[flang][driver] restore flang-new as symlink
Browse files Browse the repository at this point in the history
Restore flang-new as a symlink to flang for backwards compatibility

Co-authored-by: H. Vetinari <h.vetinari@gmx.com>
Co-authored-by: Andrzej Warzynski <andrzej.warzynski@arm.com>
  • Loading branch information
3 people committed Sep 26, 2024
1 parent 649a734 commit b71c1d5
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
3 changes: 3 additions & 0 deletions clang/lib/Driver/ToolChain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,9 @@ static const DriverSuffix *FindDriverSuffix(StringRef ProgName, size_t &Pos) {
{"cl", "--driver-mode=cl"},
{"++", "--driver-mode=g++"},
{"flang", "--driver-mode=flang"},
// For backwards compatibility, we create a symlink for `flang` called
// `flang-new`. This will be removed in the future.
{"flang-new", "--driver-mode=flang"},
{"clang-dxc", "--driver-mode=dxc"},
};

Expand Down
4 changes: 4 additions & 0 deletions flang/tools/flang-driver/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,7 @@ if(FLANG_PLUGIN_SUPPORT)
endif()

install(TARGETS flang DESTINATION "${CMAKE_INSTALL_BINDIR}")

# Keep "flang-new" as a symlink for backwards compatiblity. Remove once "flang"
# is a widely adopted name.
add_flang_symlink(flang-new flang)
3 changes: 2 additions & 1 deletion flang/tools/flang-driver/driver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,8 @@ int main(int argc, const char **argv) {
llvm::InitLLVM x(argc, argv);
llvm::SmallVector<const char *, 256> args(argv, argv + argc);

clang::driver::ParsedClangName targetandMode("flang", "--driver-mode=flang");
clang::driver::ParsedClangName targetandMode =
clang::driver::ToolChain::getTargetAndModeFromProgramName(argv[0]);
std::string driverPath = getExecutablePath(args[0]);

llvm::BumpPtrAllocator a;
Expand Down

0 comments on commit b71c1d5

Please sign in to comment.