diff options
author | Nikolai Kosjar <nikolai.kosjar@theqtcompany.com> | 2014-11-11 12:52:46 +0100 |
---|---|---|
committer | Nikolai Kosjar <nikolai.kosjar@theqtcompany.com> | 2014-11-12 12:29:51 +0100 |
commit | 69504c25cac064461ca34d968f6616f2abaf5c14 (patch) | |
tree | 99031b1862d12f6ee7eb92d671641ef4ce9e5e94 /src/libs/cplusplus/CppDocument.cpp | |
parent | fd3f544bb26575295dbbfcd975bdc8235541d927 (diff) | |
download | qt-creator-69504c25cac064461ca34d968f6616f2abaf5c14.tar.gz |
C++: Document::functionAt provides line information
Needed for the debugger.
Change-Id: I6465f6dc53017df212e403ea8a9a1c7977ac1671
Reviewed-by: hjk <hjk121@nokiamail.com>
Diffstat (limited to 'src/libs/cplusplus/CppDocument.cpp')
-rw-r--r-- | src/libs/cplusplus/CppDocument.cpp | 20 |
1 files changed, 18 insertions, 2 deletions
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<int>(line); + } + + if (lineClosingBrace) { + unsigned line; + translationUnit()->getPosition(scope->endOffset(), &line); + *lineClosingBrace = static_cast<int>(line); + } + const QList<const Name *> fullyQualifiedName = LookupContext::fullyQualifiedName(scope); return Overview().prettyName(fullyQualifiedName); } |