Hello,<br>I ran into a problem when using the -Xclang switch. According to the documentation it says that it 'Pass arg to the clang compiler frontend.'. But then, when I use it, the arguments are also passed to the assembler and the linker. Example (the -W switch is a random one, I just picked it because clang -cc1 recognizes it):<br>
<br># clang -ccc-echo -Xclang -W -o ioi ioi.c<br>"/home/pamaury/avalon/bin/clang" -cc1 -triple x86_64-unknown-linux-gnu -S -disable-free -main-file-name ioi.c -mrelocation-model static -mdisable-fp-elim -mconstructor-aliases -munwind-tables -target-cpu x86-64 -resource-dir /home/pamaury/avalon/lib/clang/2.8 -ferror-limit 19 -fmessage-length 202 -fgnu-runtime -fdiagnostics-show-option -fcolor-diagnostics -W -o /tmp/cc-0rvFL5.s -x c ioi.c<br>
"/usr/bin/gcc" -Xclang -W -c -m64 -o /tmp/cc-GuWlIA.o -x assembler /tmp/cc-0rvFL5.s<br>gcc: unrecognized option '-Xclang'<br> "/usr/bin/gcc" -Xclang -W -m64 -o ioi /tmp/cc-GuWlIA.o<br>gcc: unrecognized option '-Xclang'<br>
<br>Looking at the code, it seems that this is because the generic gcc code in gcc::Common::ConstructJob forwards an argument if the option hasForwardToGCC() and hasForwardToGCC() itself is defined as:<br><br>bool hasForwardToGCC() const { return !DriverOption && !LinkerInput; }<br>
<br>Which seems strange to me because obviously, clang will not use GCC as the compiler itself (that would defeat the point of using clang :)) so when using the -Xclang option which is not a driver option nor a linker input but clearly a compiler related switch, it should not be forwarded to gcc. <br>
<br>Am I missing something there or this really a bug ?<br><br clear="all">Amaury Pouly<br>