llvm-project icon indicating copy to clipboard operation
llvm-project copied to clipboard

[Driver] Clang driver treats `.s` file extension as `-x assembler-with-cpp` instead of `-x assembler`

Open rapidsna opened this issue 3 years ago • 3 comments

According to https://github.com/llvm/llvm-project/blob/main/clang/include/clang/Driver/Types.def#L78 and https://gcc.gnu.org/onlinedocs/gcc-11.1.0/gcc/Overall-Options.html, it seems .s should be treated as -x assembler, but it seems the driver treats .s as -x assembler-with-cpp.

Steps to reproduce:

touch empty.s
clang -### empty.s

The output contains "-x" "assembler-with-cpp".

rapidsna avatar Nov 01 '23 23:11 rapidsna

@llvm/issue-subscribers-clang-driver

Author: Yeoul Na (rapidsna)

According to https://github.com/llvm/llvm-project/blob/main/clang/include/clang/Driver/Types.def#L78 and https://gcc.gnu.org/onlinedocs/gcc-11.1.0/gcc/Overall-Options.html, it seems `.s` should be treated as `-x assembler`, but it seems the driver treats `.s` as `-x assembler-with-cpp`.

Steps to reproduce:

touch empty.s
clang -### empty.s

The output contains "-x" "assembler-with-cpp".

llvmbot avatar Nov 02 '23 00:11 llvmbot

% clang '-###' a.s |& grep -o assembler-with-cpp  # no output
% clang '-###' a.S |& grep -o assembler-with-cpp
assembler-with-cpp

MaskRay avatar Nov 02 '23 07:11 MaskRay

Interesting. I'm on an arm64 Mac and does see this output.

% clang '-###' a.s 2>&1 | grep -o assembler-with-cpp assembler-with-cpp

I tested with main: a0eb6b88f9af9ea51bf5cadcb4c223f3d235ed57

rapidsna avatar Nov 02 '23 16:11 rapidsna