forked from qt-creator/qt-creator
Clang: Make some functions available
Change-Id: I1d2d898e5ab197eb3e5c95e82b6668a00affce7d Reviewed-by: Alessandro Portale <alessandro.portale@digia.com>
This commit is contained in:
committed by
Nikolai Kosjar
parent
96af4e3c8e
commit
1754dbf6ff
@@ -108,7 +108,35 @@ QStringList createClangOptions(const ProjectPart::Ptr &pPart, const QString &fil
|
|||||||
return createClangOptions(pPart, fileKind);
|
return createClangOptions(pPart, fileKind);
|
||||||
}
|
}
|
||||||
|
|
||||||
static QStringList buildDefines(const QByteArray &defines, bool toolchainDefines)
|
QStringList createHeaderPathOptions(const QList<ProjectPart::HeaderPath> &headerPaths)
|
||||||
|
{
|
||||||
|
typedef ProjectPart::HeaderPath HeaderPath;
|
||||||
|
|
||||||
|
QStringList result;
|
||||||
|
|
||||||
|
foreach (const HeaderPath &headerPath , headerPaths) {
|
||||||
|
if (headerPath.path.isEmpty() || isBlacklisted(headerPath.path))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
QString prefix;
|
||||||
|
switch (headerPath.type) {
|
||||||
|
case HeaderPath::FrameworkPath:
|
||||||
|
prefix = QLatin1String("-F");
|
||||||
|
break;
|
||||||
|
default: // This shouldn't happen, but let's be nice..:
|
||||||
|
// intentional fall-through:
|
||||||
|
case HeaderPath::IncludePath:
|
||||||
|
prefix = QLatin1String("-I");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
result.append(prefix + headerPath.path);
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
QStringList createDefineOptions(const QByteArray &defines, bool toolchainDefines)
|
||||||
{
|
{
|
||||||
QStringList result;
|
QStringList result;
|
||||||
|
|
||||||
@@ -149,6 +177,15 @@ static QStringList buildDefines(const QByteArray &defines, bool toolchainDefines
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QStringList definesAndHeaderPathsOptions(const ProjectPart::Ptr &pPart)
|
||||||
|
{
|
||||||
|
QStringList result;
|
||||||
|
result << createDefineOptions(pPart->toolchainDefines, false);
|
||||||
|
result << createDefineOptions(pPart->projectDefines, false);
|
||||||
|
result << createHeaderPathOptions(pPart->headerPaths);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
static QString getResourceDir()
|
static QString getResourceDir()
|
||||||
{
|
{
|
||||||
QDir dir(Core::ICore::instance()->resourcePath() + QLatin1String("/cplusplus/clang/") +
|
QDir dir(Core::ICore::instance()->resourcePath() + QLatin1String("/cplusplus/clang/") +
|
||||||
@@ -194,28 +231,9 @@ QStringList createClangOptions(const ProjectPart::Ptr &pPart, ProjectFile::Kind
|
|||||||
if (!pPart->projectConfigFile.isEmpty())
|
if (!pPart->projectConfigFile.isEmpty())
|
||||||
result << QLatin1String("-include") << pPart->projectConfigFile;
|
result << QLatin1String("-include") << pPart->projectConfigFile;
|
||||||
|
|
||||||
result << buildDefines(pPart->toolchainDefines, false);
|
result << createDefineOptions(pPart->toolchainDefines, false);
|
||||||
result << buildDefines(pPart->projectDefines, false);
|
result << createDefineOptions(pPart->projectDefines, false);
|
||||||
|
result << createHeaderPathOptions(pPart->headerPaths);
|
||||||
typedef ProjectPart::HeaderPath HeaderPath;
|
|
||||||
foreach (const HeaderPath &headerPath , pPart->headerPaths) {
|
|
||||||
if (headerPath.path.isEmpty() || isBlacklisted(headerPath.path))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
QString prefix;
|
|
||||||
switch (headerPath.type) {
|
|
||||||
case HeaderPath::FrameworkPath:
|
|
||||||
prefix = QLatin1String("-F");
|
|
||||||
break;
|
|
||||||
default: // This shouldn't happen, but let's be nice..:
|
|
||||||
// intentional fall-through:
|
|
||||||
case HeaderPath::IncludePath:
|
|
||||||
prefix = QLatin1String("-I");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
result.append(prefix + headerPath.path);
|
|
||||||
}
|
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
qDebug() << "--- m_args:";
|
qDebug() << "--- m_args:";
|
||||||
|
|||||||
@@ -31,6 +31,7 @@
|
|||||||
#ifndef CPPTOOLS_CLANGUTILS_H
|
#ifndef CPPTOOLS_CLANGUTILS_H
|
||||||
#define CPPTOOLS_CLANGUTILS_H
|
#define CPPTOOLS_CLANGUTILS_H
|
||||||
|
|
||||||
|
#include "clang_global.h"
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
|
|
||||||
#include <cpptools/cppmodelmanager.h>
|
#include <cpptools/cppmodelmanager.h>
|
||||||
@@ -46,6 +47,9 @@ QStringList clangNonProjectFileOptions(CppTools::ProjectFile::Kind kind);
|
|||||||
QStringList createPCHInclusionOptions(const QStringList &pchFiles);
|
QStringList createPCHInclusionOptions(const QStringList &pchFiles);
|
||||||
QStringList createPCHInclusionOptions(const QString &pchFile);
|
QStringList createPCHInclusionOptions(const QString &pchFile);
|
||||||
|
|
||||||
|
QStringList CLANG_EXPORT createHeaderPathOptions(const QList<CppTools::ProjectPart::HeaderPath> &headerPaths);
|
||||||
|
QStringList CLANG_EXPORT createDefineOptions(const QByteArray &defines, bool toolchainDefines);
|
||||||
|
|
||||||
QStringList clangLanguageOption(CppTools::ProjectFile::Kind fileKind, bool objcExt);
|
QStringList clangLanguageOption(CppTools::ProjectFile::Kind fileKind, bool objcExt);
|
||||||
QStringList clangOptionsForLanguage(CppTools::ProjectPart::QtVersion qtVersion,
|
QStringList clangOptionsForLanguage(CppTools::ProjectPart::QtVersion qtVersion,
|
||||||
CppTools::ProjectPart::LanguageVersion languageVersion,
|
CppTools::ProjectPart::LanguageVersion languageVersion,
|
||||||
|
|||||||
Reference in New Issue
Block a user