CppTools: Rollback some changes in CompilerOptionsBuilder

Make it safer in the 4.6 release.

Change-Id: I75857ecc08af8febe40fd75dc94d8ab986d4b768
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
This commit is contained in:
Ivan Donchevskii
2018-05-03 11:08:54 +02:00
parent 0a7d24c730
commit 02f50d5286
2 changed files with 8 additions and 7 deletions

View File

@@ -47,7 +47,6 @@ CompilerOptionsBuilder::CompilerOptionsBuilder(const ProjectPart &projectPart,
: m_projectPart(projectPart)
, m_clangVersion(clangVersion)
, m_clangResourceDirectory(clangResourceDirectory)
, m_languageVersion(m_projectPart.languageVersion)
{
}
@@ -55,8 +54,10 @@ QStringList CompilerOptionsBuilder::build(CppTools::ProjectFile::Kind fileKind,
{
m_options.clear();
if (fileKind == ProjectFile::CHeader || fileKind == ProjectFile::CSource)
QTC_ASSERT(m_languageVersion <= ProjectPart::LatestCVersion, return QStringList(););
if (fileKind == ProjectFile::CHeader || fileKind == ProjectFile::CSource) {
QTC_ASSERT(m_projectPart.languageVersion <= ProjectPart::LatestCVersion,
return QStringList(););
}
addWordWidth();
addTargetTriple();
@@ -123,7 +124,7 @@ void CompilerOptionsBuilder::addExtraCodeModelFlags()
void CompilerOptionsBuilder::enableExceptions()
{
if (m_languageVersion > ProjectPart::LatestCVersion)
if (m_projectPart.languageVersion > ProjectPart::LatestCVersion)
add(QLatin1String("-fcxx-exceptions"));
add(QLatin1String("-fexceptions"));
}
@@ -293,7 +294,7 @@ void CompilerOptionsBuilder::addOptionsForLanguage(bool checkForBorlandExtension
const ProjectPart::LanguageExtensions languageExtensions = m_projectPart.languageExtensions;
const bool gnuExtensions = languageExtensions & ProjectPart::GnuExtensions;
switch (m_languageVersion) {
switch (m_projectPart.languageVersion) {
case ProjectPart::C89:
opts << (gnuExtensions ? QLatin1String("-std=gnu89") : QLatin1String("-std=c89"));
break;
@@ -478,7 +479,8 @@ QString CompilerOptionsBuilder::includeOption() const
bool CompilerOptionsBuilder::excludeDefineDirective(const ProjectExplorer::Macro &macro) const
{
if (macro.key == "__cplusplus" && m_languageVersion <= ProjectPart::LatestCVersion)
// TODO: Remove in QtCreator 4.7
if (macro.key == "__cplusplus")
return true;
// Ignore for all compiler toolchains since LLVM has it's own implementation for

View File

@@ -96,7 +96,6 @@ private:
QStringList m_options;
QString m_clangVersion;
QString m_clangResourceDirectory;
ProjectPart::LanguageVersion m_languageVersion;
};
template<class T>