diff options
author | David Schulz <[email protected]> | 2016-04-18 15:57:09 +0200 |
---|---|---|
committer | David Schulz <[email protected]> | 2016-05-20 12:46:57 +0000 |
commit | 42ed3b44c8078c207016d8b4478ad35bb66ca5c8 (patch) | |
tree | e3ca2f583885c80bc0e8ea06d37756f009028990 /src/libs/cplusplus | |
parent | 1d1f450081dd53e6401c6c22cf5daeb6924e96ad (diff) |
C++: optimize paragraph insertion.
Do not check tokens which are returning the default return value.
Do not check for tokens when a previous condition excludes the other
token types.
Change-Id: Id97aed9d6342c6c12e9b26acdd0a8c4b0bca0868
Reviewed-by: Christian Stenger <[email protected]>
Reviewed-by: Nikolai Kosjar <[email protected]>
Diffstat (limited to 'src/libs/cplusplus')
-rw-r--r-- | src/libs/cplusplus/MatchingText.cpp | 14 |
1 files changed, 2 insertions, 12 deletions
diff --git a/src/libs/cplusplus/MatchingText.cpp b/src/libs/cplusplus/MatchingText.cpp index 787d98b99f7..2fdcbab9f69 100644 --- a/src/libs/cplusplus/MatchingText.cpp +++ b/src/libs/cplusplus/MatchingText.cpp @@ -329,11 +329,7 @@ QString MatchingText::insertParagraphSeparator(const QTextCursor &cursor) const Token &token = tk[index - 1]; - if (token.is(T_STRING_LITERAL) && tk[index - 2].is(T_EXTERN)) { - // recognized extern "C" - return QLatin1String("}"); - - } else if (token.is(T_IDENTIFIER)) { + if (token.is(T_IDENTIFIER)) { int i = index - 1; forever { @@ -369,12 +365,6 @@ QString MatchingText::insertParagraphSeparator(const QTextCursor &cursor) --i; } - } - - if (token.is(T_NAMESPACE)) { - // anonymous namespace - return QLatin1String("}"); - } else if (token.is(T_CLASS) || token.is(T_STRUCT) || token.is(T_UNION) || token.is(T_ENUM)) { if (tk[index - 2].is(T_TYPEDEF)) { // recognized: @@ -392,7 +382,7 @@ QString MatchingText::insertParagraphSeparator(const QTextCursor &cursor) const int lparenIndex = tk.startOfMatchingBrace(index); if (lparenIndex == index) { - // found an unmatched brace. We don't really know to do in this case. + // found an unmatched brace. We don't really know what to do in this case. return QString(); } |