From 87086972d65c6a89b5a43182d6e845a80f807bce Mon Sep 17 00:00:00 2001 From: sternenseemann Date: Sat, 12 Oct 2024 18:36:45 +0200 Subject: [PATCH] llvmPackages_12.clang: use nostdlibinc patch instead of sed command Seems like the patch we've written for LLVM 13 and above also works for LLVM 12 which seems a little more robust. --- pkgs/development/compilers/llvm/common/clang/default.nix | 4 ---- pkgs/development/compilers/llvm/common/default.nix | 6 ++---- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/pkgs/development/compilers/llvm/common/clang/default.nix b/pkgs/development/compilers/llvm/common/clang/default.nix index bc1a08b91835a6..7053f7ba8752dd 100644 --- a/pkgs/development/compilers/llvm/common/clang/default.nix +++ b/pkgs/development/compilers/llvm/common/clang/default.nix @@ -81,10 +81,6 @@ let --replace-fail 'StringRef P = llvm::sys::path::parent_path(D.Dir);' 'StringRef P = "${lib.getLib libllvm}";' (cd tools && ln -s ../../clang-tools-extra extra) '' + lib.optionalString (lib.versionOlder release_version "13") '' - sed -i -e 's/DriverArgs.hasArg(options::OPT_nostdlibinc)/true/' \ - -e 's/Args.hasArg(options::OPT_nostdlibinc)/true/' \ - lib/Driver/ToolChains/*.cpp - substituteInPlace tools/extra/clangd/quality/CompletionModel.cmake \ --replace ' ''${CMAKE_SOURCE_DIR}/../clang-tools-extra' ' ''${CMAKE_SOURCE_DIR}/tools/extra' '' diff --git a/pkgs/development/compilers/llvm/common/default.nix b/pkgs/development/compilers/llvm/common/default.nix index b5e4e914831b92..69db20ce9e1c9b 100644 --- a/pkgs/development/compilers/llvm/common/default.nix +++ b/pkgs/development/compilers/llvm/common/default.nix @@ -540,11 +540,9 @@ let # mis-compilation in firefox. # See: https://bugzilla.mozilla.org/show_bug.cgi?id=1741454 (metadata.getVersionFile "clang/revert-malloc-alignment-assumption.patch") - ++ lib.optionals (lib.versionAtLeast metadata.release_version "13") [ - # TODO: This also applies for clang == 12, do we need it? - ./clang/add-nostdlibinc-flag.patch - ] ++ [ + ./clang/add-nostdlibinc-flag.patch + (substituteAll { src = if (lib.versionOlder metadata.release_version "16") then