forked from qt-creator/qt-creator
Clang: Show function signature hint for constructors and functors
For "foo(|" [1] we requested a completion from libclang with the cursor position just before "foo" and then filtered the function declarations for functions matching the name "foo". This worked fine for ordinary functions, but obviously not for constructors and functors. Recent versions of libclang support proper function call completion with XCursor_OverloadCandidate, so make use of that. [1] '|' represents the cursor position Task-number: QTCREATORBUG-14882 Task-number: QTCREATORBUG-14884 Change-Id: I9d31b3960ccff6a8b9440dbcb7ff9f5ca9f61266 Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
This commit is contained in:
@@ -58,18 +58,10 @@ public:
|
||||
int positionForClang() const { return m_positionForClang; }
|
||||
int positionEndOfExpression() const { return m_positionEndOfExpression; }
|
||||
|
||||
QString functionName() const { return m_functionName; }
|
||||
|
||||
private:
|
||||
ClangCompletionContextAnalyzer();
|
||||
|
||||
struct FunctionInfo {
|
||||
bool isValid() const { return functionNamePosition != -1 && !functionName.isEmpty(); }
|
||||
|
||||
int functionNamePosition = -1;
|
||||
QString functionName;
|
||||
};
|
||||
FunctionInfo analyzeFunctionCall(int endOfExpression) const;
|
||||
bool looksLikeAFunctionCall(int endOfExpression) const;
|
||||
|
||||
void setActionAndClangPosition(CompletionAction action, int position);
|
||||
void setAction(CompletionAction action);
|
||||
@@ -88,7 +80,6 @@ private:
|
||||
int m_positionForProposal = -1;
|
||||
int m_positionForClang = -1;
|
||||
int m_positionEndOfExpression = -1;
|
||||
QString m_functionName;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
|
||||
Reference in New Issue
Block a user