Clang: Allow to provide extra command line options

This can be used to experiment with clang options that e.g. affect
diagnostics.

Changes take effect on editor re-open.

Change-Id: Ie46d0ff085a3700a748dbcf4b94b93b0bf9c4642
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@theqtcompany.com>
Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>
This commit is contained in:
Nikolai Kosjar
2015-11-10 16:54:53 +01:00
parent 72785e3a11
commit d8f119c8a2
8 changed files with 108 additions and 50 deletions

View File

@@ -41,8 +41,9 @@
#include <diagnosticcontainer.h>
#include <sourcelocationcontainer.h>
#include <cpptools/cppcodemodelsettings.h>
#include <cpptools/cppprojects.h>
#include <cpptools/cpptoolsplugin.h>
#include <cpptools/cpptoolsreuse.h>
#include <cpptools/cppworkingcopy.h>
#include <texteditor/convenience.h>
@@ -319,15 +320,21 @@ static QStringList languageOptions(const QString &filePath, CppTools::ProjectPar
return builder.options();
}
static QStringList fileArguments(const QString &filePath, CppTools::ProjectPart *projectPart)
{
return QStringList(languageOptions(filePath, projectPart))
+ CppTools::codeModelSettings()->extraClangOptions();
}
ClangBackEnd::FileContainer
ClangEditorDocumentProcessor::fileContainer(CppTools::ProjectPart *projectPart) const
{
const auto projectPartId = projectPart
? Utf8String::fromString(projectPart->id())
: Utf8String();
const auto theLanguageOption = languageOptions(filePath(), projectPart);
const QStringList theFileArguments = fileArguments(filePath(), projectPart);
return {filePath(), projectPartId, Utf8StringVector(theLanguageOption), revision()};
return {filePath(), projectPartId, Utf8StringVector(theFileArguments), revision()};
}
} // namespace Internal