Clang: Extend ClangTool and CommandLineBuilder

We now support source file and not only header files and the file path is
now automatically added to the end. This removes quite some clutter.

Change-Id: I74eabd262e6c7e5f4d523e3a3cd194bd3efe1ef3
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
This commit is contained in:
Ivan Donchevskii
2019-01-30 13:59:30 +01:00
committed by Marco Bubke
parent d6a6d356bb
commit 7fe65851d9
16 changed files with 196 additions and 197 deletions

View File

@@ -35,12 +35,15 @@
namespace ClangBackEnd {
enum class InputFileType : unsigned char { Header, Source };
template<typename ProjectInfo, typename OutputContainer = Utils::SmallStringVector>
class CommandLineBuilder
{
public:
CommandLineBuilder(const ProjectInfo &projectInfo,
const Utils::SmallStringVector &toolChainArguments = {},
InputFileType sourceType = InputFileType::Header,
FilePathView sourcePath = {},
FilePathView outputPath = {},
FilePathView includePchPath = {})
@@ -49,7 +52,7 @@ public:
addCompiler(projectInfo.language);
addToolChainArguments(toolChainArguments);
addLanguage(projectInfo);
addLanguage(projectInfo, sourceType);
addLanguageVersion(projectInfo);
addNoStdIncAndNoStdLibInc();
addCompilerMacros(projectInfo.compilerMacros);
@@ -76,26 +79,27 @@ public:
commandLine.emplace_back(argument);
}
static const char *language(const ProjectInfo &projectInfo)
static const char *language(const ProjectInfo &projectInfo, InputFileType sourceType)
{
switch (projectInfo.language) {
case Utils::Language::C:
if (projectInfo.languageExtension && Utils::LanguageExtension::ObjectiveC)
return "objective-c-header";
return sourceType == InputFileType::Header ? "objective-c-header" : "objective-c";
return "c-header";
return sourceType == InputFileType::Header ? "c-header" : "c";
case Utils::Language::Cxx:
if (projectInfo.languageExtension && Utils::LanguageExtension::ObjectiveC)
return "objective-c++-header";
return sourceType == InputFileType::Header ? "objective-c++-header"
: "objective-c++";
}
return "c++-header";
return sourceType == InputFileType::Header ? "c++-header" : "c++";
}
void addLanguage(const ProjectInfo &projectInfo)
void addLanguage(const ProjectInfo &projectInfo, InputFileType sourceType)
{
commandLine.emplace_back("-x");
commandLine.emplace_back(language(projectInfo));
commandLine.emplace_back(language(projectInfo, sourceType));
}
const char *standardLanguageVersion(Utils::LanguageVersion languageVersion)

View File

@@ -47,8 +47,8 @@ FilePathIds operator+(const FilePathIds &first, const FilePathIds &second)
BuildDependency BuildDependencyCollector::create(const ProjectPartContainer &projectPart)
{
CommandLineBuilder<ProjectPartContainer, Utils::SmallStringVector> builder{
projectPart, projectPart.toolChainArguments};
CommandLineBuilder<ProjectPartContainer, Utils::SmallStringVector>
builder{projectPart, projectPart.toolChainArguments, InputFileType::Source};
addFiles(projectPart.sourcePathIds, builder.commandLine);

View File

@@ -72,7 +72,6 @@ Utils::SmallString PchCreator::generatePchIncludeFileContent(const FilePathIds &
return fileContent;
}
bool PchCreator::generatePch()
{
clang::tooling::ClangTool tool = m_clangTool.createOutputTool();
@@ -95,12 +94,12 @@ FilePath PchCreator::generatePchFilePath() const
}
Utils::SmallStringVector PchCreator::generateClangCompilerArguments(const PchTask &pchTask,
FilePathView sourceFilePath,
FilePathView pchOutputPath)
{
CommandLineBuilder<PchTask> builder{pchTask,
pchTask.toolChainArguments,
sourceFilePath,
InputFileType::Header,
{},
pchOutputPath,
pchTask.systemPchPath};
@@ -115,7 +114,6 @@ void PchCreator::generatePch(PchTask &&pchTask)
FilePath headerFilePath{m_environment.pchBuildDirectory().toStdString(), "dummy.h"};
Utils::SmallStringVector commandLine = generateClangCompilerArguments(pchTask,
headerFilePath,
pchOutputPath);
m_clangTool.addFile(std::move(headerFilePath), std::move(content), std::move(commandLine));

View File

@@ -85,7 +85,6 @@ public:
FilePath generatePchFilePath() const;
static Utils::SmallStringVector generateClangCompilerArguments(const PchTask &pchTask,
FilePathView includePchHeaderPath,
FilePathView pchPath);
const ClangTool &clangTool() const

View File

@@ -52,6 +52,9 @@ void ClangTool::addFile(FilePath &&filePath,
{
NativeFilePath nativeFilePath{filePath};
if (commandLine.back() != nativeFilePath.path())
commandLine.emplace_back(nativeFilePath.path());
m_compilationDatabase.addFile(nativeFilePath, std::move(commandLine));
m_sourceFilePaths.push_back(Utils::SmallStringView{nativeFilePath});
@@ -60,15 +63,8 @@ void ClangTool::addFile(FilePath &&filePath,
void ClangTool::addFiles(const FilePaths &filePaths, const Utils::SmallStringVector &arguments)
{
for (const FilePath &filePath : filePaths) {
std::string filePathStr(filePath.path());
auto commandLine = arguments;
NativeFilePath nativeFilePath{filePath};
commandLine.push_back(nativeFilePath.path());
addFile(filePath.clone(), {}, std::move(commandLine));
}
for (const FilePath &filePath : filePaths)
addFile(filePath.clone(), {}, arguments.clone());
}
void ClangTool::addUnsavedFiles(const V2::FileContainers &unsavedFiles)
@@ -104,13 +100,14 @@ clang::tooling::ClangTool ClangTool::createTool() const
clang::tooling::ClangTool tool(m_compilationDatabase, m_sourceFilePaths);
for (const auto &fileContent : m_fileContents) {
if (!fileContent.content.empty())
tool.mapVirtualFile(toStringRef(fileContent.filePath), fileContent.content);
if (fileContent.content.hasContent())
tool.mapVirtualFile(toStringRef(fileContent.filePath), toStringRef(fileContent.content));
}
for (const auto &unsavedFileContent : m_unsavedFileContents)
for (const auto &unsavedFileContent : m_unsavedFileContents) {
tool.mapVirtualFile(toStringRef(unsavedFileContent.filePath),
toStringRef(unsavedFileContent.content));
}
tool.mapVirtualFile("/dummyFile", "#pragma once");

View File

@@ -50,7 +50,7 @@ struct FileContent
{}
NativeFilePath filePath;
std::string content;
Utils::SmallString content;
};
struct UnsavedFileContent

View File

@@ -107,6 +107,7 @@ void SymbolIndexer::updateProjectPart(ProjectPartContainer &&projectPart)
using Builder = CommandLineBuilder<ProjectPartContainer, Utils::SmallStringVector>;
Builder commandLineBuilder{projectPart,
projectPart.toolChainArguments,
InputFileType::Source,
{},
{},
optionalProjectPartPch
@@ -181,8 +182,8 @@ void SymbolIndexer::updateChangedPath(FilePathId filePathId,
auto pchPath = optionalProjectPartPch ? optionalProjectPartPch.value().pchPath : FilePath{};
CommandLineBuilder<ProjectPartArtefact, Utils::SmallStringVector> builder{
artefact, artefact.toolChainArguments, {}, {}, pchPath};
CommandLineBuilder<ProjectPartArtefact, Utils::SmallStringVector>
builder{artefact, artefact.toolChainArguments, InputFileType::Source, {}, {}, pchPath};
auto indexing = [projectPartId = artefact.projectPartId, arguments=builder.commandLine, filePathId, this](
SymbolsCollectorInterface &symbolsCollector) {

View File

@@ -96,7 +96,7 @@ TEST_F(ClangQuerySlowTest, SourceRangeInUnsavedFileDeclarationRange)
::ClangQuery query(filePathCache);
query.addFile({TESTDATA_DIR "/query_simplefunction.cpp"},
"#include \"unsaved.h\"",
{"cc", toNativePath(TESTDATA_DIR "/query_simplefunction.cpp").path(), "-std=c++14"});
{"cc", "-std=c++14"});
query.setQuery("functionDecl()");
ClangBackEnd::V2::FileContainer unsavedFile{{TESTDATA_DIR, "unsaved.h"}, "void unsaved();", {}};
query.addUnsavedFiles({unsavedFile});
@@ -110,9 +110,7 @@ TEST_F(ClangQuerySlowTest, SourceRangeInUnsavedFileDeclarationRange)
TEST_F(ClangQuerySlowTest, FileIsNotExistingButTheUnsavedDataIsParsed)
{
::ClangQuery query(filePathCache);
query.addFile({TESTDATA_DIR "/foo.cpp"},
"void f() {}",
{"cc", toNativePath(TESTDATA_DIR "/foo.cpp").path(), "-std=c++14"});
query.addFile({TESTDATA_DIR "/foo.cpp"}, "void f() {}", {"cc", "-std=c++14"});
query.setQuery("functionDecl()");
query.findLocations();
@@ -124,9 +122,7 @@ TEST_F(ClangQuerySlowTest, FileIsNotExistingButTheUnsavedDataIsParsed)
TEST_F(ClangQuerySlowTest, DISABLED_SourceRangeInUnsavedFileDeclarationRangeOverride) // seems not to work in Clang
{
::ClangQuery query(filePathCache);
query.addFile({TESTDATA_DIR "/query_simplefunction.cpp"},
"void f() {}",
{"cc", toNativePath(TESTDATA_DIR "/query_simplefunction.cpp").path(), "-std=c++14"});
query.addFile({TESTDATA_DIR "/query_simplefunction.cpp"}, "void f() {}", {"cc", "-std=c++14"});
query.setQuery("functionDecl()");
ClangBackEnd::V2::FileContainer unsavedFile{{TESTDATA_DIR "/query_simplefunction.cpp"},
"void unsaved();",
@@ -226,12 +222,10 @@ void ClangQuery::SetUp()
simpleFunctionQuery.addFile({TESTDATA_DIR "/query_simplefunction.cpp"},
"",
{"cc",
toNativePath(TESTDATA_DIR "/query_simplefunction.cpp").path(),
"-std=c++14"});
simpleClassQuery.addFile({TESTDATA_DIR "/query_simpleclass.cpp"},
"",
{"cc",
toNativePath(TESTDATA_DIR "/query_simpleclass.cpp").path(),
"-std=c++14"});
}
} // namespace

View File

@@ -88,19 +88,16 @@ protected:
FileContainer source{{TESTDATA_DIR, "query_simplefunction.cpp"},
sourceContent.clone(),
{"cc",
toNativePath(TESTDATA_DIR "/query_simplefunction.cpp").path(),
"-I",
TESTDATA_DIR}};
FileContainer source2{{TESTDATA_DIR, "query_simplefunction2.cpp"},
{},
{"cc",
toNativePath(TESTDATA_DIR "/query_simplefunction2.cpp").path(),
"-I",
TESTDATA_DIR}};
FileContainer source3{{TESTDATA_DIR, "query_simplefunction3.cpp"},
{},
{"cc",
toNativePath(TESTDATA_DIR "/query_simplefunction3.cpp").path(),
"-I",
TESTDATA_DIR}};
Utils::SmallString unsavedContent{"void f();"};

View File

@@ -37,6 +37,7 @@ template<typename ProjectInfo>
using Builder = ClangBackEnd::CommandLineBuilder<ProjectInfo>;
using ClangBackEnd::IncludeSearchPathType;
using ClangBackEnd::InputFileType;
template <typename ProjectInfo>
class CommandLineBuilder : public testing::Test
@@ -124,30 +125,41 @@ TYPED_TEST_SUITE(CommandLineBuilder, ProjectInfos);
TYPED_TEST(CommandLineBuilder, AddToolChainArguments)
{
Builder<TypeParam> builder{this->emptyProjectInfo, {"-m64", "-PIC"}, {}};
Builder<TypeParam> builder{this->emptyProjectInfo, {"-m64", "-PIC"}, InputFileType::Header, {}};
ASSERT_THAT(builder.commandLine, AllOf(Contains("-m64"), Contains("-PIC")));
}
TYPED_TEST(CommandLineBuilder, CTask)
TYPED_TEST(CommandLineBuilder, CHeader)
{
this->emptyProjectInfo.language = Utils::Language::C;
this->emptyProjectInfo.languageVersion = Utils::LanguageVersion::C11;
Builder<TypeParam> builder{this->emptyProjectInfo, {}, "/source/file.c"};
Builder<TypeParam> builder{this->emptyProjectInfo, {}, InputFileType::Header, "/source/file.c"};
ASSERT_THAT(
builder.commandLine,
ElementsAre("clang", "-x", "c-header", "-std=c11", "-nostdinc", "-nostdinc++", toNativePath("/source/file.c").path()));
}
TYPED_TEST(CommandLineBuilder, ObjectiveCTask)
TYPED_TEST(CommandLineBuilder, CSource)
{
this->emptyProjectInfo.language = Utils::Language::C;
this->emptyProjectInfo.languageVersion = Utils::LanguageVersion::C11;
Builder<TypeParam> builder{this->emptyProjectInfo, {}, InputFileType::Source, "/source/file.c"};
ASSERT_THAT(builder.commandLine,
ElementsAre("clang", "-x", "c", "-std=c11", "-nostdinc", "-nostdinc++", "/source/file.c"));
}
TYPED_TEST(CommandLineBuilder, ObjectiveCHeader)
{
this->emptyProjectInfo.language = Utils::Language::C;
this->emptyProjectInfo.languageExtension = Utils::LanguageExtension::ObjectiveC;
this->emptyProjectInfo.languageVersion = Utils::LanguageVersion::C11;
Builder<TypeParam> builder{this->emptyProjectInfo, {}, "/source/file.c"};
Builder<TypeParam> builder{this->emptyProjectInfo, {}, InputFileType::Header, "/source/file.c"};
ASSERT_THAT(builder.commandLine,
ElementsAre("clang",
@@ -159,12 +171,30 @@ TYPED_TEST(CommandLineBuilder, ObjectiveCTask)
toNativePath("/source/file.c").path()));
}
TYPED_TEST(CommandLineBuilder, CppTask)
TYPED_TEST(CommandLineBuilder, ObjectiveCSource)
{
this->emptyProjectInfo.language = Utils::Language::C;
this->emptyProjectInfo.languageExtension = Utils::LanguageExtension::ObjectiveC;
this->emptyProjectInfo.languageVersion = Utils::LanguageVersion::C11;
Builder<TypeParam> builder{this->emptyProjectInfo, {}, InputFileType::Source, "/source/file.c"};
ASSERT_THAT(builder.commandLine,
ElementsAre("clang",
"-x",
"objective-c",
"-std=c11",
"-nostdinc",
"-nostdinc++",
"/source/file.c"));
}
TYPED_TEST(CommandLineBuilder, CppHeader)
{
this->emptyProjectInfo.language = Utils::Language::Cxx;
this->emptyProjectInfo.languageVersion = Utils::LanguageVersion::CXX98;
Builder<TypeParam> builder{this->emptyProjectInfo, {}, "/source/file.cpp"};
Builder<TypeParam> builder{this->emptyProjectInfo, {}, InputFileType::Header, "/source/file.cpp"};
ASSERT_THAT(builder.commandLine,
ElementsAre("clang++",
@@ -176,13 +206,25 @@ TYPED_TEST(CommandLineBuilder, CppTask)
toNativePath("/source/file.cpp").path()));
}
TYPED_TEST(CommandLineBuilder, ObjectiveCppTask)
TYPED_TEST(CommandLineBuilder, CppSource)
{
this->emptyProjectInfo.language = Utils::Language::Cxx;
this->emptyProjectInfo.languageVersion = Utils::LanguageVersion::CXX98;
Builder<TypeParam> builder{this->emptyProjectInfo, {}, InputFileType::Source, "/source/file.cpp"};
ASSERT_THAT(
builder.commandLine,
ElementsAre("clang++", "-x", "c++", "-std=c++98", "-nostdinc", "-nostdinc++", "/source/file.cpp"));
}
TYPED_TEST(CommandLineBuilder, ObjectiveCppHeader)
{
this->emptyProjectInfo.language = Utils::Language::Cxx;
this->emptyProjectInfo.languageExtension = Utils::LanguageExtension::ObjectiveC;
this->emptyProjectInfo.languageVersion = Utils::LanguageVersion::CXX98;
Builder<TypeParam> builder{this->emptyProjectInfo, {}, "/source/file.cpp"};
Builder<TypeParam> builder{this->emptyProjectInfo, {}, InputFileType::Header, "/source/file.cpp"};
ASSERT_THAT(builder.commandLine,
ElementsAre("clang++",
@@ -194,12 +236,30 @@ TYPED_TEST(CommandLineBuilder, ObjectiveCppTask)
toNativePath("/source/file.cpp").path()));
}
TYPED_TEST(CommandLineBuilder, ObjectiveCppSource)
{
this->emptyProjectInfo.language = Utils::Language::Cxx;
this->emptyProjectInfo.languageExtension = Utils::LanguageExtension::ObjectiveC;
this->emptyProjectInfo.languageVersion = Utils::LanguageVersion::CXX98;
Builder<TypeParam> builder{this->emptyProjectInfo, {}, InputFileType::Source, "/source/file.cpp"};
ASSERT_THAT(builder.commandLine,
ElementsAre("clang++",
"-x",
"objective-c++",
"-std=c++98",
"-nostdinc",
"-nostdinc++",
"/source/file.cpp"));
}
TYPED_TEST(CommandLineBuilder, Cpp98)
{
this->emptyProjectInfo.language = Utils::Language::Cxx;
this->emptyProjectInfo.languageVersion = Utils::LanguageVersion::CXX98;
Builder<TypeParam> builder{this->emptyProjectInfo, {}, "/source/file.cpp"};
Builder<TypeParam> builder{this->emptyProjectInfo, {}, InputFileType::Header, "/source/file.cpp"};
ASSERT_THAT(builder.commandLine, Contains("-std=c++98"));
}
@@ -209,7 +269,7 @@ TYPED_TEST(CommandLineBuilder, Cpp03)
this->emptyProjectInfo.language = Utils::Language::Cxx;
this->emptyProjectInfo.languageVersion = Utils::LanguageVersion::CXX03;
Builder<TypeParam> builder{this->emptyProjectInfo, {}, "/source/file.cpp"};
Builder<TypeParam> builder{this->emptyProjectInfo, {}, InputFileType::Header, "/source/file.cpp"};
ASSERT_THAT(builder.commandLine, Contains("-std=c++03"));
}
@@ -219,7 +279,7 @@ TYPED_TEST(CommandLineBuilder, Cpp11)
this->emptyProjectInfo.language = Utils::Language::Cxx;
this->emptyProjectInfo.languageVersion = Utils::LanguageVersion::CXX11;
Builder<TypeParam> builder{this->emptyProjectInfo, {}, "/source/file.cpp"};
Builder<TypeParam> builder{this->emptyProjectInfo, {}, InputFileType::Header, "/source/file.cpp"};
ASSERT_THAT(builder.commandLine, Contains("-std=c++11"));
}
@@ -229,7 +289,7 @@ TYPED_TEST(CommandLineBuilder, Cpp14)
this->emptyProjectInfo.language = Utils::Language::Cxx;
this->emptyProjectInfo.languageVersion = Utils::LanguageVersion::CXX14;
Builder<TypeParam> builder{this->emptyProjectInfo, {}, "/source/file.cpp"};
Builder<TypeParam> builder{this->emptyProjectInfo, {}, InputFileType::Header, "/source/file.cpp"};
ASSERT_THAT(builder.commandLine, Contains("-std=c++14"));
}
@@ -239,7 +299,7 @@ TYPED_TEST(CommandLineBuilder, Cpp17)
this->emptyProjectInfo.language = Utils::Language::Cxx;
this->emptyProjectInfo.languageVersion = Utils::LanguageVersion::CXX17;
Builder<TypeParam> builder{this->emptyProjectInfo, {}, "/source/file.cpp"};
Builder<TypeParam> builder{this->emptyProjectInfo, {}, InputFileType::Header, "/source/file.cpp"};
ASSERT_THAT(builder.commandLine, Contains("-std=c++17"));
}
@@ -249,7 +309,7 @@ TYPED_TEST(CommandLineBuilder, Cpp20)
this->emptyProjectInfo.language = Utils::Language::Cxx;
this->emptyProjectInfo.languageVersion = Utils::LanguageVersion::CXX2a;
Builder<TypeParam> builder{this->emptyProjectInfo, {}, "/source/file.cpp"};
Builder<TypeParam> builder{this->emptyProjectInfo, {}, InputFileType::Header, "/source/file.cpp"};
ASSERT_THAT(builder.commandLine, Contains("-std=c++2a"));
}
@@ -260,7 +320,7 @@ TYPED_TEST(CommandLineBuilder, GnuCpp98)
this->emptyProjectInfo.languageVersion = Utils::LanguageVersion::CXX98;
this->emptyProjectInfo.languageExtension = Utils::LanguageExtension::Gnu;
Builder<TypeParam> builder{this->emptyProjectInfo, {}, "/source/file.cpp"};
Builder<TypeParam> builder{this->emptyProjectInfo, {}, InputFileType::Header, "/source/file.cpp"};
ASSERT_THAT(builder.commandLine, Contains("-std=gnu++98"));
}
@@ -271,7 +331,7 @@ TYPED_TEST(CommandLineBuilder, GnuCpp03)
this->emptyProjectInfo.languageVersion = Utils::LanguageVersion::CXX03;
this->emptyProjectInfo.languageExtension = Utils::LanguageExtension::Gnu;
Builder<TypeParam> builder{this->emptyProjectInfo, {}, "/source/file.cpp"};
Builder<TypeParam> builder{this->emptyProjectInfo, {}, InputFileType::Header, "/source/file.cpp"};
ASSERT_THAT(builder.commandLine, Contains("-std=gnu++03"));
}
@@ -282,7 +342,7 @@ TYPED_TEST(CommandLineBuilder, GnuCpp11)
this->emptyProjectInfo.languageVersion = Utils::LanguageVersion::CXX11;
this->emptyProjectInfo.languageExtension = Utils::LanguageExtension::Gnu;
Builder<TypeParam> builder{this->emptyProjectInfo, {}, "/source/file.cpp"};
Builder<TypeParam> builder{this->emptyProjectInfo, {}, InputFileType::Header, "/source/file.cpp"};
ASSERT_THAT(builder.commandLine, Contains("-std=gnu++11"));
}
@@ -293,7 +353,7 @@ TYPED_TEST(CommandLineBuilder, GnuCpp14)
this->emptyProjectInfo.languageVersion = Utils::LanguageVersion::CXX14;
this->emptyProjectInfo.languageExtension = Utils::LanguageExtension::Gnu;
Builder<TypeParam> builder{this->emptyProjectInfo, {}, "/source/file.cpp"};
Builder<TypeParam> builder{this->emptyProjectInfo, {}, InputFileType::Header, "/source/file.cpp"};
ASSERT_THAT(builder.commandLine, Contains("-std=gnu++14"));
}
@@ -304,7 +364,7 @@ TYPED_TEST(CommandLineBuilder, GnuCpp17)
this->emptyProjectInfo.languageVersion = Utils::LanguageVersion::CXX17;
this->emptyProjectInfo.languageExtension = Utils::LanguageExtension::Gnu;
Builder<TypeParam> builder{this->emptyProjectInfo, {}, "/source/file.cpp"};
Builder<TypeParam> builder{this->emptyProjectInfo, {}, InputFileType::Header, "/source/file.cpp"};
ASSERT_THAT(builder.commandLine, Contains("-std=gnu++17"));
}
@@ -315,7 +375,7 @@ TYPED_TEST(CommandLineBuilder, GnuCpp20)
this->emptyProjectInfo.languageVersion = Utils::LanguageVersion::CXX2a;
this->emptyProjectInfo.languageExtension = Utils::LanguageExtension::Gnu;
Builder<TypeParam> builder{this->emptyProjectInfo, {}, "/source/file.cpp"};
Builder<TypeParam> builder{this->emptyProjectInfo, {}, InputFileType::Header, "/source/file.cpp"};
ASSERT_THAT(builder.commandLine, Contains("-std=gnu++2a"));
}
@@ -325,7 +385,7 @@ TYPED_TEST(CommandLineBuilder, C89)
this->emptyProjectInfo.language = Utils::Language::C;
this->emptyProjectInfo.languageVersion = Utils::LanguageVersion::C89;
Builder<TypeParam> builder{this->emptyProjectInfo, {}, "/source/file.c"};
Builder<TypeParam> builder{this->emptyProjectInfo, {}, InputFileType::Header, "/source/file.c"};
ASSERT_THAT(builder.commandLine, Contains("-std=c89"));
}
@@ -335,7 +395,7 @@ TYPED_TEST(CommandLineBuilder, C99)
this->emptyProjectInfo.language = Utils::Language::C;
this->emptyProjectInfo.languageVersion = Utils::LanguageVersion::C99;
Builder<TypeParam> builder{this->emptyProjectInfo, {}, "/source/file.c"};
Builder<TypeParam> builder{this->emptyProjectInfo, {}, InputFileType::Header, "/source/file.c"};
ASSERT_THAT(builder.commandLine, Contains("-std=c99"));
}
@@ -345,7 +405,7 @@ TYPED_TEST(CommandLineBuilder, C11)
this->emptyProjectInfo.language = Utils::Language::C;
this->emptyProjectInfo.languageVersion = Utils::LanguageVersion::C11;
Builder<TypeParam> builder{this->emptyProjectInfo, {}, "/source/file.c"};
Builder<TypeParam> builder{this->emptyProjectInfo, {}, InputFileType::Header, "/source/file.c"};
ASSERT_THAT(builder.commandLine, Contains("-std=c11"));
}
@@ -355,7 +415,7 @@ TYPED_TEST(CommandLineBuilder, C18)
this->emptyProjectInfo.language = Utils::Language::C;
this->emptyProjectInfo.languageVersion = Utils::LanguageVersion::C18;
Builder<TypeParam> builder{this->emptyProjectInfo, {}, "/source/file.c"};
Builder<TypeParam> builder{this->emptyProjectInfo, {}, InputFileType::Header, "/source/file.c"};
ASSERT_THAT(builder.commandLine, Contains("-std=c18"));
}
@@ -366,7 +426,7 @@ TYPED_TEST(CommandLineBuilder, GnuC89)
this->emptyProjectInfo.languageVersion = Utils::LanguageVersion::C89;
this->emptyProjectInfo.languageExtension = Utils::LanguageExtension::Gnu;
Builder<TypeParam> builder{this->emptyProjectInfo, {}, "/source/file.c"};
Builder<TypeParam> builder{this->emptyProjectInfo, {}, InputFileType::Header, "/source/file.c"};
ASSERT_THAT(builder.commandLine, Contains("-std=gnu89"));
}
@@ -377,7 +437,7 @@ TYPED_TEST(CommandLineBuilder, GnuC99)
this->emptyProjectInfo.languageVersion = Utils::LanguageVersion::C99;
this->emptyProjectInfo.languageExtension = Utils::LanguageExtension::Gnu;
Builder<TypeParam> builder{this->emptyProjectInfo, {}, "/source/file.c"};
Builder<TypeParam> builder{this->emptyProjectInfo, {}, InputFileType::Header, "/source/file.c"};
ASSERT_THAT(builder.commandLine, Contains("-std=gnu99"));
}
@@ -388,7 +448,7 @@ TYPED_TEST(CommandLineBuilder, GnuC11)
this->emptyProjectInfo.languageVersion = Utils::LanguageVersion::C11;
this->emptyProjectInfo.languageExtension = Utils::LanguageExtension::Gnu;
Builder<TypeParam> builder{this->emptyProjectInfo, {}, "/source/file.c"};
Builder<TypeParam> builder{this->emptyProjectInfo, {}, InputFileType::Header, "/source/file.c"};
ASSERT_THAT(builder.commandLine, Contains("-std=gnu11"));
}
@@ -399,7 +459,7 @@ TYPED_TEST(CommandLineBuilder, GnuC18)
this->emptyProjectInfo.languageVersion = Utils::LanguageVersion::C18;
this->emptyProjectInfo.languageExtension = Utils::LanguageExtension::Gnu;
Builder<TypeParam> builder{this->emptyProjectInfo, {}, "/source/file.c"};
Builder<TypeParam> builder{this->emptyProjectInfo, {}, InputFileType::Header, "/source/file.c"};
ASSERT_THAT(builder.commandLine, Contains("-std=gnu18"));
}
@@ -414,7 +474,7 @@ TYPED_TEST(CommandLineBuilder, IncludesOrder)
{"/system/foo", 3, IncludeSearchPathType::Framework},
{"/builtin/bar", 2, IncludeSearchPathType::BuiltIn},
{"/builtin/foo", 1, IncludeSearchPathType::BuiltIn}};
Builder<TypeParam> builder{this->emptyProjectInfo, {}, "/source/file.cpp"};
Builder<TypeParam> builder{this->emptyProjectInfo, {}, InputFileType::Header, "/source/file.cpp"};
ASSERT_THAT(builder.commandLine,
ElementsAre("clang++",
@@ -448,7 +508,7 @@ TYPED_TEST(CommandLineBuilder, EmptySourceFile)
TYPED_TEST(CommandLineBuilder, SourceFile)
{
Builder<TypeParam> builder{this->emptyProjectInfo, {}, "/source/file.cpp"};
Builder<TypeParam> builder{this->emptyProjectInfo, {}, InputFileType::Header, "/source/file.cpp"};
ASSERT_THAT(builder.commandLine,
ElementsAre("clang++",
@@ -463,7 +523,7 @@ TYPED_TEST(CommandLineBuilder, SourceFile)
TYPED_TEST(CommandLineBuilder, EmptyOutputFile)
{
Builder<TypeParam> builder{this->emptyProjectInfo, {}, "/source/file.cpp", ""};
Builder<TypeParam> builder{this->emptyProjectInfo, {}, InputFileType::Header, "/source/file.cpp", ""};
ASSERT_THAT(builder.commandLine,
ElementsAre("clang++",
@@ -477,7 +537,11 @@ TYPED_TEST(CommandLineBuilder, EmptyOutputFile)
TYPED_TEST(CommandLineBuilder, OutputFile)
{
Builder<TypeParam> builder{this->emptyProjectInfo, {}, "/source/file.cpp", "/output/file.o"};
Builder<TypeParam> builder{this->emptyProjectInfo,
{},
InputFileType::Header,
"/source/file.cpp",
"/output/file.o"};
ASSERT_THAT(builder.commandLine,
ElementsAre("clang++",
@@ -493,7 +557,12 @@ TYPED_TEST(CommandLineBuilder, OutputFile)
TYPED_TEST(CommandLineBuilder, IncludePchPath)
{
Builder<TypeParam> builder{this->emptyProjectInfo, {}, "/source/file.cpp", "/output/file.o", "/pch/file.pch"};
Builder<TypeParam> builder{this->emptyProjectInfo,
{},
InputFileType::Header,
"/source/file.cpp",
"/output/file.o",
"/pch/file.pch"};
ASSERT_THAT(builder.commandLine,
ElementsAre("clang++",
@@ -527,4 +596,5 @@ TYPED_TEST(CommandLineBuilder, CompilerMacros)
"-DER=2",
"-DYI=1"));
}
} // namespace

View File

@@ -133,9 +133,7 @@ TEST_F(PchCreator, CreateProjectPartPchFileContent)
TEST_F(PchCreator, CreateProjectPartClangCompilerArguments)
{
auto arguments = creator.generateClangCompilerArguments(std::move(pchTask1),
"project.h",
"project.pch");
auto arguments = creator.generateClangCompilerArguments(std::move(pchTask1), "project.pch");
ASSERT_THAT(arguments,
ElementsAre("clang++",
@@ -151,17 +149,14 @@ TEST_F(PchCreator, CreateProjectPartClangCompilerArguments)
"-isystem",
toNativePath(TESTDATA_DIR "/builddependencycollector/system").path(),
"-o",
"project.pch",
"project.h"));
"project.pch"));
}
TEST_F(PchCreator, CreateProjectPartClangCompilerArgumentsWithSystemPch)
{
pchTask1.systemPchPath = "system.pch";
auto arguments = creator.generateClangCompilerArguments(std::move(pchTask1),
"project.h",
"project.pch");
auto arguments = creator.generateClangCompilerArguments(std::move(pchTask1), "project.pch");
ASSERT_THAT(arguments,
ElementsAre("clang++",
@@ -181,8 +176,7 @@ TEST_F(PchCreator, CreateProjectPartClangCompilerArgumentsWithSystemPch)
"-Xclang",
"system.pch",
"-o",
"project.pch",
"project.h"));
"project.pch"));
}
TEST_F(PchCreatorVerySlowTest, ProjectPartPchsSendToPchManagerClient)

View File

@@ -103,12 +103,8 @@ TEST_F(RefactoringClientServerInProcess, SendSourceLocationsForRenamingMessage)
TEST_F(RefactoringClientServerInProcess, SendRequestSourceLocationsForRenamingMessage)
{
RequestSourceLocationsForRenamingMessage message{{TESTDATA_DIR, "renamevariable.cpp"},
1,
5,
"int v;\n\nint x = v + 3;\n",
{"cc", "renamevariable.cpp"},
1};
RequestSourceLocationsForRenamingMessage message{
{TESTDATA_DIR, "renamevariable.cpp"}, 1, 5, "int v;\n\nint x = v + 3;\n", {"cc"}, 1};
EXPECT_CALL(mockRefactoringServer, requestSourceLocationsForRenamingMessage(message));
@@ -153,15 +149,10 @@ TEST_F(RefactoringClientServerInProcess, SendProgressMessage)
TEST_F(RefactoringClientServerInProcess, RequestSourceRangesAndDiagnosticsForQueryMessage)
{
RequestSourceRangesForQueryMessage message{"functionDecl()",
{{{TESTDATA_DIR, "query_simplefunction.cpp"},
"void f();",
{"cc", "query_simplefunction.cpp"},
1}},
{{{TESTDATA_DIR, "query_simplefunction.h"},
"void f();",
{},
1}}};
RequestSourceRangesForQueryMessage message{
"functionDecl()",
{{{TESTDATA_DIR, "query_simplefunction.cpp"}, "void f();", {"cc"}, 1}},
{{{TESTDATA_DIR, "query_simplefunction.h"}, "void f();", {}, 1}}};
EXPECT_CALL(mockRefactoringServer, requestSourceRangesForQueryMessage(message));
@@ -171,15 +162,15 @@ TEST_F(RefactoringClientServerInProcess, RequestSourceRangesAndDiagnosticsForQue
TEST_F(RefactoringClientServerInProcess, RequestSourceRangesForQueryMessage)
{
RequestSourceRangesForQueryMessage message{"functionDecl()",
RequestSourceRangesForQueryMessage message{
"functionDecl()",
{{{TESTDATA_DIR, "query_simplefunction.cpp"},
"void f();",
{"cc", "query_simplefunction.cpp"},
{
"cc",
},
1}},
{{{TESTDATA_DIR, "query_simplefunction.h"},
"void f();",
{},
1}}};
{{{TESTDATA_DIR, "query_simplefunction.h"}, "void f();", {}, 1}}};
EXPECT_CALL(mockRefactoringServer, requestSourceRangesForQueryMessage(message));

View File

@@ -100,9 +100,7 @@ protected:
ClangBackEnd::GeneratedFiles generatedFiles;
ClangBackEnd::RefactoringServer refactoringServer{mockSymbolIndexing, filePathCache, generatedFiles};
Utils::SmallString sourceContent{"void f()\n {}"};
FileContainer source{{TESTDATA_DIR, "query_simplefunction.cpp"},
sourceContent.clone(),
{"cc", toNativePath(TESTDATA_DIR "/query_simplefunction.cpp").path()}};
FileContainer source{{TESTDATA_DIR, "query_simplefunction.cpp"}, sourceContent.clone(), {"cc"}};
QTemporaryFile temporaryFile{Utils::TemporaryDirectory::masterDirectoryPath()
+ "/clangQuery-XXXXXX.cpp"};
int processingSlotCount = 2;
@@ -113,12 +111,8 @@ using RefactoringServerVerySlowTest = RefactoringServer;
TEST_F(RefactoringServerSlowTest, RequestSourceLocationsForRenamingMessage)
{
RequestSourceLocationsForRenamingMessage message{{TESTDATA_DIR, "renamevariable.cpp"},
1,
5,
"int v;\n\nint x = v + 3;\n",
{"cc", "renamevariable.cpp"},
1};
RequestSourceLocationsForRenamingMessage message{
{TESTDATA_DIR, "renamevariable.cpp"}, 1, 5, "int v;\n\nint x = v + 3;\n", {"cc"}, 1};
EXPECT_CALL(mockRefactoringClient,
sourceLocationsForRenamingMessage(
@@ -152,13 +146,9 @@ TEST_F(RefactoringServerSlowTest, RequestSingleSourceRangesAndDiagnosticsWithUns
Utils::SmallString unsavedContent{"void f();"};
FileContainer source{{TESTDATA_DIR, "query_simplefunction.cpp"},
"#include \"query_simplefunction.h\"",
{"cc", "query_simplefunction.cpp"}};
FileContainer unsaved{{TESTDATA_DIR, "query_simplefunction.h"},
unsavedContent.clone(),
{}};
RequestSourceRangesForQueryMessage message{"functionDecl()",
{source.clone()},
{unsaved.clone()}};
{"cc"}};
FileContainer unsaved{{TESTDATA_DIR, "query_simplefunction.h"}, unsavedContent.clone(), {}};
RequestSourceRangesForQueryMessage message{"functionDecl()", {source.clone()}, {unsaved.clone()}};
EXPECT_CALL(mockRefactoringClient,
sourceRangesForQueryMessage(
@@ -267,11 +257,10 @@ TEST_F(RefactoringServer, PollTimerNotIsActiveAfterCanceling)
TEST_F(RefactoringServerSlowTest, ForValidRequestSourceRangesAndDiagnosticsGetSourceRange)
{
RequestSourceRangesAndDiagnosticsForQueryMessage message(
"functionDecl()",
RequestSourceRangesAndDiagnosticsForQueryMessage message("functionDecl()",
{FilePath(temporaryFile.fileName()),
"void f() {}",
{"cc", toNativePath(temporaryFile.fileName()).path()}});
{"cc"}});
EXPECT_CALL(mockRefactoringClient,
sourceRangesAndDiagnosticsForQueryMessage(
@@ -287,11 +276,10 @@ TEST_F(RefactoringServerSlowTest, ForValidRequestSourceRangesAndDiagnosticsGetSo
TEST_F(RefactoringServerSlowTest, ForInvalidRequestSourceRangesAndDiagnosticsGetDiagnostics)
{
RequestSourceRangesAndDiagnosticsForQueryMessage message(
"func()",
RequestSourceRangesAndDiagnosticsForQueryMessage message("func()",
{FilePath(temporaryFile.fileName()),
"void f() {}",
{"cc", toNativePath(temporaryFile.fileName()).path()}});
{"cc"}});
EXPECT_CALL(mockRefactoringClient,
sourceRangesAndDiagnosticsForQueryMessage(

View File

@@ -57,9 +57,7 @@ protected:
void TearDown() override;
protected:
TestClangTool clangTool{{TESTDATA_DIR "/sourcerangeextractor_location.cpp"},
"",
{"cc", "sourcerangeextractor_location.cpp"}};
TestClangTool clangTool{{TESTDATA_DIR "/sourcerangeextractor_location.cpp"}, "", {"cc"}};
ClangBackEnd::SourceRangesContainer sourceRangesContainer;
const clang::SourceManager &sourceManager{clangTool.sourceManager()};
Sqlite::Database database{":memory:", Sqlite::JournalMode::Memory};

View File

@@ -75,9 +75,7 @@ TEST_F(SymbolFinder, FileContentFilePath)
TEST_F(SymbolFinderSlowTest, FindName)
{
Finder finder(1, 5, filePathCaching);
finder.addFile({TESTDATA_DIR "/renamevariable.cpp"},
"int variable;",
{"cc", toNativePath(TESTDATA_DIR "/renamevariable.cpp").path()});
finder.addFile({TESTDATA_DIR "/renamevariable.cpp"}, "int variable;", {"cc"});
finder.findSymbol();
@@ -87,9 +85,7 @@ TEST_F(SymbolFinderSlowTest, FindName)
TEST_F(SymbolFinderSlowTest, FindNameInUnsavedFile)
{
Finder finder(1, 5, filePathCaching);
finder.addFile({TESTDATA_DIR "/renamevariable.cpp"},
"int newVariable;",
{"cc", toNativePath(TESTDATA_DIR "/renamevariable.cpp").path()});
finder.addFile({TESTDATA_DIR "/renamevariable.cpp"}, "int newVariable;", {"cc"});
finder.findSymbol();
@@ -99,9 +95,7 @@ TEST_F(SymbolFinderSlowTest, FindNameInUnsavedFile)
TEST_F(SymbolFinderSlowTest, FindUsrs)
{
Finder finder(1, 5, filePathCaching);
finder.addFile({TESTDATA_DIR "/renamevariable.cpp"},
"int variable;",
{"cc", toNativePath(TESTDATA_DIR "/renamevariable.cpp").path(), "-std=c++14"});
finder.addFile({TESTDATA_DIR "/renamevariable.cpp"}, "int variable;", {"cc", "-std=c++14"});
finder.findSymbol();
@@ -111,9 +105,7 @@ TEST_F(SymbolFinderSlowTest, FindUsrs)
TEST_F(SymbolFinderSlowTest, VariableDeclarationSourceLocations)
{
Finder finder(1, 5, filePathCaching);
finder.addFile({TESTDATA_DIR "/renamevariable.cpp"},
"",
{"cc", toNativePath(TESTDATA_DIR "/renamevariable.cpp").path(), "-std=c++14"});
finder.addFile({TESTDATA_DIR "/renamevariable.cpp"}, "", {"cc", "-std=c++14"});
finder.findSymbol();
@@ -125,9 +117,7 @@ TEST_F(SymbolFinderSlowTest, VariableDeclarationSourceLocations)
TEST_F(SymbolFinderSlowTest, VariableUsageSourceLocations)
{
Finder finder(3, 9, filePathCaching);
finder.addFile({TESTDATA_DIR "/renamevariable.cpp"},
"",
{"cc", toNativePath(TESTDATA_DIR "/renamevariable.cpp").path(), "-std=c++14"});
finder.addFile({TESTDATA_DIR "/renamevariable.cpp"}, "", {"cc", "-std=c++14"});
finder.findSymbol();
@@ -139,9 +129,7 @@ TEST_F(SymbolFinderSlowTest, VariableUsageSourceLocations)
TEST_F(SymbolFinderSlowTest, TemplateMemberVariableDeclarationSourceLocations)
{
Finder finder(8, 18, filePathCaching);
finder.addFile({TESTDATA_DIR "/renamevariable.cpp"},
"",
{"cc", toNativePath(TESTDATA_DIR "/renamevariable.cpp").path(), "-std=c++14"});
finder.addFile({TESTDATA_DIR "/renamevariable.cpp"}, "", {"cc", "-std=c++14"});
finder.findSymbol();
@@ -154,9 +142,7 @@ TEST_F(SymbolFinderSlowTest, TemplateMemberVariableDeclarationSourceLocations)
TEST_F(SymbolFinderSlowTest, TemplateMemberVariableUsageSourceLocations)
{
Finder finder(15, 14, filePathCaching);
finder.addFile({TESTDATA_DIR "/renamevariable.cpp"},
"",
{"cc", toNativePath(TESTDATA_DIR "/renamevariable.cpp").path(), "-std=c++14"});
finder.addFile({TESTDATA_DIR "/renamevariable.cpp"}, "", {"cc", "-std=c++14"});
finder.findSymbol();
@@ -169,9 +155,7 @@ TEST_F(SymbolFinderSlowTest, TemplateMemberVariableUsageSourceLocations)
TEST_F(SymbolFinderSlowTest, TemplateMemberVariableUsageInLambdaSourceLocations)
{
Finder finder(18, 19, filePathCaching);
finder.addFile({TESTDATA_DIR "/renamevariable.cpp"},
"",
{"cc", toNativePath(TESTDATA_DIR "/renamevariable.cpp").path(), "-std=c++14"});
finder.addFile({TESTDATA_DIR "/renamevariable.cpp"}, "", {"cc", "-std=c++14"});
finder.findSymbol();
@@ -184,9 +168,7 @@ TEST_F(SymbolFinderSlowTest, TemplateMemberVariableUsageInLambdaSourceLocations)
TEST_F(SymbolFinderSlowTest, CursorOverMacroDefintionSymbolName)
{
Finder finder(1, 9, filePathCaching);
finder.addFile({TESTDATA_DIR "/symbolfinder_macro.cpp"},
"",
{"cc", toNativePath(TESTDATA_DIR "/symbolfinder_macro.cpp").path()});
finder.addFile({TESTDATA_DIR "/symbolfinder_macro.cpp"}, "", {"cc"});
finder.findSymbol();
@@ -196,9 +178,7 @@ TEST_F(SymbolFinderSlowTest, CursorOverMacroDefintionSymbolName)
TEST_F(SymbolFinderSlowTest, CursorOverMacroExpansionSymbolName)
{
Finder finder(10, 10, filePathCaching);
finder.addFile({TESTDATA_DIR "/symbolfinder_macro.cpp"},
"",
{"cc", toNativePath(TESTDATA_DIR "/symbolfinder_macro.cpp").path()});
finder.addFile({TESTDATA_DIR "/symbolfinder_macro.cpp"}, "", {"cc"});
finder.findSymbol();
@@ -208,9 +188,7 @@ TEST_F(SymbolFinderSlowTest, CursorOverMacroExpansionSymbolName)
TEST_F(SymbolFinderSlowTest, FindMacroDefinition)
{
Finder finder(1, 9, filePathCaching);
finder.addFile({TESTDATA_DIR "/symbolfinder_macro.cpp"},
"",
{"cc", toNativePath(TESTDATA_DIR "/symbolfinder_macro.cpp").path()});
finder.addFile({TESTDATA_DIR "/symbolfinder_macro.cpp"}, "", {"cc"});
finder.findSymbol();
@@ -221,9 +199,7 @@ TEST_F(SymbolFinderSlowTest, FindMacroDefinition)
TEST_F(SymbolFinderSlowTest, FindMacroExpansion)
{
Finder finder(1, 9, filePathCaching);
finder.addFile({TESTDATA_DIR "/symbolfinder_macro.cpp"},
"",
{"cc", toNativePath(TESTDATA_DIR "/symbolfinder_macro.cpp").path()});
finder.addFile({TESTDATA_DIR "/symbolfinder_macro.cpp"}, "", {"cc"});
finder.findSymbol();
@@ -234,9 +210,7 @@ TEST_F(SymbolFinderSlowTest, FindMacroExpansion)
TEST_F(SymbolFinderSlowTest, DoNotFindUndedefinedMacroExpansion)
{
Finder finder(1, 9, filePathCaching);
finder.addFile({TESTDATA_DIR "/symbolfinder_macro.cpp"},
"",
{"cc", toNativePath(TESTDATA_DIR "/symbolfinder_macro.cpp").path()});
finder.addFile({TESTDATA_DIR "/symbolfinder_macro.cpp"}, "", {"cc"});
finder.findSymbol();
@@ -247,9 +221,7 @@ TEST_F(SymbolFinderSlowTest, DoNotFindUndedefinedMacroExpansion)
TEST_F(SymbolFinderSlowTest, FindMacroDefinitionFromMacroExpansion)
{
Finder finder(10, 10, filePathCaching);
finder.addFile({TESTDATA_DIR "/symbolfinder_macro.cpp"},
"",
{"cc", toNativePath(TESTDATA_DIR "/symbolfinder_macro.cpp").path()});
finder.addFile({TESTDATA_DIR "/symbolfinder_macro.cpp"}, "", {"cc"});
finder.findSymbol();
@@ -261,9 +233,7 @@ TEST_F(SymbolFinderSlowTest, FindMacroDefinitionFromMacroExpansion)
TEST_F(SymbolFinderSlowTest, FindMacroExpansionBeforeMacroExpansionWithCursor)
{
Finder finder(12, 10, filePathCaching);
finder.addFile({TESTDATA_DIR "/symbolfinder_macro.cpp"},
"",
{"cc", toNativePath(TESTDATA_DIR "/symbolfinder_macro.cpp").path()});
finder.addFile({TESTDATA_DIR "/symbolfinder_macro.cpp"}, "", {"cc"});
finder.findSymbol();
@@ -274,9 +244,7 @@ TEST_F(SymbolFinderSlowTest, FindMacroExpansionBeforeMacroExpansionWithCursor)
TEST_F(SymbolFinderSlowTest, FindMacroExpansionAfterMacroExpansionWithCursor)
{
Finder finder(10, 10, filePathCaching);
finder.addFile({TESTDATA_DIR "/symbolfinder_macro.cpp"},
"",
{"cc", toNativePath(TESTDATA_DIR "/symbolfinder_macro.cpp").path()});
finder.addFile({TESTDATA_DIR "/symbolfinder_macro.cpp"}, "", {"cc"});
finder.findSymbol();

View File

@@ -267,7 +267,7 @@ TEST_F(SymbolIndexer, UpdateProjectPartsCallsAddFilesInCollector)
ElementsAre("clang++",
"-Wno-pragma-once-outside-header",
"-x",
"c++-header",
"c++",
"-std=c++14",
"-nostdinc",
"-nostdinc++",
@@ -297,7 +297,7 @@ TEST_F(SymbolIndexer, UpdateProjectPartsCallsAddFilesWithPrecompiledHeaderInColl
ElementsAre("clang++",
"-Wno-pragma-once-outside-header",
"-x",
"c++-header",
"c++",
"-std=c++14",
"-nostdinc",
"-nostdinc++",
@@ -330,7 +330,7 @@ TEST_F(SymbolIndexer, UpdateProjectPartsCallsAddFilesWithoutPrecompiledHeaderInC
ElementsAre("clang++",
"-Wno-pragma-once-outside-header",
"-x",
"c++-header",
"c++",
"-std=c++14",
"-nostdinc",
"-nostdinc++",
@@ -510,7 +510,7 @@ TEST_F(SymbolIndexer, UpdateProjectPartsCallsInOrderWithoutProjectPartArtifact)
ElementsAre("clang++",
"-Wno-pragma-once-outside-header",
"-x",
"c++-header",
"c++",
"-std=c++14",
"-nostdinc",
"-nostdinc++",
@@ -562,7 +562,7 @@ TEST_F(SymbolIndexer, UpdateProjectPartsCallsInOrderWithProjectPartArtifact)
ElementsAre("clang++",
"-Wno-pragma-once-outside-header",
"-x",
"c++-header",
"c++",
"-std=c++14",
"-nostdinc",
"-nostdinc++",
@@ -618,7 +618,7 @@ TEST_F(SymbolIndexer, UpdateChangedPathCallsInOrder)
ElementsAre("clang++",
"-DFOO",
"-x",
"c++-header",
"c++",
"-std=c++14",
"-nostdinc",
"-nostdinc++",
@@ -680,7 +680,7 @@ TEST_F(SymbolIndexer, UpdateChangedPathIsUsingPrecompiledHeader)
ElementsAre("clang++",
"-DFOO",
"-x",
"c++-header",
"c++",
"-std=c++14",
"-nostdinc",
"-nostdinc++",
@@ -715,7 +715,7 @@ TEST_F(SymbolIndexer, UpdateChangedPathIsNotUsingPrecompiledHeaderIfItNotExists)
ElementsAre("clang++",
"-DFOO",
"-x",
"c++-header",
"c++",
"-std=c++14",
"-nostdinc",
"-nostdinc++",