Remove -i command line option, add -imultilib
I discovered that '-i' is a command line option for the driver,
however it actually does not do anything and is not supported by any
other compiler. In fact, it is completely undocumented for Clang.
I found a couple of instances of people confusing it with one of
the variety of other command line options that control the driver.
Because of this, we should delete this option so that it is clear
that it isn't valid.
HOWEVER, I found that GCC DOES support -imultilib, which the -i
was hiding our lack of support for. We currently only use imultilib
for the purpose of forwarding to gfortran (in a specific test written
by chandlerc for this purpose).
imultilib is a rarely used (if ever?) feature that I could find no
references to on the internet, and in fact, my company's massive test
suite has zero references to it ever being used.
SO, this patch removes the -i option so that we will now give an error
on its usage (so that it won't be confused with -I), and replaces it with
-imultilib, which is now specified as a gfortran_group option.
Differential Revision: https://reviews.llvm.org/D44032
llvm-svn: 326623
2018-03-03 05:53:25 +08:00
|
|
|
// RUN: not %clang %s -cake-is-lie -%0 -%d -HHHH -munknown-to-clang-option -print-stats -funknown-to-clang-option -ifoo -imultilib dir -### 2>&1 | \
|
2019-05-24 01:58:33 +08:00
|
|
|
// RUN: FileCheck %s
|
Remove -i command line option, add -imultilib
I discovered that '-i' is a command line option for the driver,
however it actually does not do anything and is not supported by any
other compiler. In fact, it is completely undocumented for Clang.
I found a couple of instances of people confusing it with one of
the variety of other command line options that control the driver.
Because of this, we should delete this option so that it is clear
that it isn't valid.
HOWEVER, I found that GCC DOES support -imultilib, which the -i
was hiding our lack of support for. We currently only use imultilib
for the purpose of forwarding to gfortran (in a specific test written
by chandlerc for this purpose).
imultilib is a rarely used (if ever?) feature that I could find no
references to on the internet, and in fact, my company's massive test
suite has zero references to it ever being used.
SO, this patch removes the -i option so that we will now give an error
on its usage (so that it won't be confused with -I), and replaces it with
-imultilib, which is now specified as a gfortran_group option.
Differential Revision: https://reviews.llvm.org/D44032
llvm-svn: 326623
2018-03-03 05:53:25 +08:00
|
|
|
// RUN: %clang %s -imultilib dir -### 2>&1 | \
|
2019-05-24 01:58:33 +08:00
|
|
|
// RUN: FileCheck %s --check-prefix=MULTILIB
|
2018-01-11 04:23:45 +08:00
|
|
|
// RUN: not %clang %s -stdlibs=foo -hell -version -### 2>&1 | \
|
2019-05-24 01:58:33 +08:00
|
|
|
// RUN: FileCheck %s --check-prefix=DID-YOU-MEAN
|
2016-01-26 10:23:05 +08:00
|
|
|
// RUN: %clang_cl -cake-is-lie -%0 -%d -HHHH -munknown-to-clang-option -print-stats -funknown-to-clang-option -### -c -- %s 2>&1 | \
|
2019-05-24 01:58:33 +08:00
|
|
|
// RUN: FileCheck %s --check-prefix=CL
|
[Driver] Suggest correctly spelled driver options
Summary:
Depends on https://reviews.llvm.org/D41732.
Utilities such as `opt`, when invoked with arguments that are very
nearly spelled correctly, suggest the correctly spelled options:
```
bin/opt -hel
opt: Unknown command line argument '-hel'. Try: 'bin/opt -help'
opt: Did you mean '-help'?
```
Clang, on the other hand, prior to this commit, does not:
```
bin/clang -hel
clang-6.0: error: unknown argument: '-hel'
```
This commit makes use of the new libLLVMOption API from
https://reviews.llvm.org/D41732 in order to provide correct suggestions:
```
bin/clang -hel
clang-6.0: error: unknown argument: '-hel', did you mean '-help'?
```
Test Plan: `check-clang`
Reviewers: yamaguchi, v.g.vassilev, teemperor, ruiu, bruno
Reviewed By: bruno
Subscribers: bruno, jroelofs, cfe-commits
Differential Revision: https://reviews.llvm.org/D41733
llvm-svn: 321917
2018-01-06 08:25:40 +08:00
|
|
|
// RUN: %clang_cl -Brepo -### -- %s 2>&1 | \
|
2019-05-24 01:58:33 +08:00
|
|
|
// RUN: FileCheck %s --check-prefix=CL-DID-YOU-MEAN
|
|
|
|
// RUN: %clang_cl /Brepo -### -- %s 2>&1 | \
|
|
|
|
// RUN: FileCheck %s --check-prefix=CL-DID-YOU-MEAN-SLASH
|
[clang] Make the driver not diagnose errors on nonexistent linker inputs
When nonexistent linker inputs are passed to the driver, the linker
now errors out, instead of the compiler. If the linker does not run,
clang now emits a "warning: linker input unused" instead of an error
for nonexistent files.
The motivation for this change is that I noticed that
`clang-cl /winsysroot sysroot main.cc ole32.lib` emitted a
"ole32.lib not found" error, even though the linker finds it just fine when
I run `clang-cl /winsysroot sysroot main.cc /link ole32.lib`.
The same problem occurs if running `clang-cl main.cc ole32.lib` in a
non-MSVC shell.
The problem is that DiagnoseInputExistence() only looked for libs in %LIB%,
but MSVCToolChain uses much more involved techniques.
For this particular problem, we could make DiagnoseInputExistence() ask
the toolchain to see if it can find a .lib file, but in general the
driver can't know what the linker will do to find files, so it shouldn't
try. For example, if we implement PR24616, lld-link will look in the
registry to determine a good default for %LIB% if it isn't set.
This is less or a problem for the gcc driver, since .a paths there are
either passed via -l flags (which honor -L), or via a qualified path
(that doesn't honor -L) -- but for example ld.lld's --chroot flag
can also trigger this problem. Without this patch,
`clang -fuse-ld=lld -Wl,--chroot,some/dir /file.o` will complain that
`/file.o` doesn't exist, even though
`clang -fuse-ld=lld -Wl,--chroot,some/dir -Wl,/file.o` succeeds just fine.
This implements rnk's suggestion on the old bug PR27234.
Differential Revision: https://reviews.llvm.org/D109624
2021-09-13 20:57:38 +08:00
|
|
|
// RUN: %clang_cl /Brepo -### /Tc%s /link 2>&1 | \
|
|
|
|
// RUN: FileCheck %s --check-prefix=CL-DID-YOU-MEAN-SLASH
|
2017-05-24 22:57:17 +08:00
|
|
|
// RUN: not %clang_cl -cake-is-lie -%0 -%d -HHHH -munknown-to-clang-option -print-stats -funknown-to-clang-option -c -Werror=unknown-argument -### -- %s 2>&1 | \
|
2019-05-24 01:58:33 +08:00
|
|
|
// RUN: FileCheck %s --check-prefix=CL-ERROR
|
[Driver] Suggest correctly spelled driver options
Summary:
Depends on https://reviews.llvm.org/D41732.
Utilities such as `opt`, when invoked with arguments that are very
nearly spelled correctly, suggest the correctly spelled options:
```
bin/opt -hel
opt: Unknown command line argument '-hel'. Try: 'bin/opt -help'
opt: Did you mean '-help'?
```
Clang, on the other hand, prior to this commit, does not:
```
bin/clang -hel
clang-6.0: error: unknown argument: '-hel'
```
This commit makes use of the new libLLVMOption API from
https://reviews.llvm.org/D41732 in order to provide correct suggestions:
```
bin/clang -hel
clang-6.0: error: unknown argument: '-hel', did you mean '-help'?
```
Test Plan: `check-clang`
Reviewers: yamaguchi, v.g.vassilev, teemperor, ruiu, bruno
Reviewed By: bruno
Subscribers: bruno, jroelofs, cfe-commits
Differential Revision: https://reviews.llvm.org/D41733
llvm-svn: 321917
2018-01-06 08:25:40 +08:00
|
|
|
// RUN: not %clang_cl -helo -Werror=unknown-argument -### -- %s 2>&1 | \
|
2019-05-24 01:58:33 +08:00
|
|
|
// RUN: FileCheck %s --check-prefix=CL-ERROR-DID-YOU-MEAN
|
2016-01-26 10:23:05 +08:00
|
|
|
// RUN: %clang_cl -cake-is-lie -%0 -%d -HHHH -munknown-to-clang-option -print-stats -funknown-to-clang-option -c -Wno-unknown-argument -### -- %s 2>&1 | \
|
2019-05-24 01:58:33 +08:00
|
|
|
// RUN: FileCheck %s --check-prefix=SILENT
|
2018-09-04 00:55:02 +08:00
|
|
|
// RUN: not %clang -cc1as -hell --version 2>&1 | \
|
2019-05-24 01:58:33 +08:00
|
|
|
// RUN: FileCheck %s --check-prefix=CC1AS-DID-YOU-MEAN
|
2018-01-16 05:05:40 +08:00
|
|
|
// RUN: not %clang -cc1asphalt -help 2>&1 | \
|
2019-05-24 01:58:33 +08:00
|
|
|
// RUN: FileCheck %s --check-prefix=UNKNOWN-INTEGRATED
|
2012-01-26 04:00:43 +08:00
|
|
|
|
2016-01-26 10:23:05 +08:00
|
|
|
// CHECK: error: unknown argument: '-cake-is-lie'
|
|
|
|
// CHECK: error: unknown argument: '-%0'
|
|
|
|
// CHECK: error: unknown argument: '-%d'
|
|
|
|
// CHECK: error: unknown argument: '-HHHH'
|
|
|
|
// CHECK: error: unknown argument: '-munknown-to-clang-option'
|
|
|
|
// CHECK: error: unknown argument: '-print-stats'
|
|
|
|
// CHECK: error: unknown argument: '-funknown-to-clang-option'
|
Remove -i command line option, add -imultilib
I discovered that '-i' is a command line option for the driver,
however it actually does not do anything and is not supported by any
other compiler. In fact, it is completely undocumented for Clang.
I found a couple of instances of people confusing it with one of
the variety of other command line options that control the driver.
Because of this, we should delete this option so that it is clear
that it isn't valid.
HOWEVER, I found that GCC DOES support -imultilib, which the -i
was hiding our lack of support for. We currently only use imultilib
for the purpose of forwarding to gfortran (in a specific test written
by chandlerc for this purpose).
imultilib is a rarely used (if ever?) feature that I could find no
references to on the internet, and in fact, my company's massive test
suite has zero references to it ever being used.
SO, this patch removes the -i option so that we will now give an error
on its usage (so that it won't be confused with -I), and replaces it with
-imultilib, which is now specified as a gfortran_group option.
Differential Revision: https://reviews.llvm.org/D44032
llvm-svn: 326623
2018-03-03 05:53:25 +08:00
|
|
|
// CHECK: error: unknown argument: '-ifoo'
|
|
|
|
// MULTILIB: warning: argument unused during compilation: '-imultilib dir'
|
2019-05-24 01:58:33 +08:00
|
|
|
// DID-YOU-MEAN: error: unknown argument '-stdlibs=foo'; did you mean '-stdlib=foo'?
|
|
|
|
// DID-YOU-MEAN: error: unknown argument '-hell'; did you mean '-help'?
|
|
|
|
// DID-YOU-MEAN: error: unknown argument '-version'; did you mean '--version'?
|
2016-01-26 10:23:05 +08:00
|
|
|
// CL: warning: unknown argument ignored in clang-cl: '-cake-is-lie'
|
|
|
|
// CL: warning: unknown argument ignored in clang-cl: '-%0'
|
|
|
|
// CL: warning: unknown argument ignored in clang-cl: '-%d'
|
|
|
|
// CL: warning: unknown argument ignored in clang-cl: '-HHHH'
|
|
|
|
// CL: warning: unknown argument ignored in clang-cl: '-munknown-to-clang-option'
|
|
|
|
// CL: warning: unknown argument ignored in clang-cl: '-print-stats'
|
|
|
|
// CL: warning: unknown argument ignored in clang-cl: '-funknown-to-clang-option'
|
2019-05-24 01:58:33 +08:00
|
|
|
// CL-DID-YOU-MEAN: warning: unknown argument ignored in clang-cl '-Brepo'; did you mean '-Brepro'?
|
|
|
|
// CL-DID-YOU-MEAN-SLASH: error: no such file or directory: '/Brepo'; did you mean '/Brepro'?
|
2016-01-26 10:23:05 +08:00
|
|
|
// CL-ERROR: error: unknown argument ignored in clang-cl: '-cake-is-lie'
|
|
|
|
// CL-ERROR: error: unknown argument ignored in clang-cl: '-%0'
|
|
|
|
// CL-ERROR: error: unknown argument ignored in clang-cl: '-%d'
|
|
|
|
// CL-ERROR: error: unknown argument ignored in clang-cl: '-HHHH'
|
|
|
|
// CL-ERROR: error: unknown argument ignored in clang-cl: '-munknown-to-clang-option'
|
|
|
|
// CL-ERROR: error: unknown argument ignored in clang-cl: '-print-stats'
|
|
|
|
// CL-ERROR: error: unknown argument ignored in clang-cl: '-funknown-to-clang-option'
|
2019-05-24 01:58:33 +08:00
|
|
|
// CL-ERROR-DID-YOU-MEAN: error: unknown argument ignored in clang-cl '-helo'; did you mean '-help'?
|
2016-01-26 10:23:05 +08:00
|
|
|
// SILENT-NOT: error:
|
|
|
|
// SILENT-NOT: warning:
|
2019-05-24 01:58:33 +08:00
|
|
|
// CC1AS-DID-YOU-MEAN: error: unknown argument '-hell'; did you mean '-help'?
|
|
|
|
// CC1AS-DID-YOU-MEAN: error: unknown argument '--version'; did you mean '-version'?
|
[Clang][Driver] Re-use the calling process instead of creating a new process for the cc1 invocation
With this patch, the clang tool will now call the -cc1 invocation directly inside the same process. Previously, the -cc1 invocation was creating, and waiting for, a new process.
This patch therefore reduces the number of created processes during a build, thus it reduces build times on platforms where process creation can be costly (Windows) and/or impacted by a antivirus.
It also makes debugging a bit easier, as there's no need to attach to the secondary -cc1 process anymore, breakpoints will be hit inside the same process.
Crashes or signaling inside the -cc1 invocation will have the same side-effect as before, and will be reported through the same means.
This behavior can be controlled at compile-time through the CLANG_SPAWN_CC1 cmake flag, which defaults to OFF. Setting it to ON will revert to the previous behavior, where any -cc1 invocation will create/fork a secondary process.
At run-time, it is also possible to tweak the CLANG_SPAWN_CC1 environment variable. Setting it and will override the compile-time setting. A value of 0 calls -cc1 inside the calling process; a value of 1 will create a secondary process, as before.
Differential Revision: https://reviews.llvm.org/D69825
2020-01-13 23:40:04 +08:00
|
|
|
// UNKNOWN-INTEGRATED: error: unknown integrated tool '-cc1asphalt'. Valid tools include '-cc1' and '-cc1as'.
|
2013-09-24 07:27:32 +08:00
|
|
|
|
2013-09-26 03:07:08 +08:00
|
|
|
// RUN: %clang -S %s -o %t.s -Wunknown-to-clang-option 2>&1 | FileCheck --check-prefix=IGNORED %s
|
2013-09-24 07:27:32 +08:00
|
|
|
|
|
|
|
// IGNORED: warning: unknown warning option '-Wunknown-to-clang-option'
|