diff options
author | Brad King <brad.king@kitware.com> | 2016-04-18 17:45:44 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2016-04-18 18:11:19 (GMT) |
commit | 919b87c0172b4e623feb6870983152f3be0b2748 (patch) | |
tree | c459d3087066602174db14caca89482875beb4e6 /src | |
parent | 917c646ed9e29ca57fd53791a9b3f5f97e86d8b9 (diff) | |
download | CastXML-919b87c0172b4e623feb6870983152f3be0b2748.zip CastXML-919b87c0172b4e623feb6870983152f3be0b2748.tar.gz CastXML-919b87c0172b4e623feb6870983152f3be0b2748.tar.bz2 |
RunClang: Provide `__is_assignable` builtin when simulating MSVC >= 1900
Visual Studio 2015 Update 2 (cl 19.00.23918) added an `__is_assignable`
builtin. It also started using the builtin in the `<type_traits>`
header. Clang as of version 3.8 does not support this builtin so
CastXML cannot parse it. Work around this problem by adding our own
implementation of the builtin.
Diffstat (limited to 'src')
-rw-r--r-- | src/RunClang.cxx | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/RunClang.cxx b/src/RunClang.cxx index 515cf4f..0301388 100644 --- a/src/RunClang.cxx +++ b/src/RunClang.cxx @@ -222,6 +222,24 @@ protected: } } + // Provide __is_assignable builtin if simulating MSVC. + // When a future Clang version supports the builtin then + // we can skip this when built against such a Clang. + if (CI.getLangOpts().MSCompatibilityVersion >= 190000000 && + CI.getLangOpts().CPlusPlus11) { + builtins += "\n" + "template <typename T> T&& __castxml__declval() noexcept;\n" + "template <typename To, typename Fr, typename =\n" + " decltype(__castxml__declval<To>() = __castxml__declval<Fr>())>\n" + " static char (&__castxml__is_assignable_check(int))[1];\n" + "template <typename, typename>\n" + " static char (&__castxml__is_assignable_check(...))[2];\n" + "#define __is_assignable(_To,_Fr) \\\n" + " (sizeof(__castxml__is_assignable_check<_To,_Fr>(0)) == \\\n" + " sizeof(char(&)[1]))\n" + ; + } + // Prevent glibc use of a GNU extension not implemented by Clang. if (this->NeedNoMathInlines(this->Opts.Predefines)) { builtins += "\n" |