CppTools: CompilerOptionsBuilder takes project part by reference

...since it assumes a project part != 0 and does not participate in
ownership.

Change-Id: Ia9c1eca52776990576a2dac61e9144234b04c59c
Reviewed-by: Erik Verbruggen <erik.verbruggen@theqtcompany.com>
This commit is contained in:
Nikolai Kosjar
2015-11-05 11:47:01 +01:00
parent 340572c980
commit 4d1a1981a8
4 changed files with 16 additions and 17 deletions

View File

@@ -312,8 +312,7 @@ static CppTools::ProjectPart projectPartForLanguageOption(CppTools::ProjectPart
static QStringList languageOptions(const QString &filePath, CppTools::ProjectPart *projectPart)
{
const auto theProjectPart = CppTools::ProjectPart::Ptr(
new CppTools::ProjectPart(projectPartForLanguageOption(projectPart)));
const auto theProjectPart = projectPartForLanguageOption(projectPart);
CppTools::CompilerOptionsBuilder builder(theProjectPart);
builder.addLanguageOption(CppTools::ProjectFile::classify(filePath));

View File

@@ -112,7 +112,7 @@ public:
if (projectPart.isNull())
return QStringList();
LibClangOptionsBuilder optionsBuilder(projectPart);
LibClangOptionsBuilder optionsBuilder(*projectPart.data());
if (verboseRunLog().isDebugEnabled())
optionsBuilder.add(QLatin1String("-v"));
@@ -135,7 +135,7 @@ public:
}
private:
LibClangOptionsBuilder(const CppTools::ProjectPart::Ptr &projectPart)
LibClangOptionsBuilder(const CppTools::ProjectPart &projectPart)
: CompilerOptionsBuilder(projectPart)
{
}
@@ -171,7 +171,7 @@ private:
static const QString wrappedQtHeaders = ICore::instance()->resourcePath()
+ QLatin1String("/cplusplus/wrappedQtHeaders");
if (m_projectPart->qtVersion != ProjectPart::NoQt) {
if (m_projectPart.qtVersion != ProjectPart::NoQt) {
add(QLatin1String("-I") + wrappedQtHeaders);
add(QLatin1String("-I") + wrappedQtHeaders + QLatin1String("/QtCore"));
}
@@ -179,9 +179,9 @@ private:
void addProjectConfigFileInclude()
{
if (!m_projectPart->projectConfigFile.isEmpty()) {
if (!m_projectPart.projectConfigFile.isEmpty()) {
add(QLatin1String("-include"));
add(m_projectPart->projectConfigFile);
add(m_projectPart.projectConfigFile);
}
}
@@ -213,7 +213,7 @@ private:
add(QStringLiteral("-Wno-documentation"));
add(QStringLiteral("-Wno-shadow"));
if (m_projectPart->languageVersion >= ProjectPart::CXX98)
if (m_projectPart.languageVersion >= ProjectPart::CXX98)
add(QStringLiteral("-Wno-missing-prototypes"));
}
};