forked from qt-creator/qt-creator
CppEditor: Prevent /TC and /TP with Objective-C files
This is relevant when clang-cl is used to compile Objective-C projects. Task-number: QTCREATORBUG-28369 Change-Id: If8ae4dfaa07bf2ec81fbbec358663617c430b9e2 Reviewed-by: Frederik Seiffert <frederik@algoriddim.com> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -119,10 +119,12 @@ static QJsonObject createFileObject(const FilePath &buildDir,
|
||||
const ProjectFile::Kind kind = ProjectFile::classify(projFile.path);
|
||||
if (projectPart.toolchainType == ProjectExplorer::Constants::MSVC_TOOLCHAIN_TYPEID
|
||||
|| projectPart.toolchainType == ProjectExplorer::Constants::CLANG_CL_TOOLCHAIN_TYPEID) {
|
||||
if (ProjectFile::isC(kind))
|
||||
args.append("/TC");
|
||||
else if (ProjectFile::isCxx(kind))
|
||||
args.append("/TP");
|
||||
if (!ProjectFile::isObjC(kind)) {
|
||||
if (ProjectFile::isC(kind))
|
||||
args.append("/TC");
|
||||
else if (ProjectFile::isCxx(kind))
|
||||
args.append("/TP");
|
||||
}
|
||||
} else {
|
||||
QStringList langOption
|
||||
= createLanguageOptionGcc(projectPart.language, kind,
|
||||
|
@@ -426,7 +426,7 @@ void CompilerOptionsBuilder::addMacros(const Macros ¯os)
|
||||
|
||||
void CompilerOptionsBuilder::updateFileLanguage(ProjectFile::Kind fileKind)
|
||||
{
|
||||
if (isClStyle()) {
|
||||
if (isClStyle() && !ProjectFile::isObjC(fileKind)) {
|
||||
QString option;
|
||||
if (ProjectFile::isC(fileKind))
|
||||
option = "/TC";
|
||||
|
@@ -67,7 +67,11 @@ bool ProjectFile::isAmbiguousHeader(const QString &filePath)
|
||||
|
||||
bool ProjectFile::isObjC(const QString &filePath)
|
||||
{
|
||||
const Kind kind = classify(filePath);
|
||||
return isObjC(classify(filePath));
|
||||
}
|
||||
|
||||
bool ProjectFile::isObjC(Kind kind)
|
||||
{
|
||||
switch (kind) {
|
||||
case CppEditor::ProjectFile::ObjCHeader:
|
||||
case CppEditor::ProjectFile::ObjCXXHeader:
|
||||
|
@@ -43,6 +43,7 @@ public:
|
||||
static bool isCxx(Kind kind);
|
||||
static bool isAmbiguousHeader(const QString &filePath);
|
||||
static bool isObjC(const QString &filePath);
|
||||
static bool isObjC(Kind kind);
|
||||
|
||||
bool isHeader() const;
|
||||
bool isSource() const;
|
||||
|
Reference in New Issue
Block a user