llvm-project/clang/test/Tooling/clang-check-extra-arg.cpp
Fangrui Song d69d981d77
[Tooling] -fsyntax-only adjuster: remove -c and -S
compile_commands.json entries often have -c. When adding -fsyntax-only,
we should remove -c to prevent the following warning:

```
% clang -c -fsyntax-only a.c
clang: warning: argument unused during compilation: '-c' [-Wunused-command-line-argument]
```

Previously, -c and -S were inappropriately claimed in
`addPGOAndCoverageFlags` (see the workaround added by commit
a07b135ce0c0111bd83450b5dc29ef0381cdbc39). Now the workaround have been
removed (#98607). (clangDriver reports a -Wunused-command-line-argument
diagnostic for each unclaimed option.)

Fix #100909

Pull Request: https://github.com/llvm/llvm-project/pull/101103
2024-07-30 10:13:18 -07:00

12 lines
702 B
C++

/// Check we do not report "argument unused during compilation: '-c'"
// RUN: clang-check "%s" -extra-arg=-Wunimplemented-warning -extra-arg-before=-Wunimplemented-warning-before -- -c 2>&1 | FileCheck %s --implicit-check-not='argument unused'
// RUN: clang-check "%s" -extra-arg=-Wunimplemented-warning -extra-arg-before=-Wunimplemented-warning-before -- -S -Xclang -S 2>&1 | FileCheck %s --implicit-check-not='argument unused'
// CHECK: unknown warning option '-Wunimplemented-warning-before'
// CHECK: unknown warning option '-Wunimplemented-warning'
// Check we do not crash with -extra-arg=-gsplit-dwarf (we did, under linux).
// RUN: clang-check "%s" -extra-arg=-gsplit-dwarf -- -c
void a(){}