From 69504c25cac064461ca34d968f6616f2abaf5c14 Mon Sep 17 00:00:00 2001 From: Nikolai Kosjar Date: Tue, 11 Nov 2014 12:52:46 +0100 Subject: C++: Document::functionAt provides line information Needed for the debugger. Change-Id: I6465f6dc53017df212e403ea8a9a1c7977ac1671 Reviewed-by: hjk --- src/libs/cplusplus/CppDocument.cpp | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) (limited to 'src/libs/cplusplus/CppDocument.cpp') diff --git a/src/libs/cplusplus/CppDocument.cpp b/src/libs/cplusplus/CppDocument.cpp index 5f001f2af7..ce05b77337 100644 --- a/src/libs/cplusplus/CppDocument.cpp +++ b/src/libs/cplusplus/CppDocument.cpp @@ -493,8 +493,12 @@ void Document::setGlobalNamespace(Namespace *globalNamespace) * * \param line the line number, starting with line 1 * \param column the column number, starting with column 1 + * \param lineOpeningDeclaratorParenthesis optional output parameter, the line of the opening + parenthesis of the declarator starting with 1 + * \param lineClosingBrace optional output parameter, the line of the closing brace starting with 1 */ -QString Document::functionAt(int line, int column) const +QString Document::functionAt(int line, int column, int *lineOpeningDeclaratorParenthesis, + int *lineClosingBrace) const { if (line < 1 || column < 1) return QString(); @@ -517,7 +521,19 @@ QString Document::functionAt(int line, int column) const if (!scope) return QString(); - // We found the function scope, extract its name. + // We found the function scope + if (lineOpeningDeclaratorParenthesis) { + unsigned line; + translationUnit()->getPosition(scope->startOffset(), &line); + *lineOpeningDeclaratorParenthesis = static_cast(line); + } + + if (lineClosingBrace) { + unsigned line; + translationUnit()->getPosition(scope->endOffset(), &line); + *lineClosingBrace = static_cast(line); + } + const QList fullyQualifiedName = LookupContext::fullyQualifiedName(scope); return Overview().prettyName(fullyQualifiedName); } -- cgit v1.2.1