Clang: Add semantic C++ operator-token styling

We used to style overloaded operators in the same way
as C++'s built-in operators. There was no way to tell
if a + token would call a operator+() function or not.

Now, if an operator is overloaded (redefined),
we give it the "Overloaded Operator"-mixin so users
can style it differently.

Note: Calls to overloaded 'new' and 'delete' are not
highlighted by "Overloaded Operator". This is because
clang today always maps these to CXCursor_CXXNewExpr
and CXCursor_CXXDeleteExpr with cursor.spelling == ""
(empty string). So there is no (?) quick way for us
to tell if a new/delete-token was overloaded or not.

After follow-ups, follow symbol will work for operator
overload usages in current translation unit.
Commit is appended by Ivan Donchevskii.

Task-number: QTCREATORBUG-19659
Change-Id: I157855d482a61ad2059642a1ee982089fcb7d312
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
This commit is contained in:
Hugo Holgersson
2016-11-05 15:29:10 +01:00
parent bb6eae5c3b
commit 142ae0cdf9
15 changed files with 519 additions and 75 deletions

View File

@@ -255,7 +255,8 @@ CPlusPlus::Icons::IconType iconTypeForToken(const ClangBackEnd::TokenInfoContain
ClangBackEnd::StorageClass storageClass = extraInfo.storageClass;
if (mainType == ClangBackEnd::HighlightingType::VirtualFunction
|| mainType == ClangBackEnd::HighlightingType::Function) {
|| mainType == ClangBackEnd::HighlightingType::Function
|| mainType == ClangBackEnd::HighlightingType::Operator) {
if (storageClass != ClangBackEnd::StorageClass::Static) {
switch (access) {
case ClangBackEnd::AccessSpecifier::Public: