[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [kdev-clang] /: Let destructor declarations encompass the full identifier range.
From: Milian Wolff <mail () milianw ! de>
Date: 2014-08-04 11:12:50
Message-ID: E1XEGCA-0007ur-I9 () scm ! kde ! org
[Download RAW message or body]
Git commit 490d686ebf383151b7527ab57de7659ce3b8ce6d by Milian Wolff.
Committed on 04/08/2014 at 11:12.
Pushed by mwolff into branch 'master'.
Let destructor declarations encompass the full identifier range.
Clang only returns a range for the tilde, which is odd. Instead
we now manually increase the length of the range to include the
full identifier.
M +5 -0 duchain/tuduchain.h
M +1 -1 tests/files/basicdeclsandcontexts.cpp
http://commits.kde.org/kdev-clang/490d686ebf383151b7527ab57de7659ce3b8ce6d
diff --git a/duchain/tuduchain.h b/duchain/tuduchain.h
index 2a415ed..5a80995 100644
--- a/duchain/tuduchain.h
+++ b/duchain/tuduchain.h
@@ -187,6 +187,11 @@ private:
DeclType* createDeclarationCommon(CXCursor cursor, const Identifier& id)
{
auto range = ClangRange(clang_Cursor_getSpellingNameRange(cursor, 0, 0)).toRangeInRevision();
+ if (CK == CXCursor_Destructor) {
+ // HACK: ensure the dtor declaration range encompasses the full identifier,
+ // not only the tilde
+ range.end.column = range.start.column + id.toString().length();
+ }
if (m_update) {
const IndexedIdentifier indexedId(id);
DUChainWriteLocker lock;
diff --git a/tests/files/basicdeclsandcontexts.cpp b/tests/files/basicdeclsandcontexts.cpp
index 6ecda5f..352db2c 100644
--- a/tests/files/basicdeclsandcontexts.cpp
+++ b/tests/files/basicdeclsandcontexts.cpp
@@ -36,7 +36,7 @@ namespace bar
}
/**
- * "identifier" : "~foostruct",
+ * "identifier" : "~foostruct", "range" : "[(41, 8), (41, 18)]",
* "internalContext" : { "type" : "Function", "range" : "[(41, 8), (43, 9)]" }
*/
~foostruct()
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic