Commit cbf495f
authored
[Clang][Driver] report unsupported option error when link + compile in same process (llvm#116476)
Fixes: llvm#116278
This change updates clang to report unsupported option errors regardless
of the command line argument order.
When clang is invoked with a source file and without `-c` it will both
compile and link. When an unsupported option is also part of the command
line clang should generated an error. However, if the source file name
comes before an object file, eg: `-lc`, the error is ignored.
```
$ clang --target=x86_64 -lc hello.c -mhtm
clang: error: unsupported option '-mhtm' for target 'x86_64'
$ echo $?
1
```
but if `-lc` comes after `hello.c` the error is dropped
```
$ clang --target=x86_64 hello.c -mhtm -lc
$ echo $?
0
```
after this change clang will report the error regardless of the command
line argument order.1 parent 2de2e7a commit cbf495f
2 files changed
+16
-7
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4063 | 4063 | | |
4064 | 4064 | | |
4065 | 4065 | | |
4066 | | - | |
| 4066 | + | |
4067 | 4067 | | |
4068 | 4068 | | |
4069 | 4069 | | |
4070 | 4070 | | |
4071 | 4071 | | |
4072 | | - | |
| 4072 | + | |
| 4073 | + | |
| 4074 | + | |
4073 | 4075 | | |
4074 | 4076 | | |
4075 | 4077 | | |
4076 | | - | |
4077 | 4078 | | |
4078 | 4079 | | |
4079 | 4080 | | |
| |||
4128 | 4129 | | |
4129 | 4130 | | |
4130 | 4131 | | |
4131 | | - | |
4132 | | - | |
4133 | | - | |
4134 | | - | |
| 4132 | + | |
| 4133 | + | |
4135 | 4134 | | |
4136 | 4135 | | |
4137 | 4136 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
0 commit comments