Commit e233ccb7 authored by Sergei Trofimovich's avatar Sergei Trofimovich
Browse files

cvise: explicitly point to `clang-format`

Without the cnage `cvise` fails to normalize sources with
`clang-format` and produces less than ideal intermediate sources to
lines-based pass. That affects reduction speed among other things.

Before the change `cvise` complained as:

    $ cvise --command 'grep foo a.c' a.c
    00:00:00 INFO Using temporary interestingness test: /tmp/tmp4a_4wut0.sh
    00:00:00 ERROR cannot find external program clang-format
    00:00:00 ERROR Prereqs not found for pass IndentPass::regular

After the change `clang-format` is found:

    $ result/bin/cvise --command 'grep foo a.c' a.c
    00:00:00 INFO Using temporary interestingness test: /tmp/tmpudipespb.sh
    00:00:00 INFO ===< 1539388 >===

While at it used `--replace-fail`.
parent 3c8525a3
Loading
Loading
Loading
Loading
+10 −3
Original line number Diff line number Diff line
{ lib
, buildPythonApplication
, fetchFromGitHub
, clang-tools
, cmake
, colordiff
, flex
@@ -34,11 +35,11 @@ buildPythonApplication rec {
    # Avoid blanket -Werror to evade build failures on less
    # tested compilers.
    substituteInPlace CMakeLists.txt \
      --replace " -Werror " " "
      --replace-fail " -Werror " " "

    substituteInPlace cvise/utils/testing.py \
      --replace "'colordiff --version'" "'${colordiff}/bin/colordiff --version'" \
      --replace "'colordiff'" "'${colordiff}/bin/colordiff'"
      --replace-fail "'colordiff --version'" "'${colordiff}/bin/colordiff --version'" \
      --replace-fail "'colordiff'" "'${colordiff}/bin/colordiff'"
  '';

  nativeBuildInputs = [
@@ -65,6 +66,12 @@ buildPythonApplication rec {
    unifdef
  ];

  cmakeFlags = [
    # By default `cvise` looks it up in `llvm` bin directory. But
    # `nixpkgs` moves it into a separate derivation.
    "-DCLANG_FORMAT_PATH=${clang-tools}/bin/clang-format"
  ];

  disabledTests = [
    # Needs gcc, fails when run noninteractively (without tty).
    "test_simple_reduction"