From 12dce3ef7ddf5a53d90a794a4645dea13a67f2bb Mon Sep 17 00:00:00 2001 From: Nikolai Kosjar Date: Thu, 29 Nov 2018 09:30:27 +0100 Subject: Clang: Work around eating memory with gcc/clang/-fno-rtti/boost Boost recognizes a misconfigured compiler in rtti emulation mode (-fno-rtti) as our libclang command line is special. Even worse, it does not seem to stop instantiating templates and allocating memory afterwards. For the former to fix, we need to rework our command line (in master). The latter can be work arounded by defining BOOST_TYPE_INDEX_CTTI_USER_DEFINED_PARSING with a value for gcc/clang. See also https://www.boost.org/doc/libs/1_64_0/doc/html/BOOST_TYPE_INDEX_CTTI_USER_DEFINED_PARSING.html Task-number: QTCREATORBUG-19543 Change-Id: Iddb5be2d1f1966018e5ab535a8f7475fe7911284 Reviewed-by: Ivan Donchevskii --- src/plugins/cpptools/compileroptionsbuilder.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/plugins/cpptools/compileroptionsbuilder.cpp') diff --git a/src/plugins/cpptools/compileroptionsbuilder.cpp b/src/plugins/cpptools/compileroptionsbuilder.cpp index 1529cb445f..085e6fe132 100644 --- a/src/plugins/cpptools/compileroptionsbuilder.cpp +++ b/src/plugins/cpptools/compileroptionsbuilder.cpp @@ -84,6 +84,7 @@ QStringList CompilerOptionsBuilder::build(CppTools::ProjectFile::Kind fileKind, undefineClangVersionMacrosForMsvc(); undefineCppLanguageFeatureMacrosForMsvc2015(); addDefineFunctionMacrosMsvc(); + addBoostWorkaroundMacros(); addToolchainFlags(); addPrecompiledHeaderOptions(pchUsage); @@ -560,6 +561,14 @@ void CompilerOptionsBuilder::addDefineFunctionMacrosMsvc() addMacros({{"__FUNCSIG__", "\"\""}, {"__FUNCTION__", "\"\""}, {"__FUNCDNAME__", "\"\""}}); } +void CompilerOptionsBuilder::addBoostWorkaroundMacros() +{ + if (m_projectPart.toolchainType != ProjectExplorer::Constants::MSVC_TOOLCHAIN_TYPEID + && m_projectPart.toolchainType != ProjectExplorer::Constants::CLANG_CL_TOOLCHAIN_TYPEID) { + addMacros({{"BOOST_TYPE_INDEX_CTTI_USER_DEFINED_PARSING", "(39, 1, true, \"T = \")"}}); + } +} + QString CompilerOptionsBuilder::includeDirOptionForPath(const QString &path) const { if (m_useSystemHeader == UseSystemHeader::No -- cgit v1.2.1