Apple shows the following LLVM version. But the last LLVM version is
just 9. I don't know where 10 comes from. Does Apple use a different
version number system? Thanks.
$ /Library/Developer/CommandLineTools/usr/bin/clang --version
Apple LLVM version 10.0.0 (clang-1000.10.44.4)
Thread model: posix
Yes, Apple uses a different version system. I think their version number follows the Xcode version number.
How do I know the upstream LLVM version number?
AFAIK, there is none. It's their custom fork based on some indeterminate clang revision (rarely corresponding to an official release) which may also have some libc and clang/c++ features arbitrarily disabled (like TLS, or variant/optional).
Xcode10.1’s LLVM is based off LLVM upstream 6.0.1, there was a mostly accurate version matching scheme in Xcode’s Wikipedia page, you might consider checking that out
For legacy versions which AAPL open-sourced its code-base, the upstream version number could be deducted from the code. For later versions which shipped with code, you can just read the corresponding Swift Compiler’s LLVM Library source code to deduct the LLVM upstream version for that release.
As far as I can tell, that is.