Clang: Extend clang query

It's a first step to introduce clang query.

Change-Id: I4d001a8883f56066765ce6bc561fa3f49611c0a4
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
This commit is contained in:
Tim Jenssen
2016-11-23 13:13:38 +01:00
parent 52fc4a4ebd
commit 7f757884c5
70 changed files with 1921 additions and 653 deletions

View File

@@ -57,6 +57,24 @@ void ClangTool::addFile(std::string &&directory,
sourceFilePaths.push_back(fileContent.filePath);
}
void ClangTool::addFiles(const Utils::SmallStringVector &filePaths,
const Utils::SmallStringVector &arguments)
{
for (const Utils::SmallString &filePath : filePaths) {
auto found = std::find(filePath.rbegin(), filePath.rend(), '/');
auto fileNameBegin = found.base();
std::vector<std::string> commandLine(arguments.begin(), arguments.end());
commandLine.push_back(filePath);
addFile({filePath.begin(), std::prev(fileNameBegin)},
{fileNameBegin, filePath.end()},
{},
std::move(commandLine));
}
}
clang::tooling::ClangTool ClangTool::createTool() const
{
clang::tooling::ClangTool tool(compilationDatabase, sourceFilePaths);