summaryrefslogtreecommitdiff
path: root/src/plugins/clangcodemodel/clangcompletionassistprocessor.cpp
diff options
context:
space:
mode:
authorNikolai Kosjar <nikolai.kosjar@theqtcompany.com>2016-03-29 13:53:55 +0200
committerNikolai Kosjar <nikolai.kosjar@theqtcompany.com>2016-03-31 08:01:58 +0000
commit4b3a987c39cb92f01033255b0da51d534eb9d2cd (patch)
treebed418b94e3631a2ede76355f9dae6c055621d76 /src/plugins/clangcodemodel/clangcompletionassistprocessor.cpp
parentda5309cbc62db905ed8f5c58401f814baf26d269 (diff)
downloadqt-creator-4b3a987c39cb92f01033255b0da51d534eb9d2cd.tar.gz
C++: Equalize startOfOperator()
There are two versions of startOfOperator: * InternalCppCompletionAssistProcessor::startOfOperator * ClangCompletionAssistProcessor::startOfOperator The latter started as a copy of the former, but the former got some bug fixes in the meantime. Adjust both versions to each other, so it's easy to diff them and to extract the duplication in a follow-up change. Change-Id: Icf48386bf1ad0fa473bec476c5412be9b1890139 Reviewed-by: David Schulz <david.schulz@theqtcompany.com>
Diffstat (limited to 'src/plugins/clangcodemodel/clangcompletionassistprocessor.cpp')
-rw-r--r--src/plugins/clangcodemodel/clangcompletionassistprocessor.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/plugins/clangcodemodel/clangcompletionassistprocessor.cpp b/src/plugins/clangcodemodel/clangcompletionassistprocessor.cpp
index 9fa20e4fab..3887489d3d 100644
--- a/src/plugins/clangcodemodel/clangcompletionassistprocessor.cpp
+++ b/src/plugins/clangcodemodel/clangcompletionassistprocessor.cpp
@@ -335,16 +335,15 @@ int ClangCompletionAssistProcessor::startOfOperator(int positionInDocument,
&& !isDoxygenTagCompletionCharacter(characterBeforePositionInDocument))
|| (tk.isLiteral() && (*kind != T_STRING_LITERAL
&& *kind != T_ANGLE_STRING_LITERAL
- && *kind != T_SLASH))) {
+ && *kind != T_SLASH
+ && *kind != T_DOT))) {
*kind = T_EOF_SYMBOL;
start = positionInDocument;
- }
// Include completion: can be triggered by slash, but only in a string
- else if (*kind == T_SLASH && (tk.isNot(T_STRING_LITERAL) && tk.isNot(T_ANGLE_STRING_LITERAL))) {
+ } else if (*kind == T_SLASH && (tk.isNot(T_STRING_LITERAL) && tk.isNot(T_ANGLE_STRING_LITERAL))) {
*kind = T_EOF_SYMBOL;
start = positionInDocument;
- }
- else if (*kind == T_LPAREN) {
+ } else if (*kind == T_LPAREN) {
if (tokenIdx > 0) {
const Token &previousToken = tokens.at(tokenIdx - 1); // look at the token at the left of T_LPAREN
switch (previousToken.kind()) {
@@ -362,14 +361,15 @@ int ClangCompletionAssistProcessor::startOfOperator(int positionInDocument,
}
}
// Check for include preprocessor directive
- else if (*kind == T_STRING_LITERAL || *kind == T_ANGLE_STRING_LITERAL || *kind == T_SLASH) {
+ else if (*kind == T_STRING_LITERAL || *kind == T_ANGLE_STRING_LITERAL|| *kind == T_SLASH
+ || (*kind == T_DOT && (tk.is(T_STRING_LITERAL) || tk.is(T_ANGLE_STRING_LITERAL)))) {
bool include = false;
if (tokens.size() >= 3) {
if (tokens.at(0).is(T_POUND) && tokens.at(1).is(T_IDENTIFIER) && (tokens.at(2).is(T_STRING_LITERAL) ||
tokens.at(2).is(T_ANGLE_STRING_LITERAL))) {
const Token &directiveToken = tokens.at(1);
- QString directive = tc.block().text().mid(directiveToken.bytesBegin(),
- directiveToken.bytes());
+ QString directive = tc.block().text().mid(directiveToken.utf16charsBegin(),
+ directiveToken.utf16chars());
if (directive == QLatin1String("include") ||
directive == QLatin1String("include_next") ||
directive == QLatin1String("import")) {