Commit 58763aa9 authored by Marco Bubke's avatar Marco Bubke

Clang: Silence warnings

Change-Id: I63f8a85f0a352fc8f41835bd3ab1574255d4436b
Reviewed-by: Tim Jenssen's avatarTim Jenssen <tim.jenssen@qt.io>
parent a66f3e8c
......@@ -107,6 +107,40 @@ void ClangQueryProjectsFindFilter::setUnsavedContent(
this->unsavedContent = std::move(unsavedContent);
}
Utils::SmallStringVector ClangQueryProjectsFindFilter::compilerArguments(CppTools::ProjectPart *projectPart,
CppTools::ProjectFile::Kind fileKind)
{
using CppTools::ClangCompilerOptionsBuilder;
ClangCompilerOptionsBuilder builder(*projectPart, CLANG_VERSION, CLANG_RESOURCE_DIR);
builder.addWordWidth();
builder.addTargetTriple();
builder.addLanguageOption(fileKind);
builder.addOptionsForLanguage(/*checkForBorlandExtensions*/ true);
builder.enableExceptions();
builder.addDefineToAvoidIncludingGccOrMinGwIntrinsics();
builder.addDefineFloat128ForMingw();
builder.addToolchainAndProjectDefines();
builder.undefineCppLanguageFeatureMacrosForMsvc2015();
builder.addPredefinedMacrosAndHeaderPathsOptions();
builder.addWrappedQtHeadersIncludePath();
builder.addPrecompiledHeaderOptions(ClangCompilerOptionsBuilder::PchUsage::None);
builder.addHeaderPathOptions();
builder.addProjectConfigFileInclude();
builder.addMsvcCompatibilityVersion();
builder.add("-fmessage-length=0");
builder.add("-fmacro-backtrace-limit=0");
builder.add("-w");
builder.add("-ferror-limit=1000000");
return Utils::SmallStringVector(builder.options());
}
namespace {
Utils::SmallStringVector createCommandLine(CppTools::ProjectPart *projectPart,
......@@ -115,12 +149,7 @@ Utils::SmallStringVector createCommandLine(CppTools::ProjectPart *projectPart,
{
using CppTools::ClangCompilerOptionsBuilder;
Utils::SmallStringVector commandLine{ClangCompilerOptionsBuilder::build(
projectPart,
fileKind,
CppTools::CompilerOptionsBuilder::PchUsage::None,
CLANG_VERSION,
CLANG_RESOURCE_DIR)};
Utils::SmallStringVector commandLine = ClangQueryProjectsFindFilter::compilerArguments(projectPart, fileKind);
commandLine.push_back(documentFilePath);
......
......@@ -69,6 +69,9 @@ public:
void setUnsavedContent(std::vector<ClangBackEnd::V2::FileContainer> &&unsavedContent);
static Utils::SmallStringVector compilerArguments(CppTools::ProjectPart *projectPart,
CppTools::ProjectFile::Kind fileKind);
private:
ClangBackEnd::RequestSourceRangesAndDiagnosticsForQueryMessage createMessage(
const QString &queryText) const;
......
......@@ -174,16 +174,14 @@ std::vector<CppTools::ProjectPart::Ptr> createProjectParts()
std::vector<Utils::SmallStringVector>
createCommandLines(const std::vector<CppTools::ProjectPart::Ptr> &projectParts)
{
using Filter = ClangRefactoring::ClangQueryProjectsFindFilter;
std::vector<Utils::SmallStringVector> commandLines;
for (const CppTools::ProjectPart::Ptr &projectPart : projectParts) {
for (const CppTools::ProjectFile &projectFile : projectPart->files) {
Utils::SmallStringVector commandLine{ClangCompilerOptionsBuilder::build(
projectPart.data(),
projectFile.kind,
ClangCompilerOptionsBuilder::PchUsage::None,
CLANG_VERSION,
CLANG_RESOURCE_DIR)};
Utils::SmallStringVector commandLine = Filter::compilerArguments(projectPart.data(),
projectFile.kind);
commandLine.emplace_back(projectFile.path);
commandLines.push_back(commandLine);
}
......
......@@ -27,6 +27,7 @@
#include "mockrefactoringclientcallback.h"
#include "mocksearchhandle.h"
#include <clangqueryprojectsfindfilter.h>
#include <refactoringclient.h>
#include <refactoringengine.h>
#include <refactoringconnectionclient.h>
......@@ -247,17 +248,14 @@ TEST_F(RefactoringClient, XXX)
void RefactoringClient::SetUp()
{
using Filter = ClangRefactoring::ClangQueryProjectsFindFilter;
client.setRefactoringEngine(&engine);
projectPart = CppTools::ProjectPart::Ptr(new CppTools::ProjectPart);
projectPart->files.push_back(projectFile);
commandLine = Utils::SmallStringVector{ClangCompilerOptionsBuilder::build(
projectPart.data(),
projectFile.kind,
ClangCompilerOptionsBuilder::PchUsage::None,
CLANG_VERSION,
CLANG_RESOURCE_DIR)};
commandLine = Filter::compilerArguments(projectPart.data(), projectFile.kind);
client.setSearchHandle(&mockSearchHandle);
client.setExpectedResultCount(1);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment