forked from qt-creator/qt-creator
Clang: Fix parsing files with Android toolchain
- filter out include paths from command line flags - do not search for MinGW parent toolchain in Android toolchain Change-Id: I5f2566aa0bd10eb939380193e64e17b000743b73 Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
This commit is contained in:
@@ -48,6 +48,7 @@ static const char defineOption[] = "-D";
|
||||
static const char undefineOption[] = "-U";
|
||||
|
||||
static const char includeUserPathOption[] = "-I";
|
||||
static const char includeUserPathOptionWindows[] = "/I";
|
||||
static const char includeSystemPathOption[] = "-isystem";
|
||||
|
||||
static const char includeFileOptionGcc[] = "-include";
|
||||
@@ -699,7 +700,13 @@ void CompilerOptionsBuilder::reset()
|
||||
void CompilerOptionsBuilder::evaluateCompilerFlags()
|
||||
{
|
||||
bool containsDriverMode = false;
|
||||
bool skipNext = false;
|
||||
for (const QString &option : m_projectPart.compilerFlags) {
|
||||
if (skipNext) {
|
||||
skipNext = false;
|
||||
continue;
|
||||
}
|
||||
|
||||
// Ignore warning flags as these interfere with ouser user-configured diagnostics.
|
||||
// Note that once "-w" is provided, no warnings will be emitted, even if "-Wall" follows.
|
||||
if (option.startsWith("-w", Qt::CaseInsensitive)
|
||||
@@ -708,8 +715,17 @@ void CompilerOptionsBuilder::evaluateCompilerFlags()
|
||||
continue;
|
||||
}
|
||||
|
||||
if (option == includeUserPathOption || option == includeSystemPathOption
|
||||
|| option == includeUserPathOptionWindows) {
|
||||
skipNext = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (option.startsWith("-O", Qt::CaseSensitive) || option.startsWith("/O", Qt::CaseSensitive)
|
||||
|| option.startsWith("/M", Qt::CaseSensitive)) {
|
||||
|| option.startsWith("/M", Qt::CaseSensitive)
|
||||
|| option.startsWith(includeUserPathOption)
|
||||
|| option.startsWith(includeSystemPathOption)
|
||||
|| option.startsWith(includeUserPathOptionWindows)) {
|
||||
// Optimization and run-time flags.
|
||||
continue;
|
||||
}
|
||||
|
@@ -1241,8 +1241,10 @@ static const MingwToolChain *mingwToolChainFromId(const QByteArray &id)
|
||||
|
||||
void ClangToolChain::syncAutodetectedWithParentToolchains()
|
||||
{
|
||||
if (!HostOsInfo::isWindowsHost() || !isAutoDetected())
|
||||
if (!HostOsInfo::isWindowsHost() || typeId() != Constants::CLANG_TOOLCHAIN_TYPEID
|
||||
|| !isAutoDetected()) {
|
||||
return;
|
||||
}
|
||||
|
||||
QObject::disconnect(m_thisToolchainRemovedConnection);
|
||||
QObject::disconnect(m_mingwToolchainAddedConnection);
|
||||
@@ -1491,7 +1493,7 @@ GccToolChain *ClangToolChainFactory::createToolChain(bool autoDetect)
|
||||
ClangToolChainConfigWidget::ClangToolChainConfigWidget(ClangToolChain *tc) :
|
||||
GccToolChainConfigWidget(tc)
|
||||
{
|
||||
if (!HostOsInfo::isWindowsHost())
|
||||
if (!HostOsInfo::isWindowsHost() || tc->typeId() != Constants::CLANG_TOOLCHAIN_TYPEID)
|
||||
return;
|
||||
|
||||
// Remove m_abiWidget row because the parent toolchain abi is going to be used.
|
||||
|
Reference in New Issue
Block a user