I was working on CUDA support for clangd, and I've found that clangd is missing support for auxiliary triple specification. Thus, if we try making clangd work with CUDA or other languages that requires auxiliary triple, it will produce some wrong results.
After some investigation of what clang actually did, I borrowed some code from clang/lib/Frontend/CompilerInstance.cpp to make clangd work as well.
I don't know whether this fix is reasonable or not, but it just fix something looks like a problem in clangd.
Though this file is in clang, clangd use this function to prepare preamble in Preamble.cpp, and I think it is OK to add support for auxiliary triple here.