forked from qt-creator/qt-creator
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:
committed by
Marco Bubke
parent
d6a6d356bb
commit
7fe65851d9
@@ -35,12 +35,15 @@
|
|||||||
|
|
||||||
namespace ClangBackEnd {
|
namespace ClangBackEnd {
|
||||||
|
|
||||||
|
enum class InputFileType : unsigned char { Header, Source };
|
||||||
|
|
||||||
template<typename ProjectInfo, typename OutputContainer = Utils::SmallStringVector>
|
template<typename ProjectInfo, typename OutputContainer = Utils::SmallStringVector>
|
||||||
class CommandLineBuilder
|
class CommandLineBuilder
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CommandLineBuilder(const ProjectInfo &projectInfo,
|
CommandLineBuilder(const ProjectInfo &projectInfo,
|
||||||
const Utils::SmallStringVector &toolChainArguments = {},
|
const Utils::SmallStringVector &toolChainArguments = {},
|
||||||
|
InputFileType sourceType = InputFileType::Header,
|
||||||
FilePathView sourcePath = {},
|
FilePathView sourcePath = {},
|
||||||
FilePathView outputPath = {},
|
FilePathView outputPath = {},
|
||||||
FilePathView includePchPath = {})
|
FilePathView includePchPath = {})
|
||||||
@@ -49,7 +52,7 @@ public:
|
|||||||
|
|
||||||
addCompiler(projectInfo.language);
|
addCompiler(projectInfo.language);
|
||||||
addToolChainArguments(toolChainArguments);
|
addToolChainArguments(toolChainArguments);
|
||||||
addLanguage(projectInfo);
|
addLanguage(projectInfo, sourceType);
|
||||||
addLanguageVersion(projectInfo);
|
addLanguageVersion(projectInfo);
|
||||||
addNoStdIncAndNoStdLibInc();
|
addNoStdIncAndNoStdLibInc();
|
||||||
addCompilerMacros(projectInfo.compilerMacros);
|
addCompilerMacros(projectInfo.compilerMacros);
|
||||||
@@ -76,26 +79,27 @@ public:
|
|||||||
commandLine.emplace_back(argument);
|
commandLine.emplace_back(argument);
|
||||||
}
|
}
|
||||||
|
|
||||||
static const char *language(const ProjectInfo &projectInfo)
|
static const char *language(const ProjectInfo &projectInfo, InputFileType sourceType)
|
||||||
{
|
{
|
||||||
switch (projectInfo.language) {
|
switch (projectInfo.language) {
|
||||||
case Utils::Language::C:
|
case Utils::Language::C:
|
||||||
if (projectInfo.languageExtension && Utils::LanguageExtension::ObjectiveC)
|
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:
|
case Utils::Language::Cxx:
|
||||||
if (projectInfo.languageExtension && Utils::LanguageExtension::ObjectiveC)
|
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("-x");
|
||||||
commandLine.emplace_back(language(projectInfo));
|
commandLine.emplace_back(language(projectInfo, sourceType));
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *standardLanguageVersion(Utils::LanguageVersion languageVersion)
|
const char *standardLanguageVersion(Utils::LanguageVersion languageVersion)
|
||||||
|
@@ -47,8 +47,8 @@ FilePathIds operator+(const FilePathIds &first, const FilePathIds &second)
|
|||||||
|
|
||||||
BuildDependency BuildDependencyCollector::create(const ProjectPartContainer &projectPart)
|
BuildDependency BuildDependencyCollector::create(const ProjectPartContainer &projectPart)
|
||||||
{
|
{
|
||||||
CommandLineBuilder<ProjectPartContainer, Utils::SmallStringVector> builder{
|
CommandLineBuilder<ProjectPartContainer, Utils::SmallStringVector>
|
||||||
projectPart, projectPart.toolChainArguments};
|
builder{projectPart, projectPart.toolChainArguments, InputFileType::Source};
|
||||||
|
|
||||||
addFiles(projectPart.sourcePathIds, builder.commandLine);
|
addFiles(projectPart.sourcePathIds, builder.commandLine);
|
||||||
|
|
||||||
|
@@ -72,7 +72,6 @@ Utils::SmallString PchCreator::generatePchIncludeFileContent(const FilePathIds &
|
|||||||
return fileContent;
|
return fileContent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool PchCreator::generatePch()
|
bool PchCreator::generatePch()
|
||||||
{
|
{
|
||||||
clang::tooling::ClangTool tool = m_clangTool.createOutputTool();
|
clang::tooling::ClangTool tool = m_clangTool.createOutputTool();
|
||||||
@@ -95,12 +94,12 @@ FilePath PchCreator::generatePchFilePath() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
Utils::SmallStringVector PchCreator::generateClangCompilerArguments(const PchTask &pchTask,
|
Utils::SmallStringVector PchCreator::generateClangCompilerArguments(const PchTask &pchTask,
|
||||||
FilePathView sourceFilePath,
|
|
||||||
FilePathView pchOutputPath)
|
FilePathView pchOutputPath)
|
||||||
{
|
{
|
||||||
CommandLineBuilder<PchTask> builder{pchTask,
|
CommandLineBuilder<PchTask> builder{pchTask,
|
||||||
pchTask.toolChainArguments,
|
pchTask.toolChainArguments,
|
||||||
sourceFilePath,
|
InputFileType::Header,
|
||||||
|
{},
|
||||||
pchOutputPath,
|
pchOutputPath,
|
||||||
pchTask.systemPchPath};
|
pchTask.systemPchPath};
|
||||||
|
|
||||||
@@ -115,7 +114,6 @@ void PchCreator::generatePch(PchTask &&pchTask)
|
|||||||
|
|
||||||
FilePath headerFilePath{m_environment.pchBuildDirectory().toStdString(), "dummy.h"};
|
FilePath headerFilePath{m_environment.pchBuildDirectory().toStdString(), "dummy.h"};
|
||||||
Utils::SmallStringVector commandLine = generateClangCompilerArguments(pchTask,
|
Utils::SmallStringVector commandLine = generateClangCompilerArguments(pchTask,
|
||||||
headerFilePath,
|
|
||||||
pchOutputPath);
|
pchOutputPath);
|
||||||
|
|
||||||
m_clangTool.addFile(std::move(headerFilePath), std::move(content), std::move(commandLine));
|
m_clangTool.addFile(std::move(headerFilePath), std::move(content), std::move(commandLine));
|
||||||
|
@@ -85,7 +85,6 @@ public:
|
|||||||
|
|
||||||
FilePath generatePchFilePath() const;
|
FilePath generatePchFilePath() const;
|
||||||
static Utils::SmallStringVector generateClangCompilerArguments(const PchTask &pchTask,
|
static Utils::SmallStringVector generateClangCompilerArguments(const PchTask &pchTask,
|
||||||
FilePathView includePchHeaderPath,
|
|
||||||
FilePathView pchPath);
|
FilePathView pchPath);
|
||||||
|
|
||||||
const ClangTool &clangTool() const
|
const ClangTool &clangTool() const
|
||||||
|
@@ -52,6 +52,9 @@ void ClangTool::addFile(FilePath &&filePath,
|
|||||||
{
|
{
|
||||||
NativeFilePath nativeFilePath{filePath};
|
NativeFilePath nativeFilePath{filePath};
|
||||||
|
|
||||||
|
if (commandLine.back() != nativeFilePath.path())
|
||||||
|
commandLine.emplace_back(nativeFilePath.path());
|
||||||
|
|
||||||
m_compilationDatabase.addFile(nativeFilePath, std::move(commandLine));
|
m_compilationDatabase.addFile(nativeFilePath, std::move(commandLine));
|
||||||
m_sourceFilePaths.push_back(Utils::SmallStringView{nativeFilePath});
|
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)
|
void ClangTool::addFiles(const FilePaths &filePaths, const Utils::SmallStringVector &arguments)
|
||||||
{
|
{
|
||||||
for (const FilePath &filePath : filePaths) {
|
for (const FilePath &filePath : filePaths)
|
||||||
std::string filePathStr(filePath.path());
|
addFile(filePath.clone(), {}, arguments.clone());
|
||||||
auto commandLine = arguments;
|
|
||||||
NativeFilePath nativeFilePath{filePath};
|
|
||||||
|
|
||||||
commandLine.push_back(nativeFilePath.path());
|
|
||||||
|
|
||||||
addFile(filePath.clone(), {}, std::move(commandLine));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClangTool::addUnsavedFiles(const V2::FileContainers &unsavedFiles)
|
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);
|
clang::tooling::ClangTool tool(m_compilationDatabase, m_sourceFilePaths);
|
||||||
|
|
||||||
for (const auto &fileContent : m_fileContents) {
|
for (const auto &fileContent : m_fileContents) {
|
||||||
if (!fileContent.content.empty())
|
if (fileContent.content.hasContent())
|
||||||
tool.mapVirtualFile(toStringRef(fileContent.filePath), fileContent.content);
|
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),
|
tool.mapVirtualFile(toStringRef(unsavedFileContent.filePath),
|
||||||
toStringRef(unsavedFileContent.content));
|
toStringRef(unsavedFileContent.content));
|
||||||
|
}
|
||||||
|
|
||||||
tool.mapVirtualFile("/dummyFile", "#pragma once");
|
tool.mapVirtualFile("/dummyFile", "#pragma once");
|
||||||
|
|
||||||
|
@@ -50,7 +50,7 @@ struct FileContent
|
|||||||
{}
|
{}
|
||||||
|
|
||||||
NativeFilePath filePath;
|
NativeFilePath filePath;
|
||||||
std::string content;
|
Utils::SmallString content;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct UnsavedFileContent
|
struct UnsavedFileContent
|
||||||
|
@@ -107,6 +107,7 @@ void SymbolIndexer::updateProjectPart(ProjectPartContainer &&projectPart)
|
|||||||
using Builder = CommandLineBuilder<ProjectPartContainer, Utils::SmallStringVector>;
|
using Builder = CommandLineBuilder<ProjectPartContainer, Utils::SmallStringVector>;
|
||||||
Builder commandLineBuilder{projectPart,
|
Builder commandLineBuilder{projectPart,
|
||||||
projectPart.toolChainArguments,
|
projectPart.toolChainArguments,
|
||||||
|
InputFileType::Source,
|
||||||
{},
|
{},
|
||||||
{},
|
{},
|
||||||
optionalProjectPartPch
|
optionalProjectPartPch
|
||||||
@@ -181,8 +182,8 @@ void SymbolIndexer::updateChangedPath(FilePathId filePathId,
|
|||||||
|
|
||||||
auto pchPath = optionalProjectPartPch ? optionalProjectPartPch.value().pchPath : FilePath{};
|
auto pchPath = optionalProjectPartPch ? optionalProjectPartPch.value().pchPath : FilePath{};
|
||||||
|
|
||||||
CommandLineBuilder<ProjectPartArtefact, Utils::SmallStringVector> builder{
|
CommandLineBuilder<ProjectPartArtefact, Utils::SmallStringVector>
|
||||||
artefact, artefact.toolChainArguments, {}, {}, pchPath};
|
builder{artefact, artefact.toolChainArguments, InputFileType::Source, {}, {}, pchPath};
|
||||||
|
|
||||||
auto indexing = [projectPartId = artefact.projectPartId, arguments=builder.commandLine, filePathId, this](
|
auto indexing = [projectPartId = artefact.projectPartId, arguments=builder.commandLine, filePathId, this](
|
||||||
SymbolsCollectorInterface &symbolsCollector) {
|
SymbolsCollectorInterface &symbolsCollector) {
|
||||||
|
@@ -96,7 +96,7 @@ TEST_F(ClangQuerySlowTest, SourceRangeInUnsavedFileDeclarationRange)
|
|||||||
::ClangQuery query(filePathCache);
|
::ClangQuery query(filePathCache);
|
||||||
query.addFile({TESTDATA_DIR "/query_simplefunction.cpp"},
|
query.addFile({TESTDATA_DIR "/query_simplefunction.cpp"},
|
||||||
"#include \"unsaved.h\"",
|
"#include \"unsaved.h\"",
|
||||||
{"cc", toNativePath(TESTDATA_DIR "/query_simplefunction.cpp").path(), "-std=c++14"});
|
{"cc", "-std=c++14"});
|
||||||
query.setQuery("functionDecl()");
|
query.setQuery("functionDecl()");
|
||||||
ClangBackEnd::V2::FileContainer unsavedFile{{TESTDATA_DIR, "unsaved.h"}, "void unsaved();", {}};
|
ClangBackEnd::V2::FileContainer unsavedFile{{TESTDATA_DIR, "unsaved.h"}, "void unsaved();", {}};
|
||||||
query.addUnsavedFiles({unsavedFile});
|
query.addUnsavedFiles({unsavedFile});
|
||||||
@@ -110,9 +110,7 @@ TEST_F(ClangQuerySlowTest, SourceRangeInUnsavedFileDeclarationRange)
|
|||||||
TEST_F(ClangQuerySlowTest, FileIsNotExistingButTheUnsavedDataIsParsed)
|
TEST_F(ClangQuerySlowTest, FileIsNotExistingButTheUnsavedDataIsParsed)
|
||||||
{
|
{
|
||||||
::ClangQuery query(filePathCache);
|
::ClangQuery query(filePathCache);
|
||||||
query.addFile({TESTDATA_DIR "/foo.cpp"},
|
query.addFile({TESTDATA_DIR "/foo.cpp"}, "void f() {}", {"cc", "-std=c++14"});
|
||||||
"void f() {}",
|
|
||||||
{"cc", toNativePath(TESTDATA_DIR "/foo.cpp").path(), "-std=c++14"});
|
|
||||||
query.setQuery("functionDecl()");
|
query.setQuery("functionDecl()");
|
||||||
|
|
||||||
query.findLocations();
|
query.findLocations();
|
||||||
@@ -124,9 +122,7 @@ TEST_F(ClangQuerySlowTest, FileIsNotExistingButTheUnsavedDataIsParsed)
|
|||||||
TEST_F(ClangQuerySlowTest, DISABLED_SourceRangeInUnsavedFileDeclarationRangeOverride) // seems not to work in Clang
|
TEST_F(ClangQuerySlowTest, DISABLED_SourceRangeInUnsavedFileDeclarationRangeOverride) // seems not to work in Clang
|
||||||
{
|
{
|
||||||
::ClangQuery query(filePathCache);
|
::ClangQuery query(filePathCache);
|
||||||
query.addFile({TESTDATA_DIR "/query_simplefunction.cpp"},
|
query.addFile({TESTDATA_DIR "/query_simplefunction.cpp"}, "void f() {}", {"cc", "-std=c++14"});
|
||||||
"void f() {}",
|
|
||||||
{"cc", toNativePath(TESTDATA_DIR "/query_simplefunction.cpp").path(), "-std=c++14"});
|
|
||||||
query.setQuery("functionDecl()");
|
query.setQuery("functionDecl()");
|
||||||
ClangBackEnd::V2::FileContainer unsavedFile{{TESTDATA_DIR "/query_simplefunction.cpp"},
|
ClangBackEnd::V2::FileContainer unsavedFile{{TESTDATA_DIR "/query_simplefunction.cpp"},
|
||||||
"void unsaved();",
|
"void unsaved();",
|
||||||
@@ -226,12 +222,10 @@ void ClangQuery::SetUp()
|
|||||||
simpleFunctionQuery.addFile({TESTDATA_DIR "/query_simplefunction.cpp"},
|
simpleFunctionQuery.addFile({TESTDATA_DIR "/query_simplefunction.cpp"},
|
||||||
"",
|
"",
|
||||||
{"cc",
|
{"cc",
|
||||||
toNativePath(TESTDATA_DIR "/query_simplefunction.cpp").path(),
|
|
||||||
"-std=c++14"});
|
"-std=c++14"});
|
||||||
simpleClassQuery.addFile({TESTDATA_DIR "/query_simpleclass.cpp"},
|
simpleClassQuery.addFile({TESTDATA_DIR "/query_simpleclass.cpp"},
|
||||||
"",
|
"",
|
||||||
{"cc",
|
{"cc",
|
||||||
toNativePath(TESTDATA_DIR "/query_simpleclass.cpp").path(),
|
|
||||||
"-std=c++14"});
|
"-std=c++14"});
|
||||||
}
|
}
|
||||||
} // namespace
|
} // namespace
|
||||||
|
@@ -88,19 +88,16 @@ protected:
|
|||||||
FileContainer source{{TESTDATA_DIR, "query_simplefunction.cpp"},
|
FileContainer source{{TESTDATA_DIR, "query_simplefunction.cpp"},
|
||||||
sourceContent.clone(),
|
sourceContent.clone(),
|
||||||
{"cc",
|
{"cc",
|
||||||
toNativePath(TESTDATA_DIR "/query_simplefunction.cpp").path(),
|
|
||||||
"-I",
|
"-I",
|
||||||
TESTDATA_DIR}};
|
TESTDATA_DIR}};
|
||||||
FileContainer source2{{TESTDATA_DIR, "query_simplefunction2.cpp"},
|
FileContainer source2{{TESTDATA_DIR, "query_simplefunction2.cpp"},
|
||||||
{},
|
{},
|
||||||
{"cc",
|
{"cc",
|
||||||
toNativePath(TESTDATA_DIR "/query_simplefunction2.cpp").path(),
|
|
||||||
"-I",
|
"-I",
|
||||||
TESTDATA_DIR}};
|
TESTDATA_DIR}};
|
||||||
FileContainer source3{{TESTDATA_DIR, "query_simplefunction3.cpp"},
|
FileContainer source3{{TESTDATA_DIR, "query_simplefunction3.cpp"},
|
||||||
{},
|
{},
|
||||||
{"cc",
|
{"cc",
|
||||||
toNativePath(TESTDATA_DIR "/query_simplefunction3.cpp").path(),
|
|
||||||
"-I",
|
"-I",
|
||||||
TESTDATA_DIR}};
|
TESTDATA_DIR}};
|
||||||
Utils::SmallString unsavedContent{"void f();"};
|
Utils::SmallString unsavedContent{"void f();"};
|
||||||
|
@@ -37,6 +37,7 @@ template<typename ProjectInfo>
|
|||||||
using Builder = ClangBackEnd::CommandLineBuilder<ProjectInfo>;
|
using Builder = ClangBackEnd::CommandLineBuilder<ProjectInfo>;
|
||||||
|
|
||||||
using ClangBackEnd::IncludeSearchPathType;
|
using ClangBackEnd::IncludeSearchPathType;
|
||||||
|
using ClangBackEnd::InputFileType;
|
||||||
|
|
||||||
template <typename ProjectInfo>
|
template <typename ProjectInfo>
|
||||||
class CommandLineBuilder : public testing::Test
|
class CommandLineBuilder : public testing::Test
|
||||||
@@ -124,30 +125,41 @@ TYPED_TEST_SUITE(CommandLineBuilder, ProjectInfos);
|
|||||||
|
|
||||||
TYPED_TEST(CommandLineBuilder, AddToolChainArguments)
|
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")));
|
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.language = Utils::Language::C;
|
||||||
this->emptyProjectInfo.languageVersion = Utils::LanguageVersion::C11;
|
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(
|
ASSERT_THAT(
|
||||||
builder.commandLine,
|
builder.commandLine,
|
||||||
ElementsAre("clang", "-x", "c-header", "-std=c11", "-nostdinc", "-nostdinc++", toNativePath("/source/file.c").path()));
|
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.language = Utils::Language::C;
|
||||||
this->emptyProjectInfo.languageExtension = Utils::LanguageExtension::ObjectiveC;
|
this->emptyProjectInfo.languageExtension = Utils::LanguageExtension::ObjectiveC;
|
||||||
this->emptyProjectInfo.languageVersion = Utils::LanguageVersion::C11;
|
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,
|
ASSERT_THAT(builder.commandLine,
|
||||||
ElementsAre("clang",
|
ElementsAre("clang",
|
||||||
@@ -159,12 +171,30 @@ TYPED_TEST(CommandLineBuilder, ObjectiveCTask)
|
|||||||
toNativePath("/source/file.c").path()));
|
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.language = Utils::Language::Cxx;
|
||||||
this->emptyProjectInfo.languageVersion = Utils::LanguageVersion::CXX98;
|
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,
|
ASSERT_THAT(builder.commandLine,
|
||||||
ElementsAre("clang++",
|
ElementsAre("clang++",
|
||||||
@@ -176,13 +206,25 @@ TYPED_TEST(CommandLineBuilder, CppTask)
|
|||||||
toNativePath("/source/file.cpp").path()));
|
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.language = Utils::Language::Cxx;
|
||||||
this->emptyProjectInfo.languageExtension = Utils::LanguageExtension::ObjectiveC;
|
this->emptyProjectInfo.languageExtension = Utils::LanguageExtension::ObjectiveC;
|
||||||
this->emptyProjectInfo.languageVersion = Utils::LanguageVersion::CXX98;
|
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,
|
ASSERT_THAT(builder.commandLine,
|
||||||
ElementsAre("clang++",
|
ElementsAre("clang++",
|
||||||
@@ -194,12 +236,30 @@ TYPED_TEST(CommandLineBuilder, ObjectiveCppTask)
|
|||||||
toNativePath("/source/file.cpp").path()));
|
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)
|
TYPED_TEST(CommandLineBuilder, Cpp98)
|
||||||
{
|
{
|
||||||
this->emptyProjectInfo.language = Utils::Language::Cxx;
|
this->emptyProjectInfo.language = Utils::Language::Cxx;
|
||||||
this->emptyProjectInfo.languageVersion = Utils::LanguageVersion::CXX98;
|
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"));
|
ASSERT_THAT(builder.commandLine, Contains("-std=c++98"));
|
||||||
}
|
}
|
||||||
@@ -209,7 +269,7 @@ TYPED_TEST(CommandLineBuilder, Cpp03)
|
|||||||
this->emptyProjectInfo.language = Utils::Language::Cxx;
|
this->emptyProjectInfo.language = Utils::Language::Cxx;
|
||||||
this->emptyProjectInfo.languageVersion = Utils::LanguageVersion::CXX03;
|
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"));
|
ASSERT_THAT(builder.commandLine, Contains("-std=c++03"));
|
||||||
}
|
}
|
||||||
@@ -219,7 +279,7 @@ TYPED_TEST(CommandLineBuilder, Cpp11)
|
|||||||
this->emptyProjectInfo.language = Utils::Language::Cxx;
|
this->emptyProjectInfo.language = Utils::Language::Cxx;
|
||||||
this->emptyProjectInfo.languageVersion = Utils::LanguageVersion::CXX11;
|
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"));
|
ASSERT_THAT(builder.commandLine, Contains("-std=c++11"));
|
||||||
}
|
}
|
||||||
@@ -229,7 +289,7 @@ TYPED_TEST(CommandLineBuilder, Cpp14)
|
|||||||
this->emptyProjectInfo.language = Utils::Language::Cxx;
|
this->emptyProjectInfo.language = Utils::Language::Cxx;
|
||||||
this->emptyProjectInfo.languageVersion = Utils::LanguageVersion::CXX14;
|
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"));
|
ASSERT_THAT(builder.commandLine, Contains("-std=c++14"));
|
||||||
}
|
}
|
||||||
@@ -239,7 +299,7 @@ TYPED_TEST(CommandLineBuilder, Cpp17)
|
|||||||
this->emptyProjectInfo.language = Utils::Language::Cxx;
|
this->emptyProjectInfo.language = Utils::Language::Cxx;
|
||||||
this->emptyProjectInfo.languageVersion = Utils::LanguageVersion::CXX17;
|
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"));
|
ASSERT_THAT(builder.commandLine, Contains("-std=c++17"));
|
||||||
}
|
}
|
||||||
@@ -249,7 +309,7 @@ TYPED_TEST(CommandLineBuilder, Cpp20)
|
|||||||
this->emptyProjectInfo.language = Utils::Language::Cxx;
|
this->emptyProjectInfo.language = Utils::Language::Cxx;
|
||||||
this->emptyProjectInfo.languageVersion = Utils::LanguageVersion::CXX2a;
|
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"));
|
ASSERT_THAT(builder.commandLine, Contains("-std=c++2a"));
|
||||||
}
|
}
|
||||||
@@ -260,7 +320,7 @@ TYPED_TEST(CommandLineBuilder, GnuCpp98)
|
|||||||
this->emptyProjectInfo.languageVersion = Utils::LanguageVersion::CXX98;
|
this->emptyProjectInfo.languageVersion = Utils::LanguageVersion::CXX98;
|
||||||
this->emptyProjectInfo.languageExtension = Utils::LanguageExtension::Gnu;
|
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"));
|
ASSERT_THAT(builder.commandLine, Contains("-std=gnu++98"));
|
||||||
}
|
}
|
||||||
@@ -271,7 +331,7 @@ TYPED_TEST(CommandLineBuilder, GnuCpp03)
|
|||||||
this->emptyProjectInfo.languageVersion = Utils::LanguageVersion::CXX03;
|
this->emptyProjectInfo.languageVersion = Utils::LanguageVersion::CXX03;
|
||||||
this->emptyProjectInfo.languageExtension = Utils::LanguageExtension::Gnu;
|
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"));
|
ASSERT_THAT(builder.commandLine, Contains("-std=gnu++03"));
|
||||||
}
|
}
|
||||||
@@ -282,7 +342,7 @@ TYPED_TEST(CommandLineBuilder, GnuCpp11)
|
|||||||
this->emptyProjectInfo.languageVersion = Utils::LanguageVersion::CXX11;
|
this->emptyProjectInfo.languageVersion = Utils::LanguageVersion::CXX11;
|
||||||
this->emptyProjectInfo.languageExtension = Utils::LanguageExtension::Gnu;
|
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"));
|
ASSERT_THAT(builder.commandLine, Contains("-std=gnu++11"));
|
||||||
}
|
}
|
||||||
@@ -293,7 +353,7 @@ TYPED_TEST(CommandLineBuilder, GnuCpp14)
|
|||||||
this->emptyProjectInfo.languageVersion = Utils::LanguageVersion::CXX14;
|
this->emptyProjectInfo.languageVersion = Utils::LanguageVersion::CXX14;
|
||||||
this->emptyProjectInfo.languageExtension = Utils::LanguageExtension::Gnu;
|
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"));
|
ASSERT_THAT(builder.commandLine, Contains("-std=gnu++14"));
|
||||||
}
|
}
|
||||||
@@ -304,7 +364,7 @@ TYPED_TEST(CommandLineBuilder, GnuCpp17)
|
|||||||
this->emptyProjectInfo.languageVersion = Utils::LanguageVersion::CXX17;
|
this->emptyProjectInfo.languageVersion = Utils::LanguageVersion::CXX17;
|
||||||
this->emptyProjectInfo.languageExtension = Utils::LanguageExtension::Gnu;
|
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"));
|
ASSERT_THAT(builder.commandLine, Contains("-std=gnu++17"));
|
||||||
}
|
}
|
||||||
@@ -315,7 +375,7 @@ TYPED_TEST(CommandLineBuilder, GnuCpp20)
|
|||||||
this->emptyProjectInfo.languageVersion = Utils::LanguageVersion::CXX2a;
|
this->emptyProjectInfo.languageVersion = Utils::LanguageVersion::CXX2a;
|
||||||
this->emptyProjectInfo.languageExtension = Utils::LanguageExtension::Gnu;
|
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"));
|
ASSERT_THAT(builder.commandLine, Contains("-std=gnu++2a"));
|
||||||
}
|
}
|
||||||
@@ -325,7 +385,7 @@ TYPED_TEST(CommandLineBuilder, C89)
|
|||||||
this->emptyProjectInfo.language = Utils::Language::C;
|
this->emptyProjectInfo.language = Utils::Language::C;
|
||||||
this->emptyProjectInfo.languageVersion = Utils::LanguageVersion::C89;
|
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"));
|
ASSERT_THAT(builder.commandLine, Contains("-std=c89"));
|
||||||
}
|
}
|
||||||
@@ -335,7 +395,7 @@ TYPED_TEST(CommandLineBuilder, C99)
|
|||||||
this->emptyProjectInfo.language = Utils::Language::C;
|
this->emptyProjectInfo.language = Utils::Language::C;
|
||||||
this->emptyProjectInfo.languageVersion = Utils::LanguageVersion::C99;
|
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"));
|
ASSERT_THAT(builder.commandLine, Contains("-std=c99"));
|
||||||
}
|
}
|
||||||
@@ -345,7 +405,7 @@ TYPED_TEST(CommandLineBuilder, C11)
|
|||||||
this->emptyProjectInfo.language = Utils::Language::C;
|
this->emptyProjectInfo.language = Utils::Language::C;
|
||||||
this->emptyProjectInfo.languageVersion = Utils::LanguageVersion::C11;
|
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"));
|
ASSERT_THAT(builder.commandLine, Contains("-std=c11"));
|
||||||
}
|
}
|
||||||
@@ -355,7 +415,7 @@ TYPED_TEST(CommandLineBuilder, C18)
|
|||||||
this->emptyProjectInfo.language = Utils::Language::C;
|
this->emptyProjectInfo.language = Utils::Language::C;
|
||||||
this->emptyProjectInfo.languageVersion = Utils::LanguageVersion::C18;
|
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"));
|
ASSERT_THAT(builder.commandLine, Contains("-std=c18"));
|
||||||
}
|
}
|
||||||
@@ -366,7 +426,7 @@ TYPED_TEST(CommandLineBuilder, GnuC89)
|
|||||||
this->emptyProjectInfo.languageVersion = Utils::LanguageVersion::C89;
|
this->emptyProjectInfo.languageVersion = Utils::LanguageVersion::C89;
|
||||||
this->emptyProjectInfo.languageExtension = Utils::LanguageExtension::Gnu;
|
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"));
|
ASSERT_THAT(builder.commandLine, Contains("-std=gnu89"));
|
||||||
}
|
}
|
||||||
@@ -377,7 +437,7 @@ TYPED_TEST(CommandLineBuilder, GnuC99)
|
|||||||
this->emptyProjectInfo.languageVersion = Utils::LanguageVersion::C99;
|
this->emptyProjectInfo.languageVersion = Utils::LanguageVersion::C99;
|
||||||
this->emptyProjectInfo.languageExtension = Utils::LanguageExtension::Gnu;
|
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"));
|
ASSERT_THAT(builder.commandLine, Contains("-std=gnu99"));
|
||||||
}
|
}
|
||||||
@@ -388,7 +448,7 @@ TYPED_TEST(CommandLineBuilder, GnuC11)
|
|||||||
this->emptyProjectInfo.languageVersion = Utils::LanguageVersion::C11;
|
this->emptyProjectInfo.languageVersion = Utils::LanguageVersion::C11;
|
||||||
this->emptyProjectInfo.languageExtension = Utils::LanguageExtension::Gnu;
|
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"));
|
ASSERT_THAT(builder.commandLine, Contains("-std=gnu11"));
|
||||||
}
|
}
|
||||||
@@ -399,7 +459,7 @@ TYPED_TEST(CommandLineBuilder, GnuC18)
|
|||||||
this->emptyProjectInfo.languageVersion = Utils::LanguageVersion::C18;
|
this->emptyProjectInfo.languageVersion = Utils::LanguageVersion::C18;
|
||||||
this->emptyProjectInfo.languageExtension = Utils::LanguageExtension::Gnu;
|
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"));
|
ASSERT_THAT(builder.commandLine, Contains("-std=gnu18"));
|
||||||
}
|
}
|
||||||
@@ -414,7 +474,7 @@ TYPED_TEST(CommandLineBuilder, IncludesOrder)
|
|||||||
{"/system/foo", 3, IncludeSearchPathType::Framework},
|
{"/system/foo", 3, IncludeSearchPathType::Framework},
|
||||||
{"/builtin/bar", 2, IncludeSearchPathType::BuiltIn},
|
{"/builtin/bar", 2, IncludeSearchPathType::BuiltIn},
|
||||||
{"/builtin/foo", 1, 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,
|
ASSERT_THAT(builder.commandLine,
|
||||||
ElementsAre("clang++",
|
ElementsAre("clang++",
|
||||||
@@ -448,7 +508,7 @@ TYPED_TEST(CommandLineBuilder, EmptySourceFile)
|
|||||||
|
|
||||||
TYPED_TEST(CommandLineBuilder, SourceFile)
|
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,
|
ASSERT_THAT(builder.commandLine,
|
||||||
ElementsAre("clang++",
|
ElementsAre("clang++",
|
||||||
@@ -463,7 +523,7 @@ TYPED_TEST(CommandLineBuilder, SourceFile)
|
|||||||
|
|
||||||
TYPED_TEST(CommandLineBuilder, EmptyOutputFile)
|
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,
|
ASSERT_THAT(builder.commandLine,
|
||||||
ElementsAre("clang++",
|
ElementsAre("clang++",
|
||||||
@@ -477,7 +537,11 @@ TYPED_TEST(CommandLineBuilder, EmptyOutputFile)
|
|||||||
|
|
||||||
TYPED_TEST(CommandLineBuilder, OutputFile)
|
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,
|
ASSERT_THAT(builder.commandLine,
|
||||||
ElementsAre("clang++",
|
ElementsAre("clang++",
|
||||||
@@ -493,7 +557,12 @@ TYPED_TEST(CommandLineBuilder, OutputFile)
|
|||||||
|
|
||||||
TYPED_TEST(CommandLineBuilder, IncludePchPath)
|
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,
|
ASSERT_THAT(builder.commandLine,
|
||||||
ElementsAre("clang++",
|
ElementsAre("clang++",
|
||||||
@@ -527,4 +596,5 @@ TYPED_TEST(CommandLineBuilder, CompilerMacros)
|
|||||||
"-DER=2",
|
"-DER=2",
|
||||||
"-DYI=1"));
|
"-DYI=1"));
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
@@ -133,9 +133,7 @@ TEST_F(PchCreator, CreateProjectPartPchFileContent)
|
|||||||
|
|
||||||
TEST_F(PchCreator, CreateProjectPartClangCompilerArguments)
|
TEST_F(PchCreator, CreateProjectPartClangCompilerArguments)
|
||||||
{
|
{
|
||||||
auto arguments = creator.generateClangCompilerArguments(std::move(pchTask1),
|
auto arguments = creator.generateClangCompilerArguments(std::move(pchTask1), "project.pch");
|
||||||
"project.h",
|
|
||||||
"project.pch");
|
|
||||||
|
|
||||||
ASSERT_THAT(arguments,
|
ASSERT_THAT(arguments,
|
||||||
ElementsAre("clang++",
|
ElementsAre("clang++",
|
||||||
@@ -151,17 +149,14 @@ TEST_F(PchCreator, CreateProjectPartClangCompilerArguments)
|
|||||||
"-isystem",
|
"-isystem",
|
||||||
toNativePath(TESTDATA_DIR "/builddependencycollector/system").path(),
|
toNativePath(TESTDATA_DIR "/builddependencycollector/system").path(),
|
||||||
"-o",
|
"-o",
|
||||||
"project.pch",
|
"project.pch"));
|
||||||
"project.h"));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(PchCreator, CreateProjectPartClangCompilerArgumentsWithSystemPch)
|
TEST_F(PchCreator, CreateProjectPartClangCompilerArgumentsWithSystemPch)
|
||||||
{
|
{
|
||||||
pchTask1.systemPchPath = "system.pch";
|
pchTask1.systemPchPath = "system.pch";
|
||||||
|
|
||||||
auto arguments = creator.generateClangCompilerArguments(std::move(pchTask1),
|
auto arguments = creator.generateClangCompilerArguments(std::move(pchTask1), "project.pch");
|
||||||
"project.h",
|
|
||||||
"project.pch");
|
|
||||||
|
|
||||||
ASSERT_THAT(arguments,
|
ASSERT_THAT(arguments,
|
||||||
ElementsAre("clang++",
|
ElementsAre("clang++",
|
||||||
@@ -181,8 +176,7 @@ TEST_F(PchCreator, CreateProjectPartClangCompilerArgumentsWithSystemPch)
|
|||||||
"-Xclang",
|
"-Xclang",
|
||||||
"system.pch",
|
"system.pch",
|
||||||
"-o",
|
"-o",
|
||||||
"project.pch",
|
"project.pch"));
|
||||||
"project.h"));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(PchCreatorVerySlowTest, ProjectPartPchsSendToPchManagerClient)
|
TEST_F(PchCreatorVerySlowTest, ProjectPartPchsSendToPchManagerClient)
|
||||||
|
@@ -103,12 +103,8 @@ TEST_F(RefactoringClientServerInProcess, SendSourceLocationsForRenamingMessage)
|
|||||||
|
|
||||||
TEST_F(RefactoringClientServerInProcess, SendRequestSourceLocationsForRenamingMessage)
|
TEST_F(RefactoringClientServerInProcess, SendRequestSourceLocationsForRenamingMessage)
|
||||||
{
|
{
|
||||||
RequestSourceLocationsForRenamingMessage message{{TESTDATA_DIR, "renamevariable.cpp"},
|
RequestSourceLocationsForRenamingMessage message{
|
||||||
1,
|
{TESTDATA_DIR, "renamevariable.cpp"}, 1, 5, "int v;\n\nint x = v + 3;\n", {"cc"}, 1};
|
||||||
5,
|
|
||||||
"int v;\n\nint x = v + 3;\n",
|
|
||||||
{"cc", "renamevariable.cpp"},
|
|
||||||
1};
|
|
||||||
|
|
||||||
EXPECT_CALL(mockRefactoringServer, requestSourceLocationsForRenamingMessage(message));
|
EXPECT_CALL(mockRefactoringServer, requestSourceLocationsForRenamingMessage(message));
|
||||||
|
|
||||||
@@ -153,15 +149,10 @@ TEST_F(RefactoringClientServerInProcess, SendProgressMessage)
|
|||||||
|
|
||||||
TEST_F(RefactoringClientServerInProcess, RequestSourceRangesAndDiagnosticsForQueryMessage)
|
TEST_F(RefactoringClientServerInProcess, RequestSourceRangesAndDiagnosticsForQueryMessage)
|
||||||
{
|
{
|
||||||
RequestSourceRangesForQueryMessage message{"functionDecl()",
|
RequestSourceRangesForQueryMessage message{
|
||||||
{{{TESTDATA_DIR, "query_simplefunction.cpp"},
|
"functionDecl()",
|
||||||
"void f();",
|
{{{TESTDATA_DIR, "query_simplefunction.cpp"}, "void f();", {"cc"}, 1}},
|
||||||
{"cc", "query_simplefunction.cpp"},
|
{{{TESTDATA_DIR, "query_simplefunction.h"}, "void f();", {}, 1}}};
|
||||||
1}},
|
|
||||||
{{{TESTDATA_DIR, "query_simplefunction.h"},
|
|
||||||
"void f();",
|
|
||||||
{},
|
|
||||||
1}}};
|
|
||||||
|
|
||||||
EXPECT_CALL(mockRefactoringServer, requestSourceRangesForQueryMessage(message));
|
EXPECT_CALL(mockRefactoringServer, requestSourceRangesForQueryMessage(message));
|
||||||
|
|
||||||
@@ -171,15 +162,15 @@ TEST_F(RefactoringClientServerInProcess, RequestSourceRangesAndDiagnosticsForQue
|
|||||||
|
|
||||||
TEST_F(RefactoringClientServerInProcess, RequestSourceRangesForQueryMessage)
|
TEST_F(RefactoringClientServerInProcess, RequestSourceRangesForQueryMessage)
|
||||||
{
|
{
|
||||||
RequestSourceRangesForQueryMessage message{"functionDecl()",
|
RequestSourceRangesForQueryMessage message{
|
||||||
|
"functionDecl()",
|
||||||
{{{TESTDATA_DIR, "query_simplefunction.cpp"},
|
{{{TESTDATA_DIR, "query_simplefunction.cpp"},
|
||||||
"void f();",
|
"void f();",
|
||||||
{"cc", "query_simplefunction.cpp"},
|
{
|
||||||
|
"cc",
|
||||||
|
},
|
||||||
1}},
|
1}},
|
||||||
{{{TESTDATA_DIR, "query_simplefunction.h"},
|
{{{TESTDATA_DIR, "query_simplefunction.h"}, "void f();", {}, 1}}};
|
||||||
"void f();",
|
|
||||||
{},
|
|
||||||
1}}};
|
|
||||||
|
|
||||||
EXPECT_CALL(mockRefactoringServer, requestSourceRangesForQueryMessage(message));
|
EXPECT_CALL(mockRefactoringServer, requestSourceRangesForQueryMessage(message));
|
||||||
|
|
||||||
|
@@ -100,9 +100,7 @@ protected:
|
|||||||
ClangBackEnd::GeneratedFiles generatedFiles;
|
ClangBackEnd::GeneratedFiles generatedFiles;
|
||||||
ClangBackEnd::RefactoringServer refactoringServer{mockSymbolIndexing, filePathCache, generatedFiles};
|
ClangBackEnd::RefactoringServer refactoringServer{mockSymbolIndexing, filePathCache, generatedFiles};
|
||||||
Utils::SmallString sourceContent{"void f()\n {}"};
|
Utils::SmallString sourceContent{"void f()\n {}"};
|
||||||
FileContainer source{{TESTDATA_DIR, "query_simplefunction.cpp"},
|
FileContainer source{{TESTDATA_DIR, "query_simplefunction.cpp"}, sourceContent.clone(), {"cc"}};
|
||||||
sourceContent.clone(),
|
|
||||||
{"cc", toNativePath(TESTDATA_DIR "/query_simplefunction.cpp").path()}};
|
|
||||||
QTemporaryFile temporaryFile{Utils::TemporaryDirectory::masterDirectoryPath()
|
QTemporaryFile temporaryFile{Utils::TemporaryDirectory::masterDirectoryPath()
|
||||||
+ "/clangQuery-XXXXXX.cpp"};
|
+ "/clangQuery-XXXXXX.cpp"};
|
||||||
int processingSlotCount = 2;
|
int processingSlotCount = 2;
|
||||||
@@ -113,12 +111,8 @@ using RefactoringServerVerySlowTest = RefactoringServer;
|
|||||||
|
|
||||||
TEST_F(RefactoringServerSlowTest, RequestSourceLocationsForRenamingMessage)
|
TEST_F(RefactoringServerSlowTest, RequestSourceLocationsForRenamingMessage)
|
||||||
{
|
{
|
||||||
RequestSourceLocationsForRenamingMessage message{{TESTDATA_DIR, "renamevariable.cpp"},
|
RequestSourceLocationsForRenamingMessage message{
|
||||||
1,
|
{TESTDATA_DIR, "renamevariable.cpp"}, 1, 5, "int v;\n\nint x = v + 3;\n", {"cc"}, 1};
|
||||||
5,
|
|
||||||
"int v;\n\nint x = v + 3;\n",
|
|
||||||
{"cc", "renamevariable.cpp"},
|
|
||||||
1};
|
|
||||||
|
|
||||||
EXPECT_CALL(mockRefactoringClient,
|
EXPECT_CALL(mockRefactoringClient,
|
||||||
sourceLocationsForRenamingMessage(
|
sourceLocationsForRenamingMessage(
|
||||||
@@ -152,13 +146,9 @@ TEST_F(RefactoringServerSlowTest, RequestSingleSourceRangesAndDiagnosticsWithUns
|
|||||||
Utils::SmallString unsavedContent{"void f();"};
|
Utils::SmallString unsavedContent{"void f();"};
|
||||||
FileContainer source{{TESTDATA_DIR, "query_simplefunction.cpp"},
|
FileContainer source{{TESTDATA_DIR, "query_simplefunction.cpp"},
|
||||||
"#include \"query_simplefunction.h\"",
|
"#include \"query_simplefunction.h\"",
|
||||||
{"cc", "query_simplefunction.cpp"}};
|
{"cc"}};
|
||||||
FileContainer unsaved{{TESTDATA_DIR, "query_simplefunction.h"},
|
FileContainer unsaved{{TESTDATA_DIR, "query_simplefunction.h"}, unsavedContent.clone(), {}};
|
||||||
unsavedContent.clone(),
|
RequestSourceRangesForQueryMessage message{"functionDecl()", {source.clone()}, {unsaved.clone()}};
|
||||||
{}};
|
|
||||||
RequestSourceRangesForQueryMessage message{"functionDecl()",
|
|
||||||
{source.clone()},
|
|
||||||
{unsaved.clone()}};
|
|
||||||
|
|
||||||
EXPECT_CALL(mockRefactoringClient,
|
EXPECT_CALL(mockRefactoringClient,
|
||||||
sourceRangesForQueryMessage(
|
sourceRangesForQueryMessage(
|
||||||
@@ -267,11 +257,10 @@ TEST_F(RefactoringServer, PollTimerNotIsActiveAfterCanceling)
|
|||||||
|
|
||||||
TEST_F(RefactoringServerSlowTest, ForValidRequestSourceRangesAndDiagnosticsGetSourceRange)
|
TEST_F(RefactoringServerSlowTest, ForValidRequestSourceRangesAndDiagnosticsGetSourceRange)
|
||||||
{
|
{
|
||||||
RequestSourceRangesAndDiagnosticsForQueryMessage message(
|
RequestSourceRangesAndDiagnosticsForQueryMessage message("functionDecl()",
|
||||||
"functionDecl()",
|
|
||||||
{FilePath(temporaryFile.fileName()),
|
{FilePath(temporaryFile.fileName()),
|
||||||
"void f() {}",
|
"void f() {}",
|
||||||
{"cc", toNativePath(temporaryFile.fileName()).path()}});
|
{"cc"}});
|
||||||
|
|
||||||
EXPECT_CALL(mockRefactoringClient,
|
EXPECT_CALL(mockRefactoringClient,
|
||||||
sourceRangesAndDiagnosticsForQueryMessage(
|
sourceRangesAndDiagnosticsForQueryMessage(
|
||||||
@@ -287,11 +276,10 @@ TEST_F(RefactoringServerSlowTest, ForValidRequestSourceRangesAndDiagnosticsGetSo
|
|||||||
|
|
||||||
TEST_F(RefactoringServerSlowTest, ForInvalidRequestSourceRangesAndDiagnosticsGetDiagnostics)
|
TEST_F(RefactoringServerSlowTest, ForInvalidRequestSourceRangesAndDiagnosticsGetDiagnostics)
|
||||||
{
|
{
|
||||||
RequestSourceRangesAndDiagnosticsForQueryMessage message(
|
RequestSourceRangesAndDiagnosticsForQueryMessage message("func()",
|
||||||
"func()",
|
|
||||||
{FilePath(temporaryFile.fileName()),
|
{FilePath(temporaryFile.fileName()),
|
||||||
"void f() {}",
|
"void f() {}",
|
||||||
{"cc", toNativePath(temporaryFile.fileName()).path()}});
|
{"cc"}});
|
||||||
|
|
||||||
EXPECT_CALL(mockRefactoringClient,
|
EXPECT_CALL(mockRefactoringClient,
|
||||||
sourceRangesAndDiagnosticsForQueryMessage(
|
sourceRangesAndDiagnosticsForQueryMessage(
|
||||||
|
@@ -57,9 +57,7 @@ protected:
|
|||||||
void TearDown() override;
|
void TearDown() override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
TestClangTool clangTool{{TESTDATA_DIR "/sourcerangeextractor_location.cpp"},
|
TestClangTool clangTool{{TESTDATA_DIR "/sourcerangeextractor_location.cpp"}, "", {"cc"}};
|
||||||
"",
|
|
||||||
{"cc", "sourcerangeextractor_location.cpp"}};
|
|
||||||
ClangBackEnd::SourceRangesContainer sourceRangesContainer;
|
ClangBackEnd::SourceRangesContainer sourceRangesContainer;
|
||||||
const clang::SourceManager &sourceManager{clangTool.sourceManager()};
|
const clang::SourceManager &sourceManager{clangTool.sourceManager()};
|
||||||
Sqlite::Database database{":memory:", Sqlite::JournalMode::Memory};
|
Sqlite::Database database{":memory:", Sqlite::JournalMode::Memory};
|
||||||
|
@@ -75,9 +75,7 @@ TEST_F(SymbolFinder, FileContentFilePath)
|
|||||||
TEST_F(SymbolFinderSlowTest, FindName)
|
TEST_F(SymbolFinderSlowTest, FindName)
|
||||||
{
|
{
|
||||||
Finder finder(1, 5, filePathCaching);
|
Finder finder(1, 5, filePathCaching);
|
||||||
finder.addFile({TESTDATA_DIR "/renamevariable.cpp"},
|
finder.addFile({TESTDATA_DIR "/renamevariable.cpp"}, "int variable;", {"cc"});
|
||||||
"int variable;",
|
|
||||||
{"cc", toNativePath(TESTDATA_DIR "/renamevariable.cpp").path()});
|
|
||||||
|
|
||||||
finder.findSymbol();
|
finder.findSymbol();
|
||||||
|
|
||||||
@@ -87,9 +85,7 @@ TEST_F(SymbolFinderSlowTest, FindName)
|
|||||||
TEST_F(SymbolFinderSlowTest, FindNameInUnsavedFile)
|
TEST_F(SymbolFinderSlowTest, FindNameInUnsavedFile)
|
||||||
{
|
{
|
||||||
Finder finder(1, 5, filePathCaching);
|
Finder finder(1, 5, filePathCaching);
|
||||||
finder.addFile({TESTDATA_DIR "/renamevariable.cpp"},
|
finder.addFile({TESTDATA_DIR "/renamevariable.cpp"}, "int newVariable;", {"cc"});
|
||||||
"int newVariable;",
|
|
||||||
{"cc", toNativePath(TESTDATA_DIR "/renamevariable.cpp").path()});
|
|
||||||
|
|
||||||
finder.findSymbol();
|
finder.findSymbol();
|
||||||
|
|
||||||
@@ -99,9 +95,7 @@ TEST_F(SymbolFinderSlowTest, FindNameInUnsavedFile)
|
|||||||
TEST_F(SymbolFinderSlowTest, FindUsrs)
|
TEST_F(SymbolFinderSlowTest, FindUsrs)
|
||||||
{
|
{
|
||||||
Finder finder(1, 5, filePathCaching);
|
Finder finder(1, 5, filePathCaching);
|
||||||
finder.addFile({TESTDATA_DIR "/renamevariable.cpp"},
|
finder.addFile({TESTDATA_DIR "/renamevariable.cpp"}, "int variable;", {"cc", "-std=c++14"});
|
||||||
"int variable;",
|
|
||||||
{"cc", toNativePath(TESTDATA_DIR "/renamevariable.cpp").path(), "-std=c++14"});
|
|
||||||
|
|
||||||
finder.findSymbol();
|
finder.findSymbol();
|
||||||
|
|
||||||
@@ -111,9 +105,7 @@ TEST_F(SymbolFinderSlowTest, FindUsrs)
|
|||||||
TEST_F(SymbolFinderSlowTest, VariableDeclarationSourceLocations)
|
TEST_F(SymbolFinderSlowTest, VariableDeclarationSourceLocations)
|
||||||
{
|
{
|
||||||
Finder finder(1, 5, filePathCaching);
|
Finder finder(1, 5, filePathCaching);
|
||||||
finder.addFile({TESTDATA_DIR "/renamevariable.cpp"},
|
finder.addFile({TESTDATA_DIR "/renamevariable.cpp"}, "", {"cc", "-std=c++14"});
|
||||||
"",
|
|
||||||
{"cc", toNativePath(TESTDATA_DIR "/renamevariable.cpp").path(), "-std=c++14"});
|
|
||||||
|
|
||||||
finder.findSymbol();
|
finder.findSymbol();
|
||||||
|
|
||||||
@@ -125,9 +117,7 @@ TEST_F(SymbolFinderSlowTest, VariableDeclarationSourceLocations)
|
|||||||
TEST_F(SymbolFinderSlowTest, VariableUsageSourceLocations)
|
TEST_F(SymbolFinderSlowTest, VariableUsageSourceLocations)
|
||||||
{
|
{
|
||||||
Finder finder(3, 9, filePathCaching);
|
Finder finder(3, 9, filePathCaching);
|
||||||
finder.addFile({TESTDATA_DIR "/renamevariable.cpp"},
|
finder.addFile({TESTDATA_DIR "/renamevariable.cpp"}, "", {"cc", "-std=c++14"});
|
||||||
"",
|
|
||||||
{"cc", toNativePath(TESTDATA_DIR "/renamevariable.cpp").path(), "-std=c++14"});
|
|
||||||
|
|
||||||
finder.findSymbol();
|
finder.findSymbol();
|
||||||
|
|
||||||
@@ -139,9 +129,7 @@ TEST_F(SymbolFinderSlowTest, VariableUsageSourceLocations)
|
|||||||
TEST_F(SymbolFinderSlowTest, TemplateMemberVariableDeclarationSourceLocations)
|
TEST_F(SymbolFinderSlowTest, TemplateMemberVariableDeclarationSourceLocations)
|
||||||
{
|
{
|
||||||
Finder finder(8, 18, filePathCaching);
|
Finder finder(8, 18, filePathCaching);
|
||||||
finder.addFile({TESTDATA_DIR "/renamevariable.cpp"},
|
finder.addFile({TESTDATA_DIR "/renamevariable.cpp"}, "", {"cc", "-std=c++14"});
|
||||||
"",
|
|
||||||
{"cc", toNativePath(TESTDATA_DIR "/renamevariable.cpp").path(), "-std=c++14"});
|
|
||||||
|
|
||||||
finder.findSymbol();
|
finder.findSymbol();
|
||||||
|
|
||||||
@@ -154,9 +142,7 @@ TEST_F(SymbolFinderSlowTest, TemplateMemberVariableDeclarationSourceLocations)
|
|||||||
TEST_F(SymbolFinderSlowTest, TemplateMemberVariableUsageSourceLocations)
|
TEST_F(SymbolFinderSlowTest, TemplateMemberVariableUsageSourceLocations)
|
||||||
{
|
{
|
||||||
Finder finder(15, 14, filePathCaching);
|
Finder finder(15, 14, filePathCaching);
|
||||||
finder.addFile({TESTDATA_DIR "/renamevariable.cpp"},
|
finder.addFile({TESTDATA_DIR "/renamevariable.cpp"}, "", {"cc", "-std=c++14"});
|
||||||
"",
|
|
||||||
{"cc", toNativePath(TESTDATA_DIR "/renamevariable.cpp").path(), "-std=c++14"});
|
|
||||||
|
|
||||||
finder.findSymbol();
|
finder.findSymbol();
|
||||||
|
|
||||||
@@ -169,9 +155,7 @@ TEST_F(SymbolFinderSlowTest, TemplateMemberVariableUsageSourceLocations)
|
|||||||
TEST_F(SymbolFinderSlowTest, TemplateMemberVariableUsageInLambdaSourceLocations)
|
TEST_F(SymbolFinderSlowTest, TemplateMemberVariableUsageInLambdaSourceLocations)
|
||||||
{
|
{
|
||||||
Finder finder(18, 19, filePathCaching);
|
Finder finder(18, 19, filePathCaching);
|
||||||
finder.addFile({TESTDATA_DIR "/renamevariable.cpp"},
|
finder.addFile({TESTDATA_DIR "/renamevariable.cpp"}, "", {"cc", "-std=c++14"});
|
||||||
"",
|
|
||||||
{"cc", toNativePath(TESTDATA_DIR "/renamevariable.cpp").path(), "-std=c++14"});
|
|
||||||
|
|
||||||
finder.findSymbol();
|
finder.findSymbol();
|
||||||
|
|
||||||
@@ -184,9 +168,7 @@ TEST_F(SymbolFinderSlowTest, TemplateMemberVariableUsageInLambdaSourceLocations)
|
|||||||
TEST_F(SymbolFinderSlowTest, CursorOverMacroDefintionSymbolName)
|
TEST_F(SymbolFinderSlowTest, CursorOverMacroDefintionSymbolName)
|
||||||
{
|
{
|
||||||
Finder finder(1, 9, filePathCaching);
|
Finder finder(1, 9, filePathCaching);
|
||||||
finder.addFile({TESTDATA_DIR "/symbolfinder_macro.cpp"},
|
finder.addFile({TESTDATA_DIR "/symbolfinder_macro.cpp"}, "", {"cc"});
|
||||||
"",
|
|
||||||
{"cc", toNativePath(TESTDATA_DIR "/symbolfinder_macro.cpp").path()});
|
|
||||||
|
|
||||||
finder.findSymbol();
|
finder.findSymbol();
|
||||||
|
|
||||||
@@ -196,9 +178,7 @@ TEST_F(SymbolFinderSlowTest, CursorOverMacroDefintionSymbolName)
|
|||||||
TEST_F(SymbolFinderSlowTest, CursorOverMacroExpansionSymbolName)
|
TEST_F(SymbolFinderSlowTest, CursorOverMacroExpansionSymbolName)
|
||||||
{
|
{
|
||||||
Finder finder(10, 10, filePathCaching);
|
Finder finder(10, 10, filePathCaching);
|
||||||
finder.addFile({TESTDATA_DIR "/symbolfinder_macro.cpp"},
|
finder.addFile({TESTDATA_DIR "/symbolfinder_macro.cpp"}, "", {"cc"});
|
||||||
"",
|
|
||||||
{"cc", toNativePath(TESTDATA_DIR "/symbolfinder_macro.cpp").path()});
|
|
||||||
|
|
||||||
finder.findSymbol();
|
finder.findSymbol();
|
||||||
|
|
||||||
@@ -208,9 +188,7 @@ TEST_F(SymbolFinderSlowTest, CursorOverMacroExpansionSymbolName)
|
|||||||
TEST_F(SymbolFinderSlowTest, FindMacroDefinition)
|
TEST_F(SymbolFinderSlowTest, FindMacroDefinition)
|
||||||
{
|
{
|
||||||
Finder finder(1, 9, filePathCaching);
|
Finder finder(1, 9, filePathCaching);
|
||||||
finder.addFile({TESTDATA_DIR "/symbolfinder_macro.cpp"},
|
finder.addFile({TESTDATA_DIR "/symbolfinder_macro.cpp"}, "", {"cc"});
|
||||||
"",
|
|
||||||
{"cc", toNativePath(TESTDATA_DIR "/symbolfinder_macro.cpp").path()});
|
|
||||||
|
|
||||||
finder.findSymbol();
|
finder.findSymbol();
|
||||||
|
|
||||||
@@ -221,9 +199,7 @@ TEST_F(SymbolFinderSlowTest, FindMacroDefinition)
|
|||||||
TEST_F(SymbolFinderSlowTest, FindMacroExpansion)
|
TEST_F(SymbolFinderSlowTest, FindMacroExpansion)
|
||||||
{
|
{
|
||||||
Finder finder(1, 9, filePathCaching);
|
Finder finder(1, 9, filePathCaching);
|
||||||
finder.addFile({TESTDATA_DIR "/symbolfinder_macro.cpp"},
|
finder.addFile({TESTDATA_DIR "/symbolfinder_macro.cpp"}, "", {"cc"});
|
||||||
"",
|
|
||||||
{"cc", toNativePath(TESTDATA_DIR "/symbolfinder_macro.cpp").path()});
|
|
||||||
|
|
||||||
finder.findSymbol();
|
finder.findSymbol();
|
||||||
|
|
||||||
@@ -234,9 +210,7 @@ TEST_F(SymbolFinderSlowTest, FindMacroExpansion)
|
|||||||
TEST_F(SymbolFinderSlowTest, DoNotFindUndedefinedMacroExpansion)
|
TEST_F(SymbolFinderSlowTest, DoNotFindUndedefinedMacroExpansion)
|
||||||
{
|
{
|
||||||
Finder finder(1, 9, filePathCaching);
|
Finder finder(1, 9, filePathCaching);
|
||||||
finder.addFile({TESTDATA_DIR "/symbolfinder_macro.cpp"},
|
finder.addFile({TESTDATA_DIR "/symbolfinder_macro.cpp"}, "", {"cc"});
|
||||||
"",
|
|
||||||
{"cc", toNativePath(TESTDATA_DIR "/symbolfinder_macro.cpp").path()});
|
|
||||||
|
|
||||||
finder.findSymbol();
|
finder.findSymbol();
|
||||||
|
|
||||||
@@ -247,9 +221,7 @@ TEST_F(SymbolFinderSlowTest, DoNotFindUndedefinedMacroExpansion)
|
|||||||
TEST_F(SymbolFinderSlowTest, FindMacroDefinitionFromMacroExpansion)
|
TEST_F(SymbolFinderSlowTest, FindMacroDefinitionFromMacroExpansion)
|
||||||
{
|
{
|
||||||
Finder finder(10, 10, filePathCaching);
|
Finder finder(10, 10, filePathCaching);
|
||||||
finder.addFile({TESTDATA_DIR "/symbolfinder_macro.cpp"},
|
finder.addFile({TESTDATA_DIR "/symbolfinder_macro.cpp"}, "", {"cc"});
|
||||||
"",
|
|
||||||
{"cc", toNativePath(TESTDATA_DIR "/symbolfinder_macro.cpp").path()});
|
|
||||||
|
|
||||||
finder.findSymbol();
|
finder.findSymbol();
|
||||||
|
|
||||||
@@ -261,9 +233,7 @@ TEST_F(SymbolFinderSlowTest, FindMacroDefinitionFromMacroExpansion)
|
|||||||
TEST_F(SymbolFinderSlowTest, FindMacroExpansionBeforeMacroExpansionWithCursor)
|
TEST_F(SymbolFinderSlowTest, FindMacroExpansionBeforeMacroExpansionWithCursor)
|
||||||
{
|
{
|
||||||
Finder finder(12, 10, filePathCaching);
|
Finder finder(12, 10, filePathCaching);
|
||||||
finder.addFile({TESTDATA_DIR "/symbolfinder_macro.cpp"},
|
finder.addFile({TESTDATA_DIR "/symbolfinder_macro.cpp"}, "", {"cc"});
|
||||||
"",
|
|
||||||
{"cc", toNativePath(TESTDATA_DIR "/symbolfinder_macro.cpp").path()});
|
|
||||||
|
|
||||||
finder.findSymbol();
|
finder.findSymbol();
|
||||||
|
|
||||||
@@ -274,9 +244,7 @@ TEST_F(SymbolFinderSlowTest, FindMacroExpansionBeforeMacroExpansionWithCursor)
|
|||||||
TEST_F(SymbolFinderSlowTest, FindMacroExpansionAfterMacroExpansionWithCursor)
|
TEST_F(SymbolFinderSlowTest, FindMacroExpansionAfterMacroExpansionWithCursor)
|
||||||
{
|
{
|
||||||
Finder finder(10, 10, filePathCaching);
|
Finder finder(10, 10, filePathCaching);
|
||||||
finder.addFile({TESTDATA_DIR "/symbolfinder_macro.cpp"},
|
finder.addFile({TESTDATA_DIR "/symbolfinder_macro.cpp"}, "", {"cc"});
|
||||||
"",
|
|
||||||
{"cc", toNativePath(TESTDATA_DIR "/symbolfinder_macro.cpp").path()});
|
|
||||||
|
|
||||||
finder.findSymbol();
|
finder.findSymbol();
|
||||||
|
|
||||||
|
@@ -267,7 +267,7 @@ TEST_F(SymbolIndexer, UpdateProjectPartsCallsAddFilesInCollector)
|
|||||||
ElementsAre("clang++",
|
ElementsAre("clang++",
|
||||||
"-Wno-pragma-once-outside-header",
|
"-Wno-pragma-once-outside-header",
|
||||||
"-x",
|
"-x",
|
||||||
"c++-header",
|
"c++",
|
||||||
"-std=c++14",
|
"-std=c++14",
|
||||||
"-nostdinc",
|
"-nostdinc",
|
||||||
"-nostdinc++",
|
"-nostdinc++",
|
||||||
@@ -297,7 +297,7 @@ TEST_F(SymbolIndexer, UpdateProjectPartsCallsAddFilesWithPrecompiledHeaderInColl
|
|||||||
ElementsAre("clang++",
|
ElementsAre("clang++",
|
||||||
"-Wno-pragma-once-outside-header",
|
"-Wno-pragma-once-outside-header",
|
||||||
"-x",
|
"-x",
|
||||||
"c++-header",
|
"c++",
|
||||||
"-std=c++14",
|
"-std=c++14",
|
||||||
"-nostdinc",
|
"-nostdinc",
|
||||||
"-nostdinc++",
|
"-nostdinc++",
|
||||||
@@ -330,7 +330,7 @@ TEST_F(SymbolIndexer, UpdateProjectPartsCallsAddFilesWithoutPrecompiledHeaderInC
|
|||||||
ElementsAre("clang++",
|
ElementsAre("clang++",
|
||||||
"-Wno-pragma-once-outside-header",
|
"-Wno-pragma-once-outside-header",
|
||||||
"-x",
|
"-x",
|
||||||
"c++-header",
|
"c++",
|
||||||
"-std=c++14",
|
"-std=c++14",
|
||||||
"-nostdinc",
|
"-nostdinc",
|
||||||
"-nostdinc++",
|
"-nostdinc++",
|
||||||
@@ -510,7 +510,7 @@ TEST_F(SymbolIndexer, UpdateProjectPartsCallsInOrderWithoutProjectPartArtifact)
|
|||||||
ElementsAre("clang++",
|
ElementsAre("clang++",
|
||||||
"-Wno-pragma-once-outside-header",
|
"-Wno-pragma-once-outside-header",
|
||||||
"-x",
|
"-x",
|
||||||
"c++-header",
|
"c++",
|
||||||
"-std=c++14",
|
"-std=c++14",
|
||||||
"-nostdinc",
|
"-nostdinc",
|
||||||
"-nostdinc++",
|
"-nostdinc++",
|
||||||
@@ -562,7 +562,7 @@ TEST_F(SymbolIndexer, UpdateProjectPartsCallsInOrderWithProjectPartArtifact)
|
|||||||
ElementsAre("clang++",
|
ElementsAre("clang++",
|
||||||
"-Wno-pragma-once-outside-header",
|
"-Wno-pragma-once-outside-header",
|
||||||
"-x",
|
"-x",
|
||||||
"c++-header",
|
"c++",
|
||||||
"-std=c++14",
|
"-std=c++14",
|
||||||
"-nostdinc",
|
"-nostdinc",
|
||||||
"-nostdinc++",
|
"-nostdinc++",
|
||||||
@@ -618,7 +618,7 @@ TEST_F(SymbolIndexer, UpdateChangedPathCallsInOrder)
|
|||||||
ElementsAre("clang++",
|
ElementsAre("clang++",
|
||||||
"-DFOO",
|
"-DFOO",
|
||||||
"-x",
|
"-x",
|
||||||
"c++-header",
|
"c++",
|
||||||
"-std=c++14",
|
"-std=c++14",
|
||||||
"-nostdinc",
|
"-nostdinc",
|
||||||
"-nostdinc++",
|
"-nostdinc++",
|
||||||
@@ -680,7 +680,7 @@ TEST_F(SymbolIndexer, UpdateChangedPathIsUsingPrecompiledHeader)
|
|||||||
ElementsAre("clang++",
|
ElementsAre("clang++",
|
||||||
"-DFOO",
|
"-DFOO",
|
||||||
"-x",
|
"-x",
|
||||||
"c++-header",
|
"c++",
|
||||||
"-std=c++14",
|
"-std=c++14",
|
||||||
"-nostdinc",
|
"-nostdinc",
|
||||||
"-nostdinc++",
|
"-nostdinc++",
|
||||||
@@ -715,7 +715,7 @@ TEST_F(SymbolIndexer, UpdateChangedPathIsNotUsingPrecompiledHeaderIfItNotExists)
|
|||||||
ElementsAre("clang++",
|
ElementsAre("clang++",
|
||||||
"-DFOO",
|
"-DFOO",
|
||||||
"-x",
|
"-x",
|
||||||
"c++-header",
|
"c++",
|
||||||
"-std=c++14",
|
"-std=c++14",
|
||||||
"-nostdinc",
|
"-nostdinc",
|
||||||
"-nostdinc++",
|
"-nostdinc++",
|
||||||
|
Reference in New Issue
Block a user