Revert "Clang: Stop enabling exceptions explicitly"

This reverts commit b114f77d8a as
"--driver-mode=cl" apparently still disables exceptions.

Task-number: QTCREATORBUG-23000
Change-Id: I9c49d971fafda5e1aca8445f8921e50f323d368f
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
This commit is contained in:
Nikolai Kosjar
2019-12-19 11:58:24 +01:00
parent 4fdd944617
commit 26693e8212
3 changed files with 33 additions and 0 deletions

View File

@@ -136,6 +136,7 @@ QStringList CompilerOptionsBuilder::build(ProjectFile::Kind fileKind,
addTargetTriple();
updateFileLanguage(fileKind);
addLanguageVersionAndExtensions();
enableExceptions();
addPrecompiledHeaderOptions(usePrecompiledHeaders);
addProjectConfigFileInclude();
@@ -270,6 +271,17 @@ void CompilerOptionsBuilder::addCompilerFlags()
add(m_compilerFlags.flags);
}
void CompilerOptionsBuilder::enableExceptions()
{
// With "--driver-mode=cl" exceptions are disabled (clang 8).
// This is most likely due to incomplete exception support of clang.
// However, as we need exception support only in the frontend,
// enabling them explicitly should be fine.
if (m_projectPart.languageVersion > ::Utils::LanguageVersion::LatestC)
add("-fcxx-exceptions");
add("-fexceptions");
}
static QString creatorResourcePath()
{
#ifndef UNIT_TESTS