llvm-project/clang/test/ClangScanDeps/strip_diag_serialize.cpp
Jan Svoboda 35fa3e60d1 [clang][deps] Move stripping of diagnostic serialization from clang-scan-deps to DependencyScanning library
To prevent the creation of diagnostics file, `clang-scan-deps` strips the corresponding command-line argument. This behavior is useful even when using the C++ `DependencyScanner` library.

This patch transforms stripping of command-line in `clang-scan-deps` into stripping of `CompilerInvocation` in `DependencyScanning`.

AFAIK, the `clang-cl` driver doesn't even accept `--serialize-diagnostics`, so I've removed the test. (It would fail with an unknown command-line argument otherwise.)

Note: Since we're generating command-lines for modular dependencies from `CompilerInvocation`, the `--serialize-diagnostics` will be dropped. This was already happening in `clang-scan-deps` before this patch, but it will now happen also when using `DependencyScanning` library directly. This is resolved in D104036.

Reviewed By: dexonsmith, arphaman

Differential Revision: https://reviews.llvm.org/D104012
2021-06-14 12:23:32 +02:00

13 lines
437 B
C++

// RUN: rm -rf %t.dir
// RUN: rm -rf %t.cdb
// RUN: mkdir -p %t.dir
// RUN: cp %s %t.dir/strip_diag_serialize_input.cpp
// RUN: cp %s %t.dir/strip_diag_serialize_input_clangcl.cpp
// RUN: sed -e "s|DIR|%/t.dir|g" %S/Inputs/strip_diag_serialize.json > %t.cdb
//
// RUN: clang-scan-deps -compilation-database %t.cdb -j 1 2>&1 | FileCheck %s
// CHECK-NOT: unable to open file
// CHECK: strip_diag_serialize_input.cpp
#warning "diagnostic"