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,12 +210,20 @@ void ClangAssistProposalItem::apply(TextDocumentManipulatorInterface &manipulato
|
|||||||
|
|
||||||
if (!abandonParen && ccr.completionKind == CodeCompletion::FunctionDefinitionCompletionKind) {
|
if (!abandonParen && ccr.completionKind == CodeCompletion::FunctionDefinitionCompletionKind) {
|
||||||
const CodeCompletionChunk resultType = ccr.chunks.first();
|
const CodeCompletionChunk resultType = ccr.chunks.first();
|
||||||
QTC_ASSERT(resultType.kind == CodeCompletionChunk::ResultType, return;);
|
if (resultType.kind == CodeCompletionChunk::ResultType) {
|
||||||
if (::Utils::Text::matchPreviousWord(manipulator, cursor, resultType.text.toString())) {
|
if (::Utils::Text::matchPreviousWord(manipulator, cursor, resultType.text.toString())) {
|
||||||
extraCharacters += methodDefinitionParameters(ccr.chunks);
|
extraCharacters += methodDefinitionParameters(ccr.chunks);
|
||||||
// To skip the next block.
|
// To skip the next block.
|
||||||
abandonParen = true;
|
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) {
|
if (!abandonParen) {
|
||||||
if (completionSettings.m_spaceAfterFunctionName)
|
if (completionSettings.m_spaceAfterFunctionName)
|
||||||
|
Reference in New Issue
Block a user