| 
									
										
										
										
											2018-09-26 14:10:35 +02:00
										 |  |  | /****************************************************************************
 | 
					
						
							|  |  |  | ** | 
					
						
							|  |  |  | ** Copyright (C) 2018 The Qt Company Ltd. | 
					
						
							|  |  |  | ** Contact: https://www.qt.io/licensing/
 | 
					
						
							|  |  |  | ** | 
					
						
							|  |  |  | ** This file is part of Qt Creator. | 
					
						
							|  |  |  | ** | 
					
						
							|  |  |  | ** Commercial License Usage | 
					
						
							|  |  |  | ** Licensees holding valid commercial Qt licenses may use this file in | 
					
						
							|  |  |  | ** accordance with the commercial license agreement provided with the | 
					
						
							|  |  |  | ** Software or, alternatively, in accordance with the terms contained in | 
					
						
							|  |  |  | ** a written agreement between you and The Qt Company. For licensing terms | 
					
						
							|  |  |  | ** and conditions see https://www.qt.io/terms-conditions. For further
 | 
					
						
							|  |  |  | ** information use the contact form at https://www.qt.io/contact-us.
 | 
					
						
							|  |  |  | ** | 
					
						
							|  |  |  | ** GNU General Public License Usage | 
					
						
							|  |  |  | ** Alternatively, this file may be used under the terms of the GNU | 
					
						
							|  |  |  | ** General Public License version 3 as published by the Free Software | 
					
						
							|  |  |  | ** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT | 
					
						
							|  |  |  | ** included in the packaging of this file. Please review the following | 
					
						
							|  |  |  | ** information to ensure the GNU General Public License requirements will | 
					
						
							|  |  |  | ** be met: https://www.gnu.org/licenses/gpl-3.0.html.
 | 
					
						
							|  |  |  | ** | 
					
						
							|  |  |  | ****************************************************************************/ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #include "googletest.h"
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #include <cpptools/compileroptionsbuilder.h>
 | 
					
						
							|  |  |  | #include <cpptools/cppprojectfile.h>
 | 
					
						
							|  |  |  | #include <cpptools/projectpart.h>
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #include <projectexplorer/project.h>
 | 
					
						
							|  |  |  | #include <projectexplorer/projectexplorerconstants.h>
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | using CppTools::CompilerOptionsBuilder; | 
					
						
							|  |  |  | using CppTools::ProjectFile; | 
					
						
							|  |  |  | using CppTools::ProjectPart; | 
					
						
							|  |  |  | using ProjectExplorer::HeaderPath; | 
					
						
							|  |  |  | using ProjectExplorer::HeaderPathType; | 
					
						
							|  |  |  | using ProjectExplorer::Project; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | MATCHER_P(IsPartOfHeader, headerPart, std::string(negation ? "isn't " : "is ") + headerPart) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2018-10-09 11:02:22 +02:00
										 |  |  |     return arg.contains(QString::fromStdString(headerPart)); | 
					
						
							| 
									
										
										
										
											2018-09-26 14:10:35 +02:00
										 |  |  | } | 
					
						
							| 
									
										
										
										
											2018-10-09 14:26:47 +02:00
										 |  |  | namespace { | 
					
						
							| 
									
										
										
										
											2018-09-26 14:10:35 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-10-09 14:26:47 +02:00
										 |  |  | class CompilerOptionsBuilder : public ::testing::Test | 
					
						
							| 
									
										
										
										
											2018-09-26 14:10:35 +02:00
										 |  |  | { | 
					
						
							|  |  |  | protected: | 
					
						
							|  |  |  |     void SetUp() final | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         projectPart.project = project.get(); | 
					
						
							|  |  |  |         projectPart.toolchainType = ProjectExplorer::Constants::CLANG_TOOLCHAIN_TYPEID; | 
					
						
							| 
									
										
										
										
											2019-01-09 18:31:20 +01:00
										 |  |  |         projectPart.languageVersion = Utils::LanguageVersion::CXX17; | 
					
						
							| 
									
										
										
										
											2018-09-26 14:10:35 +02:00
										 |  |  |         projectPart.toolChainWordWidth = CppTools::ProjectPart::WordWidth64Bit; | 
					
						
							|  |  |  |         projectPart.toolChainTargetTriple = "x86_64-apple-darwin10"; | 
					
						
							|  |  |  |         projectPart.precompiledHeaders = QStringList{TESTDATA_DIR "/compileroptionsbuilder.pch"}; | 
					
						
							| 
									
										
										
										
											2018-10-09 14:26:47 +02:00
										 |  |  |         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"}}; | 
					
						
							| 
									
										
										
										
											2018-09-26 14:10:35 +02:00
										 |  |  |         projectPart.projectMacros = {ProjectExplorer::Macro{"projectFoo", "projectBar"}}; | 
					
						
							| 
									
										
										
										
											2019-08-28 13:04:16 +02:00
										 |  |  |         projectPart.qtVersion = Utils::QtVersion::Qt5; | 
					
						
							| 
									
										
										
										
											2018-09-26 14:10:35 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |         projectPart.headerPaths = {HeaderPath{"/tmp/builtin_path", HeaderPathType::BuiltIn}, | 
					
						
							|  |  |  |                                    HeaderPath{"/tmp/system_path", HeaderPathType::System}, | 
					
						
							|  |  |  |                                    HeaderPath{"/tmp/path", HeaderPathType::User}}; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-10-11 09:41:52 +02:00
										 |  |  |     static HeaderPath builtIn(const QString &path) | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         return HeaderPath{path, HeaderPathType::BuiltIn}; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     QString toNative(const QString &toNative) | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         return QDir::toNativeSeparators(toNative); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-09-26 14:10:35 +02:00
										 |  |  |     std::unique_ptr<Project> project{std::make_unique<ProjectExplorer::Project>()}; | 
					
						
							|  |  |  |     ProjectPart projectPart; | 
					
						
							| 
									
										
										
										
											2018-10-09 14:26:47 +02:00
										 |  |  |     CppTools::CompilerOptionsBuilder compilerOptionsBuilder{projectPart}; | 
					
						
							| 
									
										
										
										
											2018-09-26 14:10:35 +02:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-01-11 15:50:39 +01:00
										 |  |  | TEST_F(CompilerOptionsBuilder, AddProjectMacros) | 
					
						
							| 
									
										
										
										
											2018-09-26 14:10:35 +02:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2019-01-11 15:50:39 +01:00
										 |  |  |     compilerOptionsBuilder.addProjectMacros(); | 
					
						
							| 
									
										
										
										
											2018-09-26 14:10:35 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-01-11 15:50:39 +01:00
										 |  |  |     ASSERT_THAT(compilerOptionsBuilder.options(), ElementsAre("-DprojectFoo=projectBar")); | 
					
						
							| 
									
										
										
										
											2018-09-26 14:10:35 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-01-08 16:22:39 +01:00
										 |  |  | TEST_F(CompilerOptionsBuilder, CompilerFlagsFiltering_UnknownOptionsAreForwarded) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     ProjectPart part = projectPart; | 
					
						
							|  |  |  |     part.compilerFlags = QStringList{"-fancyFlag"}; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     CppTools::CompilerOptionsBuilder compilerOptionsBuilder{part, | 
					
						
							|  |  |  |                                                             CppTools::UseSystemHeader::No, | 
					
						
							| 
									
										
										
										
											2019-01-17 15:27:36 +01:00
										 |  |  |                                                             CppTools::UseTweakedHeaderPaths::No, | 
					
						
							| 
									
										
										
										
											2019-01-08 16:22:39 +01:00
										 |  |  |                                                             CppTools::UseLanguageDefines::Yes}; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     compilerOptionsBuilder.build(ProjectFile::CXXSource, CppTools::UsePrecompiledHeaders::No); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     ASSERT_THAT(compilerOptionsBuilder.options(), Contains(part.compilerFlags.first())); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-01-31 10:16:28 +01:00
										 |  |  | TEST_F(CompilerOptionsBuilder, CompilerFlagsFiltering_WarningsFlagsAreNotFilteredIfRequested) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     ProjectPart part = projectPart; | 
					
						
							|  |  |  |     part.compilerFlags = QStringList{"-Whello"}; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     CppTools::CompilerOptionsBuilder compilerOptionsBuilder{part, | 
					
						
							|  |  |  |                                                             CppTools::UseSystemHeader::No, | 
					
						
							|  |  |  |                                                             CppTools::UseTweakedHeaderPaths::No, | 
					
						
							|  |  |  |                                                             CppTools::UseLanguageDefines::No, | 
					
						
							|  |  |  |                                                             CppTools::UseBuildSystemWarnings::Yes}; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     compilerOptionsBuilder.build(ProjectFile::CXXSource, CppTools::UsePrecompiledHeaders::No); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     ASSERT_THAT(compilerOptionsBuilder.options(), Contains(part.compilerFlags.first())); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-01-08 16:22:39 +01:00
										 |  |  | TEST_F(CompilerOptionsBuilder, CompilerFlagsFiltering_DiagnosticOptionsAreRemoved) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     ProjectPart part = projectPart; | 
					
						
							|  |  |  |     part.compilerFlags = QStringList{"-Wbla", "-pedantic"}; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     CppTools::CompilerOptionsBuilder compilerOptionsBuilder{part, | 
					
						
							|  |  |  |                                                             CppTools::UseSystemHeader::No, | 
					
						
							| 
									
										
										
										
											2019-01-17 15:27:36 +01:00
										 |  |  |                                                             CppTools::UseTweakedHeaderPaths::No, | 
					
						
							| 
									
										
										
										
											2019-01-08 16:22:39 +01:00
										 |  |  |                                                             CppTools::UseLanguageDefines::Yes}; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     compilerOptionsBuilder.build(ProjectFile::CXXSource, CppTools::UsePrecompiledHeaders::No); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     ASSERT_THAT(compilerOptionsBuilder.options(), Not(Contains(part.compilerFlags[0]))); | 
					
						
							|  |  |  |     ASSERT_THAT(compilerOptionsBuilder.options(), Not(Contains(part.compilerFlags[1]))); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | TEST_F(CompilerOptionsBuilder, CompilerFlagsFiltering_CLanguageVersionIsRewritten) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     ProjectPart part = projectPart; | 
					
						
							|  |  |  |     part.compilerFlags = QStringList{"-std=c18"}; | 
					
						
							|  |  |  |     // We need to set the language version here to overcome a QTC_ASSERT checking
 | 
					
						
							|  |  |  |     // consistency between ProjectFile::Kind and ProjectPart::LanguageVersion
 | 
					
						
							|  |  |  |     part.languageVersion = Utils::LanguageVersion::C18; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     CppTools::CompilerOptionsBuilder compilerOptionsBuilder{part, | 
					
						
							|  |  |  |                                                             CppTools::UseSystemHeader::No, | 
					
						
							| 
									
										
										
										
											2019-01-17 15:27:36 +01:00
										 |  |  |                                                             CppTools::UseTweakedHeaderPaths::No, | 
					
						
							| 
									
										
										
										
											2019-01-08 16:22:39 +01:00
										 |  |  |                                                             CppTools::UseLanguageDefines::Yes}; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     compilerOptionsBuilder.build(ProjectFile::CSource, CppTools::UsePrecompiledHeaders::No); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     ASSERT_THAT(compilerOptionsBuilder.options(), Not(Contains(part.compilerFlags.first()))); | 
					
						
							|  |  |  |     ASSERT_THAT(compilerOptionsBuilder.options(), Contains("-std=c17")); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | TEST_F(CompilerOptionsBuilder, CompilerFlagsFiltering_LanguageVersionIsExplicitlySetIfNotProvided) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     CppTools::CompilerOptionsBuilder compilerOptionsBuilder{projectPart, | 
					
						
							|  |  |  |                                                             CppTools::UseSystemHeader::No, | 
					
						
							| 
									
										
										
										
											2019-01-17 15:27:36 +01:00
										 |  |  |                                                             CppTools::UseTweakedHeaderPaths::No, | 
					
						
							| 
									
										
										
										
											2019-01-08 16:22:39 +01:00
										 |  |  |                                                             CppTools::UseLanguageDefines::Yes}; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     compilerOptionsBuilder.build(ProjectFile::CXXSource, CppTools::UsePrecompiledHeaders::No); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     ASSERT_THAT(compilerOptionsBuilder.options(), Contains("-std=c++17")); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-01-11 15:32:12 +01:00
										 |  |  | TEST_F(CompilerOptionsBuilder, CompilerFlagsFiltering_ClLanguageVersionIsExplicitlySetIfNotProvided) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     projectPart.toolchainType = ProjectExplorer::Constants::MSVC_TOOLCHAIN_TYPEID; | 
					
						
							|  |  |  |     CppTools::CompilerOptionsBuilder compilerOptionsBuilder{projectPart, | 
					
						
							|  |  |  |                                                             CppTools::UseSystemHeader::No, | 
					
						
							| 
									
										
										
										
											2019-01-17 15:27:36 +01:00
										 |  |  |                                                             CppTools::UseTweakedHeaderPaths::No, | 
					
						
							| 
									
										
										
										
											2019-01-11 15:32:12 +01:00
										 |  |  |                                                             CppTools::UseLanguageDefines::Yes}; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     compilerOptionsBuilder.build(ProjectFile::CXXSource, CppTools::UsePrecompiledHeaders::No); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     ASSERT_THAT(compilerOptionsBuilder.options(), Contains("/std:c++17")); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-10-09 14:26:47 +02:00
										 |  |  | TEST_F(CompilerOptionsBuilder, AddWordWidth) | 
					
						
							| 
									
										
										
										
											2018-09-26 14:10:35 +02:00
										 |  |  | { | 
					
						
							|  |  |  |     compilerOptionsBuilder.addWordWidth(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     ASSERT_THAT(compilerOptionsBuilder.options(), ElementsAre("-m64")); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-10-09 14:26:47 +02:00
										 |  |  | TEST_F(CompilerOptionsBuilder, HeaderPathOptionsOrder) | 
					
						
							| 
									
										
										
										
											2018-09-26 14:10:35 +02:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2019-01-17 15:27:36 +01:00
										 |  |  |     CppTools::CompilerOptionsBuilder compilerOptionsBuilder{projectPart, | 
					
						
							|  |  |  |                                                             CppTools::UseSystemHeader::No, | 
					
						
							|  |  |  |                                                             CppTools::UseTweakedHeaderPaths::Yes, | 
					
						
							|  |  |  |                                                             CppTools::UseLanguageDefines::No, | 
					
						
							| 
									
										
										
										
											2019-01-31 10:16:28 +01:00
										 |  |  |                                                             CppTools::UseBuildSystemWarnings::No, | 
					
						
							| 
									
										
										
										
											2019-01-17 15:27:36 +01:00
										 |  |  |                                                             "dummy_version", | 
					
						
							|  |  |  |                                                             ""}; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-09-26 14:10:35 +02:00
										 |  |  |     compilerOptionsBuilder.addHeaderPathOptions(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     ASSERT_THAT(compilerOptionsBuilder.options(), | 
					
						
							| 
									
										
										
										
											2019-01-17 15:27:36 +01:00
										 |  |  |                 ElementsAre("-nostdinc", | 
					
						
							|  |  |  |                             "-nostdinc++", | 
					
						
							| 
									
										
										
										
											2019-10-11 09:41:52 +02:00
										 |  |  |                             "-I", toNative("/tmp/path"), | 
					
						
							|  |  |  |                             "-I", toNative("/tmp/system_path"), | 
					
						
							| 
									
										
										
										
											2020-08-24 10:46:58 +02:00
										 |  |  |                             "-isystem", toNative(CLANG_INCLUDE_DIR ""), | 
					
						
							| 
									
										
										
										
											2019-10-11 09:41:52 +02:00
										 |  |  |                             "-isystem", toNative("/tmp/builtin_path"))); | 
					
						
							| 
									
										
										
										
											2018-09-26 14:10:35 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-01-11 15:32:12 +01:00
										 |  |  | TEST_F(CompilerOptionsBuilder, HeaderPathOptionsOrderCl) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     projectPart.toolchainType = ProjectExplorer::Constants::MSVC_TOOLCHAIN_TYPEID; | 
					
						
							| 
									
										
										
										
											2019-01-17 15:27:36 +01:00
										 |  |  |     CppTools::CompilerOptionsBuilder compilerOptionsBuilder{projectPart, | 
					
						
							|  |  |  |                                                             CppTools::UseSystemHeader::No, | 
					
						
							|  |  |  |                                                             CppTools::UseTweakedHeaderPaths::Yes, | 
					
						
							|  |  |  |                                                             CppTools::UseLanguageDefines::No, | 
					
						
							| 
									
										
										
										
											2019-01-31 10:16:28 +01:00
										 |  |  |                                                             CppTools::UseBuildSystemWarnings::No, | 
					
						
							| 
									
										
										
										
											2019-01-17 15:27:36 +01:00
										 |  |  |                                                             "dummy_version", | 
					
						
							|  |  |  |                                                             ""}; | 
					
						
							| 
									
										
										
										
											2019-01-11 15:32:12 +01:00
										 |  |  |     compilerOptionsBuilder.evaluateCompilerFlags(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     compilerOptionsBuilder.addHeaderPathOptions(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     ASSERT_THAT(compilerOptionsBuilder.options(), | 
					
						
							| 
									
										
										
										
											2019-01-17 15:27:36 +01:00
										 |  |  |                 ElementsAre("-nostdinc", | 
					
						
							|  |  |  |                             "-nostdinc++", | 
					
						
							| 
									
										
										
										
											2019-10-11 09:41:52 +02:00
										 |  |  |                             "-I", toNative("/tmp/path"), | 
					
						
							|  |  |  |                             "-I", toNative("/tmp/system_path"), | 
					
						
							| 
									
										
										
										
											2019-01-17 15:27:36 +01:00
										 |  |  |                             "/clang:-isystem", | 
					
						
							| 
									
										
										
										
											2020-08-24 10:46:58 +02:00
										 |  |  |                             "/clang:" + toNative(CLANG_INCLUDE_DIR ""), | 
					
						
							| 
									
										
										
										
											2019-01-17 15:27:36 +01:00
										 |  |  |                             "/clang:-isystem", | 
					
						
							| 
									
										
										
										
											2019-10-11 09:41:52 +02:00
										 |  |  |                             "/clang:" + toNative("/tmp/builtin_path"))); | 
					
						
							| 
									
										
										
										
											2019-01-11 15:32:12 +01:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-10-09 14:26:47 +02:00
										 |  |  | TEST_F(CompilerOptionsBuilder, UseSystemHeader) | 
					
						
							| 
									
										
										
										
											2018-09-26 14:10:35 +02:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2019-01-17 15:27:36 +01:00
										 |  |  |     CppTools::CompilerOptionsBuilder compilerOptionsBuilder{projectPart, | 
					
						
							|  |  |  |                                                             CppTools::UseSystemHeader::Yes, | 
					
						
							|  |  |  |                                                             CppTools::UseTweakedHeaderPaths::Yes, | 
					
						
							|  |  |  |                                                             CppTools::UseLanguageDefines::No, | 
					
						
							| 
									
										
										
										
											2019-01-31 10:16:28 +01:00
										 |  |  |                                                             CppTools::UseBuildSystemWarnings::No, | 
					
						
							| 
									
										
										
										
											2019-01-17 15:27:36 +01:00
										 |  |  |                                                             "dummy_version", | 
					
						
							|  |  |  |                                                             ""}; | 
					
						
							| 
									
										
										
										
											2018-09-26 14:10:35 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     compilerOptionsBuilder.addHeaderPathOptions(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     ASSERT_THAT(compilerOptionsBuilder.options(), | 
					
						
							| 
									
										
										
										
											2019-01-17 15:27:36 +01:00
										 |  |  |                 ElementsAre("-nostdinc", | 
					
						
							|  |  |  |                             "-nostdinc++", | 
					
						
							| 
									
										
										
										
											2019-10-11 09:41:52 +02:00
										 |  |  |                             "-I", toNative("/tmp/path"), | 
					
						
							|  |  |  |                             "-isystem", toNative("/tmp/system_path"), | 
					
						
							| 
									
										
										
										
											2020-08-24 10:46:58 +02:00
										 |  |  |                             "-isystem", toNative(CLANG_INCLUDE_DIR ""), | 
					
						
							| 
									
										
										
										
											2019-10-11 09:41:52 +02:00
										 |  |  |                             "-isystem", toNative("/tmp/builtin_path"))); | 
					
						
							| 
									
										
										
										
											2018-09-26 14:10:35 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-01-17 15:27:36 +01:00
										 |  |  | TEST_F(CompilerOptionsBuilder, NoClangHeadersPath) | 
					
						
							| 
									
										
										
										
											2018-09-26 14:10:35 +02:00
										 |  |  | { | 
					
						
							|  |  |  |     compilerOptionsBuilder.addHeaderPathOptions(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     ASSERT_THAT(compilerOptionsBuilder.options(), | 
					
						
							| 
									
										
										
										
											2019-10-11 09:41:52 +02:00
										 |  |  |                 ElementsAre("-I", toNative("/tmp/path"), | 
					
						
							|  |  |  |                             "-I", toNative("/tmp/system_path"))); | 
					
						
							| 
									
										
										
										
											2018-09-26 14:10:35 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-10-09 14:26:47 +02:00
										 |  |  | TEST_F(CompilerOptionsBuilder, ClangHeadersAndCppIncludesPathsOrderMacOs) | 
					
						
							| 
									
										
										
										
											2018-09-26 14:10:35 +02:00
										 |  |  | { | 
					
						
							|  |  |  |     auto defaultPaths = projectPart.headerPaths; | 
					
						
							| 
									
										
										
										
											2019-10-11 09:41:52 +02:00
										 |  |  |     projectPart.headerPaths = { | 
					
						
							|  |  |  |         builtIn("/usr/include/c++/4.2.1"), | 
					
						
							|  |  |  |         builtIn("/usr/include/c++/4.2.1/backward"), | 
					
						
							|  |  |  |         builtIn("/usr/local/include"), | 
					
						
							|  |  |  |         builtIn("/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/6.0/include"), | 
					
						
							|  |  |  |         builtIn("/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include"), | 
					
						
							|  |  |  |         builtIn("/usr/include") | 
					
						
							|  |  |  |     }; | 
					
						
							| 
									
										
										
										
											2018-09-26 14:10:35 +02:00
										 |  |  |     projectPart.headerPaths.append(defaultPaths); | 
					
						
							| 
									
										
										
										
											2018-10-09 14:26:47 +02:00
										 |  |  |     CppTools::CompilerOptionsBuilder compilerOptionsBuilder(projectPart, | 
					
						
							|  |  |  |                                                             CppTools::UseSystemHeader::No, | 
					
						
							| 
									
										
										
										
											2018-11-30 12:15:07 +01:00
										 |  |  |                                                             CppTools::UseTweakedHeaderPaths::Yes, | 
					
						
							| 
									
										
										
										
											2018-11-30 11:02:49 +01:00
										 |  |  |                                                             CppTools::UseLanguageDefines::No, | 
					
						
							| 
									
										
										
										
											2019-01-31 10:16:28 +01:00
										 |  |  |                                                             CppTools::UseBuildSystemWarnings::No, | 
					
						
							| 
									
										
										
										
											2019-01-17 15:27:36 +01:00
										 |  |  |                                                             "dummy_version", | 
					
						
							| 
									
										
										
										
											2018-10-09 14:26:47 +02:00
										 |  |  |                                                             ""); | 
					
						
							| 
									
										
										
										
											2018-09-26 14:10:35 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     compilerOptionsBuilder.addHeaderPathOptions(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     ASSERT_THAT(compilerOptionsBuilder.options(), | 
					
						
							|  |  |  |                 ElementsAre("-nostdinc", | 
					
						
							| 
									
										
										
										
											2019-01-17 15:27:36 +01:00
										 |  |  |                             "-nostdinc++", | 
					
						
							| 
									
										
										
										
											2019-10-11 09:41:52 +02:00
										 |  |  |                             "-I", toNative("/tmp/path"), | 
					
						
							|  |  |  |                             "-I", toNative("/tmp/system_path"), | 
					
						
							|  |  |  |                             "-isystem", toNative("/usr/include/c++/4.2.1"), | 
					
						
							|  |  |  |                             "-isystem", toNative("/usr/include/c++/4.2.1/backward"), | 
					
						
							|  |  |  |                             "-isystem", toNative("/usr/local/include"), | 
					
						
							| 
									
										
										
										
											2020-08-24 10:46:58 +02:00
										 |  |  |                             "-isystem", toNative(CLANG_INCLUDE_DIR ""), | 
					
						
							| 
									
										
										
										
											2019-10-11 09:41:52 +02:00
										 |  |  |                             "-isystem", toNative("/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include"), | 
					
						
							|  |  |  |                             "-isystem", toNative("/usr/include"), | 
					
						
							|  |  |  |                             "-isystem", toNative("/tmp/builtin_path"))); | 
					
						
							| 
									
										
										
										
											2018-09-26 14:10:35 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-10-09 14:26:47 +02:00
										 |  |  | TEST_F(CompilerOptionsBuilder, ClangHeadersAndCppIncludesPathsOrderLinux) | 
					
						
							| 
									
										
										
										
											2018-09-26 14:10:35 +02:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2019-10-11 09:41:52 +02:00
										 |  |  |     projectPart.headerPaths = { | 
					
						
							|  |  |  |         builtIn("/usr/include/c++/4.8"), | 
					
						
							|  |  |  |         builtIn("/usr/include/c++/4.8/backward"), | 
					
						
							|  |  |  |         builtIn("/usr/include/x86_64-linux-gnu/c++/4.8"), | 
					
						
							|  |  |  |         builtIn("/usr/local/include"), | 
					
						
							|  |  |  |         builtIn("/usr/lib/gcc/x86_64-linux-gnu/4.8/include"), | 
					
						
							|  |  |  |         builtIn("/usr/include/x86_64-linux-gnu"), | 
					
						
							|  |  |  |         builtIn("/usr/include"), | 
					
						
							|  |  |  |     }; | 
					
						
							| 
									
										
										
										
											2018-09-26 14:10:35 +02:00
										 |  |  |     projectPart.toolChainTargetTriple = "x86_64-linux-gnu"; | 
					
						
							| 
									
										
										
										
											2018-10-09 14:26:47 +02:00
										 |  |  |     CppTools::CompilerOptionsBuilder compilerOptionsBuilder(projectPart, | 
					
						
							|  |  |  |                                                             CppTools::UseSystemHeader::No, | 
					
						
							| 
									
										
										
										
											2018-11-30 12:15:07 +01:00
										 |  |  |                                                             CppTools::UseTweakedHeaderPaths::Yes, | 
					
						
							| 
									
										
										
										
											2018-11-30 11:02:49 +01:00
										 |  |  |                                                             CppTools::UseLanguageDefines::No, | 
					
						
							| 
									
										
										
										
											2019-01-31 10:16:28 +01:00
										 |  |  |                                                             CppTools::UseBuildSystemWarnings::No, | 
					
						
							| 
									
										
										
										
											2019-01-17 15:27:36 +01:00
										 |  |  |                                                             "dummy_version", | 
					
						
							| 
									
										
										
										
											2018-10-09 14:26:47 +02:00
										 |  |  |                                                             ""); | 
					
						
							| 
									
										
										
										
											2018-09-26 14:10:35 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     compilerOptionsBuilder.addHeaderPathOptions(); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-01-17 15:27:36 +01:00
										 |  |  |     ASSERT_THAT( | 
					
						
							|  |  |  |         compilerOptionsBuilder.options(), | 
					
						
							|  |  |  |         ElementsAre( | 
					
						
							|  |  |  |             "-nostdinc", | 
					
						
							|  |  |  |             "-nostdinc++", | 
					
						
							| 
									
										
										
										
											2019-10-11 09:41:52 +02:00
										 |  |  |             "-isystem", toNative("/usr/include/c++/4.8"), | 
					
						
							|  |  |  |             "-isystem", toNative("/usr/include/c++/4.8/backward"), | 
					
						
							|  |  |  |             "-isystem", toNative("/usr/include/x86_64-linux-gnu/c++/4.8"), | 
					
						
							|  |  |  |             "-isystem", toNative("/usr/local/include"), | 
					
						
							| 
									
										
										
										
											2020-08-24 10:46:58 +02:00
										 |  |  |             "-isystem", toNative(CLANG_INCLUDE_DIR ""), | 
					
						
							| 
									
										
										
										
											2019-10-11 09:41:52 +02:00
										 |  |  |             "-isystem", toNative("/usr/lib/gcc/x86_64-linux-gnu/4.8/include"), | 
					
						
							|  |  |  |             "-isystem", toNative("/usr/include/x86_64-linux-gnu"), | 
					
						
							|  |  |  |             "-isystem", toNative("/usr/include"))); | 
					
						
							| 
									
										
										
										
											2018-09-26 14:10:35 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-11-12 13:18:27 +01:00
										 |  |  | TEST_F(CompilerOptionsBuilder, ClangHeadersAndCppIncludesPathsOrderNoVersion) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2018-12-05 10:36:24 +01:00
										 |  |  |     projectPart.headerPaths = { | 
					
						
							| 
									
										
										
										
											2019-10-11 09:41:52 +02:00
										 |  |  |         builtIn("C:/mingw530/i686-w64-mingw32/include"), | 
					
						
							|  |  |  |         builtIn("C:/mingw530/i686-w64-mingw32/include/c++"), | 
					
						
							|  |  |  |         builtIn("C:/mingw530/i686-w64-mingw32/include/c++/i686-w64-mingw32"), | 
					
						
							|  |  |  |         builtIn("C:/mingw530/i686-w64-mingw32/include/c++/backward"), | 
					
						
							|  |  |  |     }; | 
					
						
							| 
									
										
										
										
											2018-11-12 13:18:27 +01:00
										 |  |  |     projectPart.toolChainTargetTriple = "x86_64-w64-windows-gnu"; | 
					
						
							|  |  |  |     CppTools::CompilerOptionsBuilder compilerOptionsBuilder(projectPart, | 
					
						
							|  |  |  |                                                             CppTools::UseSystemHeader::No, | 
					
						
							| 
									
										
										
										
											2018-11-30 12:15:07 +01:00
										 |  |  |                                                             CppTools::UseTweakedHeaderPaths::Yes, | 
					
						
							| 
									
										
										
										
											2018-11-30 11:02:49 +01:00
										 |  |  |                                                             CppTools::UseLanguageDefines::No, | 
					
						
							| 
									
										
										
										
											2019-01-31 10:16:28 +01:00
										 |  |  |                                                             CppTools::UseBuildSystemWarnings::No, | 
					
						
							| 
									
										
										
										
											2019-01-17 15:27:36 +01:00
										 |  |  |                                                             "dummy_version", | 
					
						
							| 
									
										
										
										
											2018-11-12 13:18:27 +01:00
										 |  |  |                                                             ""); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     compilerOptionsBuilder.addHeaderPathOptions(); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-12-05 10:36:24 +01:00
										 |  |  |     ASSERT_THAT( | 
					
						
							|  |  |  |         compilerOptionsBuilder.options(), | 
					
						
							| 
									
										
										
										
											2019-01-17 15:27:36 +01:00
										 |  |  |         ElementsAre("-nostdinc", | 
					
						
							|  |  |  |                     "-nostdinc++", | 
					
						
							| 
									
										
										
										
											2019-10-11 09:41:52 +02:00
										 |  |  |                     "-isystem", toNative("C:/mingw530/i686-w64-mingw32/include/c++"), | 
					
						
							|  |  |  |                     "-isystem", toNative("C:/mingw530/i686-w64-mingw32/include/c++/i686-w64-mingw32"), | 
					
						
							|  |  |  |                     "-isystem", toNative("C:/mingw530/i686-w64-mingw32/include/c++/backward"), | 
					
						
							| 
									
										
										
										
											2020-08-24 10:46:58 +02:00
										 |  |  |                     "-isystem", toNative(CLANG_INCLUDE_DIR ""), | 
					
						
							| 
									
										
										
										
											2019-10-11 09:41:52 +02:00
										 |  |  |                     "-isystem", toNative("C:/mingw530/i686-w64-mingw32/include"))); | 
					
						
							| 
									
										
										
										
											2018-11-12 13:18:27 +01:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | TEST_F(CompilerOptionsBuilder, ClangHeadersAndCppIncludesPathsOrderAndroidClang) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2019-10-11 09:41:52 +02:00
										 |  |  |     projectPart.headerPaths = { | 
					
						
							|  |  |  |         builtIn("C:/Android/sdk/ndk-bundle/sysroot/usr/include/i686-linux-android"), | 
					
						
							|  |  |  |         builtIn("C:/Android/sdk/ndk-bundle/sources/cxx-stl/llvm-libc++/include"), | 
					
						
							|  |  |  |         builtIn("C:/Android/sdk/ndk-bundle/sources/android/support/include"), | 
					
						
							|  |  |  |         builtIn("C:/Android/sdk/ndk-bundle/sources/cxx-stl/llvm-libc++abi/include"), | 
					
						
							|  |  |  |         builtIn("C:/Android/sdk/ndk-bundle/sysroot/usr/include"), | 
					
						
							|  |  |  |     }; | 
					
						
							| 
									
										
										
										
											2018-11-12 13:18:27 +01:00
										 |  |  |     projectPart.toolChainTargetTriple = "i686-linux-android"; | 
					
						
							|  |  |  |     CppTools::CompilerOptionsBuilder compilerOptionsBuilder(projectPart, | 
					
						
							|  |  |  |                                                             CppTools::UseSystemHeader::No, | 
					
						
							| 
									
										
										
										
											2018-11-30 12:15:07 +01:00
										 |  |  |                                                             CppTools::UseTweakedHeaderPaths::Yes, | 
					
						
							| 
									
										
										
										
											2018-11-30 11:02:49 +01:00
										 |  |  |                                                             CppTools::UseLanguageDefines::No, | 
					
						
							| 
									
										
										
										
											2019-01-31 10:16:28 +01:00
										 |  |  |                                                             CppTools::UseBuildSystemWarnings::No, | 
					
						
							| 
									
										
										
										
											2019-01-17 15:27:36 +01:00
										 |  |  |                                                             "dummy_version", | 
					
						
							| 
									
										
										
										
											2018-11-12 13:18:27 +01:00
										 |  |  |                                                             ""); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     compilerOptionsBuilder.addHeaderPathOptions(); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-01-17 15:27:36 +01:00
										 |  |  |     ASSERT_THAT(compilerOptionsBuilder.options(), | 
					
						
							|  |  |  |                 ElementsAre("-nostdinc", | 
					
						
							|  |  |  |                             "-nostdinc++", | 
					
						
							| 
									
										
										
										
											2019-10-11 09:41:52 +02:00
										 |  |  |                             "-isystem", toNative("C:/Android/sdk/ndk-bundle/sources/cxx-stl/llvm-libc++/include"), | 
					
						
							|  |  |  |                             "-isystem", toNative("C:/Android/sdk/ndk-bundle/sources/cxx-stl/llvm-libc++abi/include"), | 
					
						
							| 
									
										
										
										
											2020-08-24 10:46:58 +02:00
										 |  |  |                             "-isystem", toNative(CLANG_INCLUDE_DIR ""), | 
					
						
							| 
									
										
										
										
											2019-10-11 09:41:52 +02:00
										 |  |  |                             "-isystem", toNative("C:/Android/sdk/ndk-bundle/sysroot/usr/include/i686-linux-android"), | 
					
						
							|  |  |  |                             "-isystem", toNative("C:/Android/sdk/ndk-bundle/sources/android/support/include"), | 
					
						
							|  |  |  |                             "-isystem", toNative("C:/Android/sdk/ndk-bundle/sysroot/usr/include"))); | 
					
						
							| 
									
										
										
										
											2018-11-12 13:18:27 +01:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-10-09 14:26:47 +02:00
										 |  |  | TEST_F(CompilerOptionsBuilder, NoPrecompiledHeader) | 
					
						
							| 
									
										
										
										
											2018-09-26 14:10:35 +02:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2018-11-30 10:34:05 +01:00
										 |  |  |     compilerOptionsBuilder.addPrecompiledHeaderOptions(CppTools::UsePrecompiledHeaders::No); | 
					
						
							| 
									
										
										
										
											2018-09-26 14:10:35 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     ASSERT_THAT(compilerOptionsBuilder.options().empty(), true); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-10-09 14:26:47 +02:00
										 |  |  | TEST_F(CompilerOptionsBuilder, UsePrecompiledHeader) | 
					
						
							| 
									
										
										
										
											2018-09-26 14:10:35 +02:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2018-11-30 10:34:05 +01:00
										 |  |  |     compilerOptionsBuilder.addPrecompiledHeaderOptions(CppTools::UsePrecompiledHeaders::Yes); | 
					
						
							| 
									
										
										
										
											2018-09-26 14:10:35 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     ASSERT_THAT(compilerOptionsBuilder.options(), | 
					
						
							| 
									
										
										
										
											2019-10-11 09:41:52 +02:00
										 |  |  |                 ElementsAre("-include", | 
					
						
							|  |  |  |                             toNative(TESTDATA_DIR "/compileroptionsbuilder.pch"))); | 
					
						
							| 
									
										
										
										
											2018-09-26 14:10:35 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-01-11 15:32:12 +01:00
										 |  |  | TEST_F(CompilerOptionsBuilder, UsePrecompiledHeaderCl) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     projectPart.toolchainType = ProjectExplorer::Constants::MSVC_TOOLCHAIN_TYPEID; | 
					
						
							|  |  |  |     CppTools::CompilerOptionsBuilder compilerOptionsBuilder{projectPart}; | 
					
						
							|  |  |  |     compilerOptionsBuilder.evaluateCompilerFlags(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     compilerOptionsBuilder.addPrecompiledHeaderOptions(CppTools::UsePrecompiledHeaders::Yes); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     ASSERT_THAT(compilerOptionsBuilder.options(), | 
					
						
							|  |  |  |                 ElementsAre("/FI", | 
					
						
							| 
									
										
										
										
											2019-10-11 09:41:52 +02:00
										 |  |  |                             toNative(TESTDATA_DIR "/compileroptionsbuilder.pch"))); | 
					
						
							| 
									
										
										
										
											2019-01-11 15:32:12 +01:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-10-09 14:26:47 +02:00
										 |  |  | TEST_F(CompilerOptionsBuilder, AddMacros) | 
					
						
							| 
									
										
										
										
											2018-09-26 14:10:35 +02:00
										 |  |  | { | 
					
						
							|  |  |  |     compilerOptionsBuilder.addMacros(ProjectExplorer::Macros{ProjectExplorer::Macro{"key", "value"}}); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     ASSERT_THAT(compilerOptionsBuilder.options(), ElementsAre("-Dkey=value")); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-10-09 14:26:47 +02:00
										 |  |  | TEST_F(CompilerOptionsBuilder, AddTargetTriple) | 
					
						
							| 
									
										
										
										
											2018-09-26 14:10:35 +02:00
										 |  |  | { | 
					
						
							|  |  |  |     compilerOptionsBuilder.addTargetTriple(); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-01-11 15:32:12 +01:00
										 |  |  |     ASSERT_THAT(compilerOptionsBuilder.options(), ElementsAre("--target=x86_64-apple-darwin10")); | 
					
						
							| 
									
										
										
										
											2018-09-26 14:10:35 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-12-19 11:58:24 +01:00
										 |  |  | TEST_F(CompilerOptionsBuilder, EnableCExceptions) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     projectPart.languageVersion = Utils::LanguageVersion::C99; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     compilerOptionsBuilder.enableExceptions(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     ASSERT_THAT(compilerOptionsBuilder.options(), ElementsAre("-fexceptions")); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | TEST_F(CompilerOptionsBuilder, EnableCXXExceptions) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     compilerOptionsBuilder.enableExceptions(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     ASSERT_THAT(compilerOptionsBuilder.options(), ElementsAre("-fcxx-exceptions", "-fexceptions")); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-10-09 14:26:47 +02:00
										 |  |  | TEST_F(CompilerOptionsBuilder, InsertWrappedQtHeaders) | 
					
						
							| 
									
										
										
										
											2018-09-26 14:10:35 +02:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2019-01-17 15:27:36 +01:00
										 |  |  |     CppTools::CompilerOptionsBuilder compilerOptionsBuilder{projectPart, | 
					
						
							|  |  |  |                                                             CppTools::UseSystemHeader::Yes, | 
					
						
							|  |  |  |                                                             CppTools::UseTweakedHeaderPaths::Yes, | 
					
						
							|  |  |  |                                                             CppTools::UseLanguageDefines::No, | 
					
						
							| 
									
										
										
										
											2019-01-31 10:16:28 +01:00
										 |  |  |                                                             CppTools::UseBuildSystemWarnings::No, | 
					
						
							| 
									
										
										
										
											2019-01-17 15:27:36 +01:00
										 |  |  |                                                             "dummy_version", | 
					
						
							|  |  |  |                                                             ""}; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-09-26 14:10:35 +02:00
										 |  |  |     compilerOptionsBuilder.insertWrappedQtHeaders(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     ASSERT_THAT(compilerOptionsBuilder.options(), Contains(IsPartOfHeader("wrappedQtHeaders"))); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-07-09 09:44:39 +02:00
										 |  |  | TEST_F(CompilerOptionsBuilder, InsertWrappedMingwHeadersWithNonMingwToolchain) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     CppTools::CompilerOptionsBuilder builder{ | 
					
						
							|  |  |  |         projectPart, | 
					
						
							|  |  |  |         CppTools::UseSystemHeader::Yes, | 
					
						
							|  |  |  |         CppTools::UseTweakedHeaderPaths::Yes, | 
					
						
							|  |  |  |         CppTools::UseLanguageDefines::No, | 
					
						
							|  |  |  |         CppTools::UseBuildSystemWarnings::No, | 
					
						
							|  |  |  |         "dummy_version", | 
					
						
							|  |  |  |         ""}; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     builder.insertWrappedMingwHeaders(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     ASSERT_THAT(builder.options(), Not(Contains(IsPartOfHeader("wrappedMingwHeaders")))); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | TEST_F(CompilerOptionsBuilder, InsertWrappedMingwHeadersWithMingwToolchain) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     CppTools::CompilerOptionsBuilder builder{ | 
					
						
							|  |  |  |         projectPart, | 
					
						
							|  |  |  |         CppTools::UseSystemHeader::Yes, | 
					
						
							|  |  |  |         CppTools::UseTweakedHeaderPaths::Yes, | 
					
						
							|  |  |  |         CppTools::UseLanguageDefines::No, | 
					
						
							|  |  |  |         CppTools::UseBuildSystemWarnings::No, | 
					
						
							|  |  |  |         "dummy_version", | 
					
						
							|  |  |  |         ""}; | 
					
						
							|  |  |  |     projectPart.toolchainType = ProjectExplorer::Constants::MINGW_TOOLCHAIN_TYPEID; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     builder.insertWrappedMingwHeaders(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     ASSERT_THAT(builder.options(), Contains(IsPartOfHeader("wrappedMingwHeaders"))); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-10-09 14:26:47 +02:00
										 |  |  | TEST_F(CompilerOptionsBuilder, SetLanguageVersion) | 
					
						
							| 
									
										
										
										
											2018-09-26 14:10:35 +02:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2019-01-09 13:56:00 +01:00
										 |  |  |     compilerOptionsBuilder.updateFileLanguage(ProjectFile::CXXSource); | 
					
						
							| 
									
										
										
										
											2018-09-26 14:10:35 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     ASSERT_THAT(compilerOptionsBuilder.options(), ElementsAre("-x", "c++")); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-01-11 15:32:12 +01:00
										 |  |  | TEST_F(CompilerOptionsBuilder, SetLanguageVersionCl) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     projectPart.toolchainType = ProjectExplorer::Constants::MSVC_TOOLCHAIN_TYPEID; | 
					
						
							|  |  |  |     CppTools::CompilerOptionsBuilder compilerOptionsBuilder{projectPart}; | 
					
						
							|  |  |  |     compilerOptionsBuilder.evaluateCompilerFlags(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     compilerOptionsBuilder.updateFileLanguage(ProjectFile::CXXSource); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     ASSERT_THAT(compilerOptionsBuilder.options(), ElementsAre("/TP")); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-10-09 14:26:47 +02:00
										 |  |  | TEST_F(CompilerOptionsBuilder, HandleLanguageExtension) | 
					
						
							| 
									
										
										
										
											2018-09-26 14:10:35 +02:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2019-01-09 18:31:20 +01:00
										 |  |  |     projectPart.languageExtensions = Utils::LanguageExtension::ObjectiveC; | 
					
						
							| 
									
										
										
										
											2018-09-26 14:10:35 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-01-09 13:56:00 +01:00
										 |  |  |     compilerOptionsBuilder.updateFileLanguage(ProjectFile::CXXSource); | 
					
						
							| 
									
										
										
										
											2018-09-26 14:10:35 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     ASSERT_THAT(compilerOptionsBuilder.options(), ElementsAre("-x", "objective-c++")); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-10-09 14:26:47 +02:00
										 |  |  | TEST_F(CompilerOptionsBuilder, UpdateLanguageVersion) | 
					
						
							| 
									
										
										
										
											2018-09-26 14:10:35 +02:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2019-01-09 13:56:00 +01:00
										 |  |  |     compilerOptionsBuilder.updateFileLanguage(ProjectFile::CXXSource); | 
					
						
							| 
									
										
										
										
											2018-09-26 14:10:35 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-01-09 13:56:00 +01:00
										 |  |  |     compilerOptionsBuilder.updateFileLanguage(ProjectFile::CXXHeader); | 
					
						
							| 
									
										
										
										
											2018-09-26 14:10:35 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     ASSERT_THAT(compilerOptionsBuilder.options(), ElementsAre("-x", "c++-header")); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-01-11 15:32:12 +01:00
										 |  |  | TEST_F(CompilerOptionsBuilder, UpdateLanguageVersionCl) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     projectPart.toolchainType = ProjectExplorer::Constants::MSVC_TOOLCHAIN_TYPEID; | 
					
						
							|  |  |  |     CppTools::CompilerOptionsBuilder compilerOptionsBuilder{projectPart}; | 
					
						
							|  |  |  |     compilerOptionsBuilder.evaluateCompilerFlags(); | 
					
						
							|  |  |  |     compilerOptionsBuilder.updateFileLanguage(ProjectFile::CXXSource); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     compilerOptionsBuilder.updateFileLanguage(ProjectFile::CSource); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     ASSERT_THAT(compilerOptionsBuilder.options(), ElementsAre("/TC")); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-10-09 14:26:47 +02:00
										 |  |  | TEST_F(CompilerOptionsBuilder, AddMsvcCompatibilityVersion) | 
					
						
							| 
									
										
										
										
											2018-09-26 14:10:35 +02:00
										 |  |  | { | 
					
						
							|  |  |  |     projectPart.toolchainType = ProjectExplorer::Constants::MSVC_TOOLCHAIN_TYPEID; | 
					
						
							|  |  |  |     projectPart.toolChainMacros.append(ProjectExplorer::Macro{"_MSC_FULL_VER", "190000000"}); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     compilerOptionsBuilder.addMsvcCompatibilityVersion(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     ASSERT_THAT(compilerOptionsBuilder.options(), ElementsAre("-fms-compatibility-version=19.00")); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-10-09 14:26:47 +02:00
										 |  |  | TEST_F(CompilerOptionsBuilder, UndefineCppLanguageFeatureMacrosForMsvc2015) | 
					
						
							| 
									
										
										
										
											2018-09-26 14:10:35 +02:00
										 |  |  | { | 
					
						
							|  |  |  |     projectPart.toolchainType = ProjectExplorer::Constants::MSVC_TOOLCHAIN_TYPEID; | 
					
						
							|  |  |  |     projectPart.isMsvc2015Toolchain = true; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     compilerOptionsBuilder.undefineCppLanguageFeatureMacrosForMsvc2015(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     ASSERT_THAT(compilerOptionsBuilder.options(), Contains(QString{"-U__cpp_aggregate_bases"})); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-10-09 14:26:47 +02:00
										 |  |  | TEST_F(CompilerOptionsBuilder, AddDefineFunctionMacrosMsvc) | 
					
						
							| 
									
										
										
										
											2018-09-26 14:10:35 +02:00
										 |  |  | { | 
					
						
							|  |  |  |     projectPart.toolchainType = ProjectExplorer::Constants::MSVC_TOOLCHAIN_TYPEID; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     compilerOptionsBuilder.addDefineFunctionMacrosMsvc(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     ASSERT_THAT(compilerOptionsBuilder.options(), Contains(QString{"-D__FUNCTION__=\"\""})); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-10-09 14:26:47 +02:00
										 |  |  | TEST_F(CompilerOptionsBuilder, AddProjectConfigFileInclude) | 
					
						
							| 
									
										
										
										
											2018-09-26 14:10:35 +02:00
										 |  |  | { | 
					
						
							|  |  |  |     projectPart.projectConfigFile = "dummy_file.h"; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     compilerOptionsBuilder.addProjectConfigFileInclude(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     ASSERT_THAT(compilerOptionsBuilder.options(), ElementsAre("-include", "dummy_file.h")); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-01-11 15:32:12 +01:00
										 |  |  | TEST_F(CompilerOptionsBuilder, AddProjectConfigFileIncludeCl) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     projectPart.projectConfigFile = "dummy_file.h"; | 
					
						
							|  |  |  |     projectPart.toolchainType = ProjectExplorer::Constants::MSVC_TOOLCHAIN_TYPEID; | 
					
						
							|  |  |  |     CppTools::CompilerOptionsBuilder compilerOptionsBuilder{projectPart}; | 
					
						
							|  |  |  |     compilerOptionsBuilder.evaluateCompilerFlags(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     compilerOptionsBuilder.addProjectConfigFileInclude(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     ASSERT_THAT(compilerOptionsBuilder.options(), ElementsAre("/FI", "dummy_file.h")); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | TEST_F(CompilerOptionsBuilder, NoUndefineClangVersionMacrosForNewMsvc) | 
					
						
							| 
									
										
										
										
											2018-09-26 14:10:35 +02:00
										 |  |  | { | 
					
						
							|  |  |  |     projectPart.toolchainType = ProjectExplorer::Constants::MSVC_TOOLCHAIN_TYPEID; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     compilerOptionsBuilder.undefineClangVersionMacrosForMsvc(); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-01-11 15:32:12 +01:00
										 |  |  |     ASSERT_THAT(compilerOptionsBuilder.options(), Not(Contains(QString{"-U__clang__"}))); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | TEST_F(CompilerOptionsBuilder, UndefineClangVersionMacrosForOldMsvc) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     projectPart.toolchainType = ProjectExplorer::Constants::MSVC_TOOLCHAIN_TYPEID; | 
					
						
							|  |  |  |     projectPart.toolChainMacros = {ProjectExplorer::Macro{"_MSC_FULL_VER", "1300"}, | 
					
						
							|  |  |  |                                    ProjectExplorer::Macro{"_MSC_VER", "13"}}; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     compilerOptionsBuilder.undefineClangVersionMacrosForMsvc(); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-09-26 14:10:35 +02:00
										 |  |  |     ASSERT_THAT(compilerOptionsBuilder.options(), Contains(QString{"-U__clang__"})); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-10-09 14:26:47 +02:00
										 |  |  | TEST_F(CompilerOptionsBuilder, BuildAllOptions) | 
					
						
							| 
									
										
										
										
											2018-09-26 14:10:35 +02:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2019-01-11 15:32:12 +01:00
										 |  |  |     projectPart.extraCodeModelFlags = QStringList{"-arch", "x86_64"}; | 
					
						
							| 
									
										
										
										
											2019-01-17 15:27:36 +01:00
										 |  |  |     CppTools::CompilerOptionsBuilder compilerOptionsBuilder(projectPart, | 
					
						
							|  |  |  |                                                             CppTools::UseSystemHeader::No, | 
					
						
							|  |  |  |                                                             CppTools::UseTweakedHeaderPaths::Yes, | 
					
						
							|  |  |  |                                                             CppTools::UseLanguageDefines::No, | 
					
						
							| 
									
										
										
										
											2019-01-31 10:16:28 +01:00
										 |  |  |                                                             CppTools::UseBuildSystemWarnings::No, | 
					
						
							| 
									
										
										
										
											2019-01-17 15:27:36 +01:00
										 |  |  |                                                             "dummy_version", | 
					
						
							|  |  |  |                                                             ""); | 
					
						
							| 
									
										
										
										
											2019-01-11 15:32:12 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-11-30 10:34:05 +01:00
										 |  |  |     compilerOptionsBuilder.build(ProjectFile::CXXSource, CppTools::UsePrecompiledHeaders::No); | 
					
						
							| 
									
										
										
										
											2018-09-26 14:10:35 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     ASSERT_THAT(compilerOptionsBuilder.options(), | 
					
						
							| 
									
										
										
										
											2019-01-17 15:27:36 +01:00
										 |  |  |                 ElementsAre("-nostdinc", | 
					
						
							|  |  |  |                             "-nostdinc++", | 
					
						
							| 
									
										
										
										
											2019-10-11 15:01:09 +02:00
										 |  |  |                             "-arch", | 
					
						
							|  |  |  |                             "x86_64", | 
					
						
							| 
									
										
										
										
											2019-01-11 15:32:12 +01:00
										 |  |  |                             "-fsyntax-only", | 
					
						
							|  |  |  |                             "-m64", | 
					
						
							|  |  |  |                             "--target=x86_64-apple-darwin10", | 
					
						
							|  |  |  |                             "-x", | 
					
						
							|  |  |  |                             "c++", | 
					
						
							|  |  |  |                             "-std=c++17", | 
					
						
							|  |  |  |                             "-DprojectFoo=projectBar", | 
					
						
							| 
									
										
										
										
											2019-10-11 09:41:52 +02:00
										 |  |  |                             "-I", IsPartOfHeader("wrappedQtHeaders"), | 
					
						
							|  |  |  |                             "-I", IsPartOfHeader(toNative("wrappedQtHeaders/QtCore").toStdString()), | 
					
						
							|  |  |  |                             "-I", toNative("/tmp/path"), | 
					
						
							|  |  |  |                             "-I", toNative("/tmp/system_path"), | 
					
						
							| 
									
										
										
										
											2020-08-24 10:46:58 +02:00
										 |  |  |                             "-isystem", toNative(CLANG_INCLUDE_DIR ""), | 
					
						
							| 
									
										
										
										
											2019-10-11 09:41:52 +02:00
										 |  |  |                             "-isystem", toNative("/tmp/builtin_path"))); | 
					
						
							| 
									
										
										
										
											2018-09-26 14:10:35 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-01-11 15:32:12 +01:00
										 |  |  | TEST_F(CompilerOptionsBuilder, BuildAllOptionsCl) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     projectPart.toolchainType = ProjectExplorer::Constants::MSVC_TOOLCHAIN_TYPEID; | 
					
						
							| 
									
										
										
										
											2019-01-17 15:27:36 +01:00
										 |  |  |     CppTools::CompilerOptionsBuilder compilerOptionsBuilder(projectPart, | 
					
						
							|  |  |  |                                                             CppTools::UseSystemHeader::No, | 
					
						
							|  |  |  |                                                             CppTools::UseTweakedHeaderPaths::Yes, | 
					
						
							|  |  |  |                                                             CppTools::UseLanguageDefines::No, | 
					
						
							| 
									
										
										
										
											2019-01-31 10:16:28 +01:00
										 |  |  |                                                             CppTools::UseBuildSystemWarnings::No, | 
					
						
							| 
									
										
										
										
											2019-01-17 15:27:36 +01:00
										 |  |  |                                                             "dummy_version", | 
					
						
							|  |  |  |                                                             ""); | 
					
						
							| 
									
										
										
										
											2019-01-11 15:32:12 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |     compilerOptionsBuilder.build(ProjectFile::CXXSource, CppTools::UsePrecompiledHeaders::No); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-08-29 23:34:18 +03:00
										 |  |  |     ASSERT_THAT(compilerOptionsBuilder.options(), | 
					
						
							|  |  |  |                 ElementsAre("-nostdinc", | 
					
						
							|  |  |  |                             "-nostdinc++", | 
					
						
							|  |  |  |                             "--driver-mode=cl", | 
					
						
							|  |  |  |                             "/Zs", | 
					
						
							|  |  |  |                             "-m64", | 
					
						
							|  |  |  |                             "--target=x86_64-apple-darwin10", | 
					
						
							|  |  |  |                             "/TP", | 
					
						
							|  |  |  |                             "/std:c++17", | 
					
						
							|  |  |  |                             "-fms-compatibility-version=19.00", | 
					
						
							|  |  |  |                             "-DprojectFoo=projectBar", | 
					
						
							|  |  |  |                             "-D__FUNCSIG__=\"\"", | 
					
						
							|  |  |  |                             "-D__FUNCTION__=\"\"", | 
					
						
							|  |  |  |                             "-D__FUNCDNAME__=\"\"", | 
					
						
							|  |  |  |                             "-I", IsPartOfHeader("wrappedQtHeaders"), | 
					
						
							|  |  |  |                             "-I", IsPartOfHeader(toNative("wrappedQtHeaders/QtCore").toStdString()), | 
					
						
							|  |  |  |                             "-I", toNative("/tmp/path"), | 
					
						
							|  |  |  |                             "-I", toNative("/tmp/system_path"), | 
					
						
							|  |  |  |                             "/clang:-isystem", | 
					
						
							| 
									
										
										
										
											2020-09-03 11:17:12 +02:00
										 |  |  |                             "/clang:" + toNative(CLANG_INCLUDE_DIR ""), | 
					
						
							| 
									
										
										
										
											2020-08-29 23:34:18 +03:00
										 |  |  |                             "/clang:-isystem", | 
					
						
							|  |  |  |                             "/clang:" + toNative("/tmp/builtin_path"))); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | TEST_F(CompilerOptionsBuilder, BuildAllOptionsClWithExceptions) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     projectPart.toolchainType = ProjectExplorer::Constants::MSVC_TOOLCHAIN_TYPEID; | 
					
						
							|  |  |  |     projectPart.toolChainMacros.append(ProjectExplorer::Macro{"_CPPUNWIND", "1"}); | 
					
						
							|  |  |  |     CppTools::CompilerOptionsBuilder compilerOptionsBuilder(projectPart, | 
					
						
							|  |  |  |                                                             CppTools::UseSystemHeader::No, | 
					
						
							|  |  |  |                                                             CppTools::UseTweakedHeaderPaths::Yes, | 
					
						
							|  |  |  |                                                             CppTools::UseLanguageDefines::No, | 
					
						
							|  |  |  |                                                             CppTools::UseBuildSystemWarnings::No, | 
					
						
							|  |  |  |                                                             "dummy_version", | 
					
						
							|  |  |  |                                                             ""); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     compilerOptionsBuilder.build(ProjectFile::CXXSource, CppTools::UsePrecompiledHeaders::No); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-01-11 15:32:12 +01:00
										 |  |  |     ASSERT_THAT(compilerOptionsBuilder.options(), | 
					
						
							| 
									
										
										
										
											2019-01-17 15:27:36 +01:00
										 |  |  |                 ElementsAre("-nostdinc", | 
					
						
							|  |  |  |                             "-nostdinc++", | 
					
						
							|  |  |  |                             "--driver-mode=cl", | 
					
						
							| 
									
										
										
										
											2019-01-11 15:32:12 +01:00
										 |  |  |                             "/Zs", | 
					
						
							|  |  |  |                             "-m64", | 
					
						
							|  |  |  |                             "--target=x86_64-apple-darwin10", | 
					
						
							|  |  |  |                             "/TP", | 
					
						
							|  |  |  |                             "/std:c++17", | 
					
						
							| 
									
										
										
										
											2019-12-19 11:58:24 +01:00
										 |  |  |                             "-fcxx-exceptions", | 
					
						
							|  |  |  |                             "-fexceptions", | 
					
						
							| 
									
										
										
										
											2019-01-11 15:32:12 +01:00
										 |  |  |                             "-fms-compatibility-version=19.00", | 
					
						
							|  |  |  |                             "-DprojectFoo=projectBar", | 
					
						
							|  |  |  |                             "-D__FUNCSIG__=\"\"", | 
					
						
							|  |  |  |                             "-D__FUNCTION__=\"\"", | 
					
						
							|  |  |  |                             "-D__FUNCDNAME__=\"\"", | 
					
						
							| 
									
										
										
										
											2019-10-11 09:41:52 +02:00
										 |  |  |                             "-I", IsPartOfHeader("wrappedQtHeaders"), | 
					
						
							|  |  |  |                             "-I", IsPartOfHeader(toNative("wrappedQtHeaders/QtCore").toStdString()), | 
					
						
							|  |  |  |                             "-I", toNative("/tmp/path"), | 
					
						
							|  |  |  |                             "-I", toNative("/tmp/system_path"), | 
					
						
							| 
									
										
										
										
											2019-01-11 15:32:12 +01:00
										 |  |  |                             "/clang:-isystem", | 
					
						
							| 
									
										
										
										
											2020-08-24 10:46:58 +02:00
										 |  |  |                             "/clang:" + toNative(CLANG_INCLUDE_DIR ""), | 
					
						
							| 
									
										
										
										
											2019-01-17 15:27:36 +01:00
										 |  |  |                             "/clang:-isystem", | 
					
						
							| 
									
										
										
										
											2019-10-11 09:41:52 +02:00
										 |  |  |                             "/clang:" + toNative("/tmp/builtin_path"))); | 
					
						
							| 
									
										
										
										
											2018-10-09 14:26:47 +02:00
										 |  |  | } | 
					
						
							| 
									
										
										
										
											2019-10-11 09:41:52 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | } // namespace
 |