diff --git a/scripts/common.py b/scripts/common.py index 10287ce6935..7c2fb13271d 100644 --- a/scripts/common.py +++ b/scripts/common.py @@ -181,10 +181,25 @@ def is_not_debug(path, filenames): def codesign(app_path): signing_identity = os.environ.get('SIGNING_IDENTITY') if is_mac_platform() and signing_identity: - codesign_call = ['codesign', '-o', 'runtime', '--force', '--deep', '-s', signing_identity, + codesign_call = ['codesign', '-o', 'runtime', '--force', '-s', signing_identity, '-v'] signing_flags = os.environ.get('SIGNING_FLAGS') if signing_flags: codesign_call.extend(signing_flags.split()) - codesign_call.append(app_path) - subprocess.check_call(codesign_call) + + def conditional_sign_recursive(path, filter): + for r, _, fs in os.walk(path): + for f in fs: + ff = os.path.join(r, f) + if filter(ff): + print('codesign "' + ff + '"') + subprocess.check_call(codesign_call + [ff]) + + # sign all executables in Resources + conditional_sign_recursive(os.path.join(app_path, 'Contents', 'Resources'), + lambda ff: os.access(ff, os.X_OK)) + # sign all libraries in Imports + conditional_sign_recursive(os.path.join(app_path, 'Contents', 'Imports'), + lambda ff: ff.endswith('.dylib')) + # sign the whole bundle + subprocess.check_call(codesign_call + ['--deep', app_path]) diff --git a/src/libs/cplusplus/PreprocessorClient.cpp b/src/libs/cplusplus/PreprocessorClient.cpp index 68be342821b..9705cf40977 100644 --- a/src/libs/cplusplus/PreprocessorClient.cpp +++ b/src/libs/cplusplus/PreprocessorClient.cpp @@ -36,34 +36,44 @@ using namespace CPlusPlus; /*! \fn void Client::macroAdded(const Macro ¯o) - Called whenever a new macro is defined. + Called whenever a new \a macro is defined. */ /*! - \fn void Client::passedMacroDefinitionCheck(int offset, int line, const Macro ¯o) + \fn void Client::passedMacroDefinitionCheck(int bytesOffset, + int utf16charsOffset, + int line, + const Macro ¯o) - Called when the preprocessor checks whether a macro is defined or not and the - result is positive. + Called when the preprocessor checks whether \a macro at \a line with + \a bytesOffset and \a utf16charsOffset is defined and the result is + positive. \sa failedMacroDefinitionCheck() */ /*! - \fn void Client::failedMacroDefinitionCheck(int offset, const ByteArrayRef &name) + \fn void Client::failedMacroDefinitionCheck(int bytesOffset, + int utf16charsOffset, + const ByteArrayRef &name) - Called when the preprocessor checks whether a macro is defined or not and the - result is negative. + Called when the preprocessor checks whether the macro specified by \a name + is defined with \a bytesOffset and \a utf16charsOffset and the result is + negative. \sa passedMacroDefinitionCheck() */ /*! - \fn void Client::startExpandingMacro(int offset, - int line, - const Macro ¯o, - const QVector &actuals - = QVector()) - Called when starting to expand a macro. + \fn void Client::startExpandingMacro(int bytesOffset, + int utf16charsOffset, + int line, + const Macro ¯o, + const QVector &actuals + = QVector()) + + Called when starting to expand \a macro at \a line with \a bytesOffset, + \a utf16charsOffset, and \a actuals. \sa stopExpandingMacro() */ diff --git a/src/plugins/texteditor/syntaxhighlighter.cpp b/src/plugins/texteditor/syntaxhighlighter.cpp index b28ac1ee183..bfa0f85a866 100644 --- a/src/plugins/texteditor/syntaxhighlighter.cpp +++ b/src/plugins/texteditor/syntaxhighlighter.cpp @@ -78,13 +78,13 @@ public: bool noAutomaticHighlighting = false; }; -static bool adjustRange(QTextLayout::FormatRange &range, int from, int charsRemoved, int charsAdded) { - +static bool adjustRange(QTextLayout::FormatRange &range, int from, int charsDelta) +{ if (range.start >= from) { - range.start += charsAdded - charsRemoved; + range.start += charsDelta; return true; } else if (range.start + range.length > from) { - range.length += charsAdded - charsRemoved; + range.length += charsDelta; return true; } return false; @@ -105,32 +105,24 @@ void SyntaxHighlighterPrivate::applyFormatChanges(int from, int charsRemoved, in QTextLayout *layout = currentBlock.layout(); - QVector ranges = layout->formats(); + QVector ranges; + QVector oldRanges; + std::tie(ranges, oldRanges) + = Utils::partition(layout->formats(), [](const QTextLayout::FormatRange &range) { + return range.format.property(QTextFormat::UserProperty).toBool(); + }); - bool doAdjustRange = currentBlock.contains(from); - - QVector old_ranges; - - if (!ranges.isEmpty()) { - auto it = ranges.begin(); - while (it != ranges.end()) { - if (it->format.property(QTextFormat::UserProperty).toBool()) { - if (doAdjustRange) - formatsChanged = adjustRange(*it, from - currentBlock.position(), charsRemoved, charsAdded) - || formatsChanged; - ++it; - } else { - old_ranges.append(*it); - it = ranges.erase(it); - } - } + if (currentBlock.contains(from)) { + const int charsDelta = charsAdded - charsRemoved; + for (QTextLayout::FormatRange &range : ranges) + formatsChanged |= adjustRange(range, from - currentBlock.position(), charsDelta); } QTextCharFormat emptyFormat; QTextLayout::FormatRange r; - QVector new_ranges; + QVector newRanges; int i = 0; while (i < formatChanges.count()) { @@ -148,19 +140,19 @@ void SyntaxHighlighterPrivate::applyFormatChanges(int from, int charsRemoved, in r.length = i - r.start; - new_ranges << r; + newRanges << r; } - formatsChanged = formatsChanged || (new_ranges.size() != old_ranges.size()); + formatsChanged = formatsChanged || (newRanges.size() != oldRanges.size()); - for (int i = 0; !formatsChanged && i < new_ranges.size(); ++i) { - const QTextLayout::FormatRange &o = old_ranges.at(i); - const QTextLayout::FormatRange &n = new_ranges.at(i); + for (int i = 0; !formatsChanged && i < newRanges.size(); ++i) { + const QTextLayout::FormatRange &o = oldRanges.at(i); + const QTextLayout::FormatRange &n = newRanges.at(i); formatsChanged = (o.start != n.start || o.length != n.length || o.format != n.format); } if (formatsChanged) { - ranges.append(new_ranges); + ranges.append(newRanges); layout->setFormats(ranges); doc->markContentsDirty(currentBlock.position(), currentBlock.length()); }