Clang accepts MSVC arguments and targets Windows if its binary is named clang-cl
github.com
github.com
[1] https://github.com/llvm/llvm-project/blob/8ec28af8eaff5acd0d...
[edit: a lot of the older code involves huge single functions, webkit, etc are similar and I suspect it’s true of most projects. It seems like a fairly standard code evolution pattern: a function is written, and keeps have logic added so it becomes bigger and bigger, until eventually someone adds something where refactoring makes enough sense that the functions are broken up. I wonder if someone has ever just done an analysis of commit history vs function size to see just how common this actually is. Something like “how old vs how recently modified vs function size” - I’m genuinely curious]
The tablegen/macro-gen stuff DID get added at one point fortunately, but before that it was pretty rough as well.
This very interesting behaviour of clang actually comes from several other places as well.
`IsClangCL()` that returns true if the driver mode is "cl": https://github.com/llvm/llvm-project/blob/8ec28af8eaff5acd0d...
`setDriverMode()` which sets the above: https://github.com/llvm/llvm-project/blob/8ec28af8eaff5acd0d...
This line that actually sets the triplet, the object format, etc: https://github.com/llvm/llvm-project/blob/8ec28af8eaff5acd0d...
Notice how `IsClangCL(getDriverMode(ProgName, ...))` is called in this line: https://github.com/llvm/llvm-project/blob/8ec28af8eaff5acd0d...