forked from qt-creator/qt-creator
Clang: Fix C++ method code completion
Clang returns no result type when the virtual method from the base class is called in the same method override in the derived class. This is not a problem for us because it's not a method definition and therefore it does not require special handling. Change-Id: I736989165c1f031dc1937c7935e26da8236d9e9e Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -210,11 +210,19 @@ void ClangAssistProposalItem::apply(TextDocumentManipulatorInterface &manipulato
|
||||
|
||||
if (!abandonParen && ccr.completionKind == CodeCompletion::FunctionDefinitionCompletionKind) {
|
||||
const CodeCompletionChunk resultType = ccr.chunks.first();
|
||||
QTC_ASSERT(resultType.kind == CodeCompletionChunk::ResultType, return;);
|
||||
if (::Utils::Text::matchPreviousWord(manipulator, cursor, resultType.text.toString())) {
|
||||
extraCharacters += methodDefinitionParameters(ccr.chunks);
|
||||
// To skip the next block.
|
||||
abandonParen = true;
|
||||
if (resultType.kind == CodeCompletionChunk::ResultType) {
|
||||
if (::Utils::Text::matchPreviousWord(manipulator, cursor, resultType.text.toString())) {
|
||||
extraCharacters += methodDefinitionParameters(ccr.chunks);
|
||||
// To skip the next block.
|
||||
abandonParen = true;
|
||||
}
|
||||
} else {
|
||||
// Do nothing becasue it's not a function definition.
|
||||
|
||||
// It's a clang bug that the function might miss a ResultType chunk
|
||||
// when the base class method is called from the overriding method
|
||||
// of the derived class. For example:
|
||||
// void Derived::foo() override { Base::<complete here> }
|
||||
}
|
||||
}
|
||||
if (!abandonParen) {
|
||||
|
Reference in New Issue
Block a user