diff options
author | Eike Ziller <eike.ziller@qt.io> | 2018-07-05 11:14:33 +0200 |
---|---|---|
committer | Eike Ziller <eike.ziller@qt.io> | 2018-07-05 11:14:33 +0200 |
commit | 5c81a65422427289f0671b2f2b4d7e809105cbd7 (patch) | |
tree | 1ec9cd86aaa14511db73bb60bc7e48312854c31f /src/tools/clangbackend/source | |
parent | aa4407e332f62f2cb24dd8e8fb41d2469efba1fb (diff) | |
parent | 9bbb085718ca1af4f816331d450b2129e30ff281 (diff) | |
download | qt-creator-5c81a65422427289f0671b2f2b4d7e809105cbd7.tar.gz |
Merge remote-tracking branch 'origin/4.7'
Conflicts:
qbs/modules/qtc/qtc.qbs
qtcreator.pri
Change-Id: I29916313f12e25f3942ac926f8e4d4490074978e
Diffstat (limited to 'src/tools/clangbackend/source')
5 files changed, 13 insertions, 21 deletions
diff --git a/src/tools/clangbackend/source/clangbackend_global.h b/src/tools/clangbackend/source/clangbackend_global.h index 2d2535e12c..ff25ddeb81 100644 --- a/src/tools/clangbackend/source/clangbackend_global.h +++ b/src/tools/clangbackend/source/clangbackend_global.h @@ -51,4 +51,9 @@ enum class PreferredTranslationUnit # define IS_LIMITSKIPFUNCTIONBODIESTOPREAMBLE_SUPPORTED #endif +// CLANG-UPGRADE-CHECK: Remove IS_SKIPWARNINGSFROMINCLUDEDFILES_SUPPORTED once we require clang >= 7.0 +#if defined(CINDEX_VERSION_HAS_SKIPWARNINGSFROMINCLUDEDFILES_BACKPORTED) || CINDEX_VERSION_MINOR >= 46 +# define IS_SKIPWARNINGSFROMINCLUDEDFILES_SUPPORTED +#endif + } // namespace ClangBackEnd diff --git a/src/tools/clangbackend/source/clangtranslationunit.cpp b/src/tools/clangbackend/source/clangtranslationunit.cpp index aa36dea875..017abdd98f 100644 --- a/src/tools/clangbackend/source/clangtranslationunit.cpp +++ b/src/tools/clangbackend/source/clangtranslationunit.cpp @@ -237,17 +237,6 @@ static bool isHeaderErrorDiagnostic(const Utf8String &mainFilePath, const Diagno return isCritical && diagnostic.location().filePath() != mainFilePath; } -static bool isIgnoredHeaderErrorDiagnostic(const Diagnostic &diagnostic) -{ - // FIXME: This diagnostic can appear if e.g. a main file includes a -isystem header and then the - // header is opened in the editor - the provided unsaved file for the newly opened editor - // overrides the file from the preamble. In this case, clang uses the version from the preamble - // and changes in the header are not reflected in the main file. Typically that's not a problem - // because only non-project headers are opened as -isystem headers. - return diagnostic.text().endsWith( - Utf8StringLiteral("from the precompiled header has been overridden")); -} - void TranslationUnit::extractDiagnostics(DiagnosticContainer &firstHeaderErrorDiagnostic, QVector<DiagnosticContainer> &mainFileDiagnostics) const { @@ -257,9 +246,7 @@ void TranslationUnit::extractDiagnostics(DiagnosticContainer &firstHeaderErrorDi bool hasFirstHeaderErrorDiagnostic = false; for (const Diagnostic &diagnostic : diagnostics()) { - if (!hasFirstHeaderErrorDiagnostic - && isHeaderErrorDiagnostic(m_filePath, diagnostic) - && !isIgnoredHeaderErrorDiagnostic(diagnostic)) { + if (!hasFirstHeaderErrorDiagnostic && isHeaderErrorDiagnostic(m_filePath, diagnostic)) { hasFirstHeaderErrorDiagnostic = true; firstHeaderErrorDiagnostic = diagnostic.toDiagnosticContainer(); } diff --git a/src/tools/clangbackend/source/clangtranslationunitupdater.cpp b/src/tools/clangbackend/source/clangtranslationunitupdater.cpp index ac21ebb72a..733c8f980e 100644 --- a/src/tools/clangbackend/source/clangtranslationunitupdater.cpp +++ b/src/tools/clangbackend/source/clangtranslationunitupdater.cpp @@ -181,6 +181,9 @@ uint TranslationUnitUpdater::defaultParseOptions() | CXTranslationUnit_SkipFunctionBodies | CXTranslationUnit_LimitSkipFunctionBodiesToPreamble #endif +#ifdef IS_SKIPWARNINGSFROMINCLUDEDFILES_SUPPORTED + | CXTranslationUnit_IgnoreNonErrorsFromIncludedFiles +#endif | CXTranslationUnit_IncludeBriefCommentsInCodeCompletion | CXTranslationUnit_DetailedPreprocessingRecord | CXTranslationUnit_KeepGoing; diff --git a/src/tools/clangbackend/source/fulltokeninfo.cpp b/src/tools/clangbackend/source/fulltokeninfo.cpp index d539138ce9..283798d0be 100644 --- a/src/tools/clangbackend/source/fulltokeninfo.cpp +++ b/src/tools/clangbackend/source/fulltokeninfo.cpp @@ -106,7 +106,6 @@ static Utf8String getPropertyType(const CXSourceLocation &cxLocation, CXTranslationUnit cxTranslationUnit, uint propertyPosition) { -#if defined(CINDEX_VERSION_HAS_GETFILECONTENTS_BACKPORTED) || CINDEX_VERSION_MINOR >= 47 // Extract property type from the source code CXFile cxFile; uint offset; @@ -123,12 +122,6 @@ static Utf8String getPropertyType(const CXSourceLocation &cxLocation, Utils::unequalTo(' ')); return Utf8String(typeStart, static_cast<int>(&(*typeEnd) + 1 - typeStart)); -#else - Q_UNUSED(cxLocation) - Q_UNUSED(cxTranslationUnit) - Q_UNUSED(propertyPosition) - return Utf8String(); -#endif } void FullTokenInfo::updatePropertyData() diff --git a/src/tools/clangbackend/source/tokenprocessor.h b/src/tools/clangbackend/source/tokenprocessor.h index 4c6fbd995d..aeac7dc01c 100644 --- a/src/tools/clangbackend/source/tokenprocessor.h +++ b/src/tools/clangbackend/source/tokenprocessor.h @@ -159,6 +159,10 @@ QVector<TokenInfoContainer> TokenProcessor<FullTokenInfo>::toTokenInfoContainers if (it->m_extraInfo.declaration && !it->hasMainType(HighlightingType::LocalVariable) && it->m_originalCursor != token.m_originalCursor && it->m_extraInfo.cursorRange.contains(tokenStart)) { + if (token.m_originalCursor.lexicalParent() != it->m_originalCursor + && !token.hasMainType(HighlightingType::QtProperty)) { + continue; + } token.m_extraInfo.lexicalParentIndex = std::distance(it, tokens.rend()) - 1; break; } |