<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/56408>56408</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            [CUDA] '-x cuda' option can only take effect when it appears before input file
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          Peter9606
      </td>
    </tr>
</table>

<pre>
    suppose we have a simplest cuda file, named `test.cc` like following:
```
__global__ void t(char* o) {
    o[threadIdx.x] = 'a';
}
int main() {
    t<<<1, 1>>>(nullptr);
    return 0;
}
```

If we issue `clang++ -x cuda test.cc`, it will success, but if `clang++ test.cc -x cuda`, compiler will complain unrecognized language. Is this a bug or just as design ?
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJxlUk1zozAM_TXmoinjmCSEA4ek2c70tpc9Z4wR4NaxGX807f76lSHdzrSMDBaynvWe1Ln-ow1pnl1AuCFM8g1BQtDX2WCIoFIvYdAGmXgEK6_YA9vzSKFSKdqB0a8IgzPG3bQdWXVk_Mz4kUJ3W9zLZTSuk-ZygTene4hMHNQkPRNHcEw0wOrTehLocWx3ipNH2T_37-U7252BVbRELWmx6n6U1ed1o22Eq9SWQH9gRVY9rrbJFDas-nU3cbDJmDlSEc1_zJziMSZvgf-86Bur9f08ZOF0CAmzNspI0kGcyODhfRXwS69cg45w08ZASEphCPlXlyLo4Xv6Pe0T5p6u3HWmhvgVJHuGuEOyHpUbrf5LPcogSY5YwnOAOOlAPe3SCM7DS6K2ygA9Bj1aEvap6Nuqb6pGFlFHgy2p__jnfFxkF_Xn5aIGN0ftLChpwVnzAVFS73EYUBGjCW1mJucZpQ_Q4eA8yWJnopYHqEjetFOMc8hDIp7IRh2n1JVEgRxj3j4_D7N3LwRK7iIrSfS022_5oZharg4NdrUaeLOrD3yoxNDwrZS7ruK7TlSFkR2akEkwISze1s7QnvgUuhVcCF7z_UaIbbUphTwMQ42VEMh7IRu25UijZMpcR-n8WPh2KYnUCxQ0OsTwFZQhi4iLZhlfpjg53_7GiL7Z832xXN4uxf8D8KkIxw">