This patch implements the __is_target_arch, __is_target_vendor, __is_target_os, and __is_target_environment Clang preprocessor extensions that were proposed by @compnerd in Bob's cfe-dev post: http://lists.llvm.org/pipermail/cfe-dev/2017-November/056166.html.
These macros can be used to examine the components of the target triple at compile time. A`has_builtin(is_target_???)` preprocessor check can be used to check for their availability.
Hmm, the one thing to consider here is the canonicalized vs spelt target. e.g. armv7-windows will map to thumbv7-unknown-windows-msvc.