forked from qt-creator/qt-creator
Don't remove __cplusplus
For the indexing we need all tool chain macros. Originally it was a fix because the C++ version of the project part and __cplusplus could be different but now they should be the same. They will be now removed in the compiler options builder. Change-Id: I7ae8721a29632473e76ecedb411a6c9001e5e199 Task-number: QTCREATORBUG-21265 Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
This commit is contained in:
@@ -70,6 +70,7 @@ public:
|
||||
: CompilerOptionsBuilder(projectPart,
|
||||
UseSystemHeader::No,
|
||||
CppTools::SkipBuiltIn::No,
|
||||
CppTools::SkipLanguageDefines::Yes,
|
||||
QString(CLANG_VERSION),
|
||||
QString(CLANG_RESOURCE_DIR))
|
||||
{
|
||||
|
@@ -194,6 +194,7 @@ static AnalyzeUnits toAnalyzeUnits(const FileInfos &fileInfos)
|
||||
CompilerOptionsBuilder optionsBuilder(*fileInfo.projectPart,
|
||||
CppTools::UseSystemHeader::No,
|
||||
CppTools::SkipBuiltIn::No,
|
||||
CppTools::SkipLanguageDefines::Yes,
|
||||
QString(CLANG_VERSION),
|
||||
QString(CLANG_RESOURCE_DIR));
|
||||
QStringList arguments = extraClangToolsPrependOptions();
|
||||
|
@@ -44,13 +44,15 @@ namespace CppTools {
|
||||
CompilerOptionsBuilder::CompilerOptionsBuilder(const ProjectPart &projectPart,
|
||||
UseSystemHeader useSystemHeader,
|
||||
SkipBuiltIn skipBuiltInHeaderPathsAndDefines,
|
||||
SkipLanguageDefines skipLanguageDefines,
|
||||
QString clangVersion,
|
||||
QString clangResourceDirectory)
|
||||
: m_projectPart(projectPart)
|
||||
, m_useSystemHeader(useSystemHeader)
|
||||
, m_clangVersion(clangVersion)
|
||||
, m_clangResourceDirectory(clangResourceDirectory)
|
||||
, m_useSystemHeader(useSystemHeader)
|
||||
, m_skipBuiltInHeaderPathsAndDefines(skipBuiltInHeaderPathsAndDefines)
|
||||
, m_skipLanguageDefines(skipLanguageDefines)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -601,8 +603,18 @@ bool CompilerOptionsBuilder::excludeDefineDirective(const ProjectExplorer::Macro
|
||||
{
|
||||
// Avoid setting __cplusplus & co as this might conflict with other command line flags.
|
||||
// Clang should set __cplusplus based on -std= and -fms-compatibility-version version.
|
||||
QTC_ASSERT(macro.key != "__cplusplus", return true);
|
||||
QTC_ASSERT(macro.key != "__STDC_VERSION__", return true);
|
||||
static const auto languageDefines = {"__cplusplus",
|
||||
"__STDC_VERSION__",
|
||||
"_MSC_BUILD",
|
||||
"_MSVC_LANG",
|
||||
"_MSC_FULL_VER",
|
||||
"_MSC_VER"};
|
||||
if (m_skipLanguageDefines == SkipLanguageDefines::Yes
|
||||
&& std::find(languageDefines.begin(),
|
||||
languageDefines.end(),
|
||||
macro.key) != languageDefines.end()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Ignore for all compiler toolchains since LLVM has it's own implementation for
|
||||
// __has_include(STR) and __has_include_next(STR)
|
||||
|
@@ -31,13 +31,19 @@
|
||||
|
||||
namespace CppTools {
|
||||
|
||||
enum class UseSystemHeader
|
||||
enum class UseSystemHeader : char
|
||||
{
|
||||
Yes,
|
||||
No
|
||||
};
|
||||
|
||||
enum class SkipBuiltIn
|
||||
enum class SkipBuiltIn : char
|
||||
{
|
||||
Yes,
|
||||
No
|
||||
};
|
||||
|
||||
enum class SkipLanguageDefines : char
|
||||
{
|
||||
Yes,
|
||||
No
|
||||
@@ -54,6 +60,7 @@ public:
|
||||
CompilerOptionsBuilder(const ProjectPart &projectPart,
|
||||
UseSystemHeader useSystemHeader = UseSystemHeader::No,
|
||||
SkipBuiltIn skipBuiltInHeaderPathsAndDefines = SkipBuiltIn::No,
|
||||
SkipLanguageDefines skipLanguageDefines = SkipLanguageDefines::Yes,
|
||||
QString clangVersion = QString(),
|
||||
QString clangResourceDirectory = QString());
|
||||
|
||||
@@ -107,12 +114,13 @@ private:
|
||||
void addWrappedQtHeadersIncludePath(QStringList &list);
|
||||
|
||||
QStringList m_options;
|
||||
UseSystemHeader m_useSystemHeader;
|
||||
|
||||
QString m_clangVersion;
|
||||
QString m_clangResourceDirectory;
|
||||
|
||||
UseSystemHeader m_useSystemHeader;
|
||||
SkipBuiltIn m_skipBuiltInHeaderPathsAndDefines;
|
||||
SkipLanguageDefines m_skipLanguageDefines;
|
||||
};
|
||||
|
||||
} // namespace CppTools
|
||||
|
@@ -158,12 +158,6 @@ bool static hasFlagEffectOnMacros(const QString &flag)
|
||||
return true;
|
||||
}
|
||||
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QVector<QByteArray>, unwantedMacrosMsvc,
|
||||
({"_MSVC_LANG",
|
||||
"_MSC_BUILD",
|
||||
"_MSC_FULL_VER",
|
||||
"_MSC_VER"}))
|
||||
|
||||
ToolChain::MacroInspectionRunner AbstractMsvcToolChain::createMacroInspectionRunner() const
|
||||
{
|
||||
Utils::Environment env(m_lastEnvironment);
|
||||
@@ -182,11 +176,8 @@ ToolChain::MacroInspectionRunner AbstractMsvcToolChain::createMacroInspectionRun
|
||||
return cachedMacros.value();
|
||||
|
||||
const Macros macros = msvcPredefinedMacros(filteredFlags, env);
|
||||
const QVector<Macro> filteredMacros = Utils::filtered(macros, [](const Macro &m) {
|
||||
return !ToolChain::isUnwantedMacro(m) && !unwantedMacrosMsvc->contains(m.key);
|
||||
});
|
||||
|
||||
const auto report = MacroInspectionReport{filteredMacros,
|
||||
const auto report = MacroInspectionReport{macros,
|
||||
languageVersionForMsvc(lang, macros)};
|
||||
macroCache->insert(filteredFlags, report);
|
||||
|
||||
|
@@ -441,16 +441,13 @@ ToolChain::MacroInspectionRunner GccToolChain::createMacroInspectionRunner() con
|
||||
const Macros macros = gccPredefinedMacros(findLocalCompiler(compilerCommand, env),
|
||||
arguments,
|
||||
env.toStringList());
|
||||
const QVector<Macro> filteredMacros = Utils::filtered(macros, [](const Macro &m) {
|
||||
return !isUnwantedMacro(m);
|
||||
});
|
||||
|
||||
const auto report = MacroInspectionReport{filteredMacros, languageVersion(lang, macros)};
|
||||
const auto report = MacroInspectionReport{macros, languageVersion(lang, macros)};
|
||||
macroCache->insert(arguments, report);
|
||||
|
||||
qCDebug(gccLog) << "MacroInspectionReport for code model:";
|
||||
qCDebug(gccLog) << "Language version:" << static_cast<int>(report.languageVersion);
|
||||
for (const Macro &m : filteredMacros) {
|
||||
for (const Macro &m : macros) {
|
||||
qCDebug(gccLog) << compilerCommand.toUserOutput()
|
||||
<< (lang == Constants::CXX_LANGUAGE_ID ? ": C++ [" : ": C [")
|
||||
<< arguments.join(", ") << "]"
|
||||
|
@@ -345,14 +345,6 @@ LanguageVersion ToolChain::languageVersion(const Core::Id &language, const Macro
|
||||
}
|
||||
}
|
||||
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QVector<QByteArray>, unwantedMacros,
|
||||
({"__cplusplus", "__STDC_VERSION__"}))
|
||||
|
||||
bool ToolChain::isUnwantedMacro(const Macro ¯o)
|
||||
{
|
||||
return unwantedMacros->contains(macro.key);
|
||||
}
|
||||
|
||||
/*!
|
||||
Used by the tool chain kit information to validate the kit.
|
||||
*/
|
||||
|
@@ -151,7 +151,6 @@ public:
|
||||
void setLanguage(Core::Id language);
|
||||
static LanguageVersion cxxLanguageVersion(const QByteArray &cplusplusMacroValue);
|
||||
static LanguageVersion languageVersion(const Core::Id &language, const Macros ¯os);
|
||||
static bool isUnwantedMacro(const Macro ¯o);
|
||||
|
||||
protected:
|
||||
explicit ToolChain(Core::Id typeId, Detection d);
|
||||
|
@@ -43,8 +43,9 @@ MATCHER_P(IsPartOfHeader, headerPart, std::string(negation ? "isn't " : "is ") +
|
||||
{
|
||||
return arg.contains(QString::fromStdString(headerPart));
|
||||
}
|
||||
namespace {
|
||||
|
||||
class CompilerOptionsBuilderTest : public ::testing::Test
|
||||
class CompilerOptionsBuilder : public ::testing::Test
|
||||
{
|
||||
protected:
|
||||
void SetUp() final
|
||||
@@ -57,7 +58,13 @@ protected:
|
||||
projectPart.extraCodeModelFlags = QStringList{"-arch", "x86_64"};
|
||||
|
||||
projectPart.precompiledHeaders = QStringList{TESTDATA_DIR "/compileroptionsbuilder.pch"};
|
||||
projectPart.toolChainMacros = {ProjectExplorer::Macro{"foo", "bar"}};
|
||||
projectPart.toolChainMacros = {ProjectExplorer::Macro{"foo", "bar"},
|
||||
ProjectExplorer::Macro{"__cplusplus", "2"},
|
||||
ProjectExplorer::Macro{"__STDC_VERSION__", "2"},
|
||||
ProjectExplorer::Macro{"_MSVC_LANG", "2"},
|
||||
ProjectExplorer::Macro{"_MSC_BUILD", "2"},
|
||||
ProjectExplorer::Macro{"_MSC_FULL_VER", "1900"},
|
||||
ProjectExplorer::Macro{"_MSC_VER", "19"}};
|
||||
projectPart.projectMacros = {ProjectExplorer::Macro{"projectFoo", "projectBar"}};
|
||||
projectPart.qtVersion = ProjectPart::Qt5;
|
||||
|
||||
@@ -68,31 +75,51 @@ protected:
|
||||
|
||||
std::unique_ptr<Project> project{std::make_unique<ProjectExplorer::Project>()};
|
||||
ProjectPart projectPart;
|
||||
CompilerOptionsBuilder compilerOptionsBuilder{projectPart};
|
||||
CppTools::CompilerOptionsBuilder compilerOptionsBuilder{projectPart};
|
||||
};
|
||||
|
||||
TEST_F(CompilerOptionsBuilderTest, AddToolchainAndProjectMacros)
|
||||
TEST_F(CompilerOptionsBuilder, AddToolchainAndProjectMacros)
|
||||
{
|
||||
compilerOptionsBuilder.addToolchainAndProjectMacros();
|
||||
|
||||
ASSERT_THAT(compilerOptionsBuilder.options(), ElementsAre("-Dfoo=bar", "-DprojectFoo=projectBar"));
|
||||
}
|
||||
|
||||
TEST_F(CompilerOptionsBuilderTest, AddWordWidth)
|
||||
TEST_F(CompilerOptionsBuilder, AddToolchainAndProjectMacrosWithoutSkipingLanguageDefines)
|
||||
{
|
||||
CppTools::CompilerOptionsBuilder compilerOptionsBuilder{projectPart,
|
||||
CppTools::UseSystemHeader::No,
|
||||
CppTools::SkipBuiltIn::No,
|
||||
CppTools:: SkipLanguageDefines::No};
|
||||
|
||||
compilerOptionsBuilder.addToolchainAndProjectMacros();
|
||||
|
||||
ASSERT_THAT(compilerOptionsBuilder.options(),
|
||||
ElementsAre("-Dfoo=bar",
|
||||
"-D__cplusplus=2",
|
||||
"-D__STDC_VERSION__=2",
|
||||
"-D_MSVC_LANG=2",
|
||||
"-D_MSC_BUILD=2",
|
||||
"-D_MSC_FULL_VER=1900",
|
||||
"-D_MSC_VER=19",
|
||||
"-DprojectFoo=projectBar"));
|
||||
}
|
||||
|
||||
TEST_F(CompilerOptionsBuilder, AddWordWidth)
|
||||
{
|
||||
compilerOptionsBuilder.addWordWidth();
|
||||
|
||||
ASSERT_THAT(compilerOptionsBuilder.options(), ElementsAre("-m64"));
|
||||
}
|
||||
|
||||
TEST_F(CompilerOptionsBuilderTest, AddToolchainFlags)
|
||||
TEST_F(CompilerOptionsBuilder, AddToolchainFlags)
|
||||
{
|
||||
compilerOptionsBuilder.addToolchainFlags();
|
||||
|
||||
ASSERT_THAT(compilerOptionsBuilder.options(), ElementsAre("-undef"));
|
||||
}
|
||||
|
||||
TEST_F(CompilerOptionsBuilderTest, HeaderPathOptionsOrder)
|
||||
TEST_F(CompilerOptionsBuilder, HeaderPathOptionsOrder)
|
||||
{
|
||||
compilerOptionsBuilder.addHeaderPathOptions();
|
||||
|
||||
@@ -103,9 +130,9 @@ TEST_F(CompilerOptionsBuilderTest, HeaderPathOptionsOrder)
|
||||
"-isystem", QDir::toNativeSeparators("/tmp/builtin_path")));
|
||||
}
|
||||
|
||||
TEST_F(CompilerOptionsBuilderTest, UseSystemHeader)
|
||||
TEST_F(CompilerOptionsBuilder, UseSystemHeader)
|
||||
{
|
||||
CompilerOptionsBuilder compilerOptionsBuilder(projectPart, CppTools::UseSystemHeader::Yes);
|
||||
CppTools::CompilerOptionsBuilder compilerOptionsBuilder(projectPart, CppTools::UseSystemHeader::Yes);
|
||||
|
||||
compilerOptionsBuilder.addHeaderPathOptions();
|
||||
|
||||
@@ -116,13 +143,14 @@ TEST_F(CompilerOptionsBuilderTest, UseSystemHeader)
|
||||
"-isystem", QDir::toNativeSeparators("/tmp/builtin_path")));
|
||||
}
|
||||
|
||||
TEST_F(CompilerOptionsBuilderTest, ClangHeadersPath)
|
||||
TEST_F(CompilerOptionsBuilder, ClangHeadersPath)
|
||||
{
|
||||
CompilerOptionsBuilder compilerOptionsBuilder(projectPart,
|
||||
CppTools::UseSystemHeader::No,
|
||||
CppTools::SkipBuiltIn::No,
|
||||
"7.0.0",
|
||||
"");
|
||||
CppTools::CompilerOptionsBuilder compilerOptionsBuilder(projectPart,
|
||||
CppTools::UseSystemHeader::No,
|
||||
CppTools::SkipBuiltIn::No,
|
||||
CppTools::SkipLanguageDefines::Yes,
|
||||
"7.0.0",
|
||||
"");
|
||||
|
||||
compilerOptionsBuilder.addHeaderPathOptions();
|
||||
|
||||
@@ -135,7 +163,7 @@ TEST_F(CompilerOptionsBuilderTest, ClangHeadersPath)
|
||||
"-isystem", QDir::toNativeSeparators("/tmp/builtin_path")));
|
||||
}
|
||||
|
||||
TEST_F(CompilerOptionsBuilderTest, ClangHeadersAndCppIncludesPathsOrderMacOs)
|
||||
TEST_F(CompilerOptionsBuilder, ClangHeadersAndCppIncludesPathsOrderMacOs)
|
||||
{
|
||||
auto defaultPaths = projectPart.headerPaths;
|
||||
projectPart.headerPaths = {HeaderPath{"/usr/include/c++/4.2.1", HeaderPathType::BuiltIn},
|
||||
@@ -146,11 +174,12 @@ TEST_F(CompilerOptionsBuilderTest, ClangHeadersAndCppIncludesPathsOrderMacOs)
|
||||
HeaderPath{"/usr/include", HeaderPathType::BuiltIn}
|
||||
};
|
||||
projectPart.headerPaths.append(defaultPaths);
|
||||
CompilerOptionsBuilder compilerOptionsBuilder(projectPart,
|
||||
CppTools::UseSystemHeader::No,
|
||||
CppTools::SkipBuiltIn::No,
|
||||
"7.0.0",
|
||||
"");
|
||||
CppTools::CompilerOptionsBuilder compilerOptionsBuilder(projectPart,
|
||||
CppTools::UseSystemHeader::No,
|
||||
CppTools::SkipBuiltIn::No,
|
||||
CppTools::SkipLanguageDefines::Yes,
|
||||
"7.0.0",
|
||||
"");
|
||||
|
||||
compilerOptionsBuilder.addHeaderPathOptions();
|
||||
|
||||
@@ -168,7 +197,7 @@ TEST_F(CompilerOptionsBuilderTest, ClangHeadersAndCppIncludesPathsOrderMacOs)
|
||||
"-isystem", QDir::toNativeSeparators("/tmp/builtin_path")));
|
||||
}
|
||||
|
||||
TEST_F(CompilerOptionsBuilderTest, ClangHeadersAndCppIncludesPathsOrderLinux)
|
||||
TEST_F(CompilerOptionsBuilder, ClangHeadersAndCppIncludesPathsOrderLinux)
|
||||
{
|
||||
projectPart.headerPaths = {HeaderPath{"/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8", HeaderPathType::BuiltIn},
|
||||
HeaderPath{"/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/backward", HeaderPathType::BuiltIn},
|
||||
@@ -179,11 +208,12 @@ TEST_F(CompilerOptionsBuilderTest, ClangHeadersAndCppIncludesPathsOrderLinux)
|
||||
HeaderPath{"/usr/include", HeaderPathType::BuiltIn}
|
||||
};
|
||||
projectPart.toolChainTargetTriple = "x86_64-linux-gnu";
|
||||
CompilerOptionsBuilder compilerOptionsBuilder(projectPart,
|
||||
CppTools::UseSystemHeader::No,
|
||||
CppTools::SkipBuiltIn::No,
|
||||
"7.0.0",
|
||||
"");
|
||||
CppTools::CompilerOptionsBuilder compilerOptionsBuilder(projectPart,
|
||||
CppTools::UseSystemHeader::No,
|
||||
CppTools::SkipBuiltIn::No,
|
||||
CppTools::SkipLanguageDefines::Yes,
|
||||
"7.0.0",
|
||||
"");
|
||||
|
||||
compilerOptionsBuilder.addHeaderPathOptions();
|
||||
|
||||
@@ -200,36 +230,36 @@ TEST_F(CompilerOptionsBuilderTest, ClangHeadersAndCppIncludesPathsOrderLinux)
|
||||
"-isystem", QDir::toNativeSeparators("/usr/include")));
|
||||
}
|
||||
|
||||
TEST_F(CompilerOptionsBuilderTest, NoPrecompiledHeader)
|
||||
TEST_F(CompilerOptionsBuilder, NoPrecompiledHeader)
|
||||
{
|
||||
compilerOptionsBuilder.addPrecompiledHeaderOptions(CompilerOptionsBuilder::PchUsage::None);
|
||||
compilerOptionsBuilder.addPrecompiledHeaderOptions(CppTools::CompilerOptionsBuilder::PchUsage::None);
|
||||
|
||||
ASSERT_THAT(compilerOptionsBuilder.options().empty(), true);
|
||||
}
|
||||
|
||||
TEST_F(CompilerOptionsBuilderTest, UsePrecompiledHeader)
|
||||
TEST_F(CompilerOptionsBuilder, UsePrecompiledHeader)
|
||||
{
|
||||
compilerOptionsBuilder.addPrecompiledHeaderOptions(CompilerOptionsBuilder::PchUsage::Use);
|
||||
compilerOptionsBuilder.addPrecompiledHeaderOptions(CppTools::CompilerOptionsBuilder::PchUsage::Use);
|
||||
|
||||
ASSERT_THAT(compilerOptionsBuilder.options(),
|
||||
ElementsAre("-include", QDir::toNativeSeparators(TESTDATA_DIR "/compileroptionsbuilder.pch")));
|
||||
}
|
||||
|
||||
TEST_F(CompilerOptionsBuilderTest, AddMacros)
|
||||
TEST_F(CompilerOptionsBuilder, AddMacros)
|
||||
{
|
||||
compilerOptionsBuilder.addMacros(ProjectExplorer::Macros{ProjectExplorer::Macro{"key", "value"}});
|
||||
|
||||
ASSERT_THAT(compilerOptionsBuilder.options(), ElementsAre("-Dkey=value"));
|
||||
}
|
||||
|
||||
TEST_F(CompilerOptionsBuilderTest, AddTargetTriple)
|
||||
TEST_F(CompilerOptionsBuilder, AddTargetTriple)
|
||||
{
|
||||
compilerOptionsBuilder.addTargetTriple();
|
||||
|
||||
ASSERT_THAT(compilerOptionsBuilder.options(), ElementsAre("-target", "x86_64-apple-darwin10"));
|
||||
}
|
||||
|
||||
TEST_F(CompilerOptionsBuilderTest, EnableCExceptions)
|
||||
TEST_F(CompilerOptionsBuilder, EnableCExceptions)
|
||||
{
|
||||
projectPart.languageVersion = ProjectExplorer::LanguageVersion::C99;
|
||||
|
||||
@@ -238,28 +268,28 @@ TEST_F(CompilerOptionsBuilderTest, EnableCExceptions)
|
||||
ASSERT_THAT(compilerOptionsBuilder.options(), ElementsAre("-fexceptions"));
|
||||
}
|
||||
|
||||
TEST_F(CompilerOptionsBuilderTest, EnableCXXExceptions)
|
||||
TEST_F(CompilerOptionsBuilder, EnableCXXExceptions)
|
||||
{
|
||||
compilerOptionsBuilder.enableExceptions();
|
||||
|
||||
ASSERT_THAT(compilerOptionsBuilder.options(), ElementsAre("-fcxx-exceptions", "-fexceptions"));
|
||||
}
|
||||
|
||||
TEST_F(CompilerOptionsBuilderTest, InsertWrappedQtHeaders)
|
||||
TEST_F(CompilerOptionsBuilder, InsertWrappedQtHeaders)
|
||||
{
|
||||
compilerOptionsBuilder.insertWrappedQtHeaders();
|
||||
|
||||
ASSERT_THAT(compilerOptionsBuilder.options(), Contains(IsPartOfHeader("wrappedQtHeaders")));
|
||||
}
|
||||
|
||||
TEST_F(CompilerOptionsBuilderTest, SetLanguageVersion)
|
||||
TEST_F(CompilerOptionsBuilder, SetLanguageVersion)
|
||||
{
|
||||
compilerOptionsBuilder.updateLanguageOption(ProjectFile::CXXSource);
|
||||
|
||||
ASSERT_THAT(compilerOptionsBuilder.options(), ElementsAre("-x", "c++"));
|
||||
}
|
||||
|
||||
TEST_F(CompilerOptionsBuilderTest, HandleLanguageExtension)
|
||||
TEST_F(CompilerOptionsBuilder, HandleLanguageExtension)
|
||||
{
|
||||
projectPart.languageExtensions = ProjectExplorer::LanguageExtension::ObjectiveC;
|
||||
|
||||
@@ -268,7 +298,7 @@ TEST_F(CompilerOptionsBuilderTest, HandleLanguageExtension)
|
||||
ASSERT_THAT(compilerOptionsBuilder.options(), ElementsAre("-x", "objective-c++"));
|
||||
}
|
||||
|
||||
TEST_F(CompilerOptionsBuilderTest, UpdateLanguageVersion)
|
||||
TEST_F(CompilerOptionsBuilder, UpdateLanguageVersion)
|
||||
{
|
||||
compilerOptionsBuilder.updateLanguageOption(ProjectFile::CXXSource);
|
||||
|
||||
@@ -277,7 +307,7 @@ TEST_F(CompilerOptionsBuilderTest, UpdateLanguageVersion)
|
||||
ASSERT_THAT(compilerOptionsBuilder.options(), ElementsAre("-x", "c++-header"));
|
||||
}
|
||||
|
||||
TEST_F(CompilerOptionsBuilderTest, AddMsvcCompatibilityVersion)
|
||||
TEST_F(CompilerOptionsBuilder, AddMsvcCompatibilityVersion)
|
||||
{
|
||||
projectPart.toolchainType = ProjectExplorer::Constants::MSVC_TOOLCHAIN_TYPEID;
|
||||
projectPart.toolChainMacros.append(ProjectExplorer::Macro{"_MSC_FULL_VER", "190000000"});
|
||||
@@ -287,7 +317,7 @@ TEST_F(CompilerOptionsBuilderTest, AddMsvcCompatibilityVersion)
|
||||
ASSERT_THAT(compilerOptionsBuilder.options(), ElementsAre("-fms-compatibility-version=19.00"));
|
||||
}
|
||||
|
||||
TEST_F(CompilerOptionsBuilderTest, UndefineCppLanguageFeatureMacrosForMsvc2015)
|
||||
TEST_F(CompilerOptionsBuilder, UndefineCppLanguageFeatureMacrosForMsvc2015)
|
||||
{
|
||||
projectPart.toolchainType = ProjectExplorer::Constants::MSVC_TOOLCHAIN_TYPEID;
|
||||
projectPart.isMsvc2015Toolchain = true;
|
||||
@@ -297,7 +327,7 @@ TEST_F(CompilerOptionsBuilderTest, UndefineCppLanguageFeatureMacrosForMsvc2015)
|
||||
ASSERT_THAT(compilerOptionsBuilder.options(), Contains(QString{"-U__cpp_aggregate_bases"}));
|
||||
}
|
||||
|
||||
TEST_F(CompilerOptionsBuilderTest, AddDefineFunctionMacrosMsvc)
|
||||
TEST_F(CompilerOptionsBuilder, AddDefineFunctionMacrosMsvc)
|
||||
{
|
||||
projectPart.toolchainType = ProjectExplorer::Constants::MSVC_TOOLCHAIN_TYPEID;
|
||||
|
||||
@@ -306,7 +336,7 @@ TEST_F(CompilerOptionsBuilderTest, AddDefineFunctionMacrosMsvc)
|
||||
ASSERT_THAT(compilerOptionsBuilder.options(), Contains(QString{"-D__FUNCTION__=\"\""}));
|
||||
}
|
||||
|
||||
TEST_F(CompilerOptionsBuilderTest, AddProjectConfigFileInclude)
|
||||
TEST_F(CompilerOptionsBuilder, AddProjectConfigFileInclude)
|
||||
{
|
||||
projectPart.projectConfigFile = "dummy_file.h";
|
||||
|
||||
@@ -315,7 +345,7 @@ TEST_F(CompilerOptionsBuilderTest, AddProjectConfigFileInclude)
|
||||
ASSERT_THAT(compilerOptionsBuilder.options(), ElementsAre("-include", "dummy_file.h"));
|
||||
}
|
||||
|
||||
TEST_F(CompilerOptionsBuilderTest, UndefineClangVersionMacrosForMsvc)
|
||||
TEST_F(CompilerOptionsBuilder, UndefineClangVersionMacrosForMsvc)
|
||||
{
|
||||
projectPart.toolchainType = ProjectExplorer::Constants::MSVC_TOOLCHAIN_TYPEID;
|
||||
|
||||
@@ -324,9 +354,9 @@ TEST_F(CompilerOptionsBuilderTest, UndefineClangVersionMacrosForMsvc)
|
||||
ASSERT_THAT(compilerOptionsBuilder.options(), Contains(QString{"-U__clang__"}));
|
||||
}
|
||||
|
||||
TEST_F(CompilerOptionsBuilderTest, BuildAllOptions)
|
||||
TEST_F(CompilerOptionsBuilder, BuildAllOptions)
|
||||
{
|
||||
compilerOptionsBuilder.build(ProjectFile::CXXSource, CompilerOptionsBuilder::PchUsage::None);
|
||||
compilerOptionsBuilder.build(ProjectFile::CXXSource, CppTools::CompilerOptionsBuilder::PchUsage::None);
|
||||
|
||||
ASSERT_THAT(compilerOptionsBuilder.options(),
|
||||
ElementsAre(
|
||||
@@ -341,3 +371,4 @@ TEST_F(CompilerOptionsBuilderTest, BuildAllOptions)
|
||||
));
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user