diff options
author | Hugo Holgersson <hugo.holgersson@logikbyran.se> | 2016-11-05 15:29:10 +0100 |
---|---|---|
committer | Hugo Holgersson <hugo.holgersson@logikbyran.se> | 2018-04-30 15:10:12 +0000 |
commit | 142ae0cdf9310ae924b9f92812fe8b2cb3569237 (patch) | |
tree | 7ea99ff18f3e742a35835364ee26664fb866bfaa /src/plugins/clangcodemodel/clangutils.cpp | |
parent | bb6eae5c3bda7692f1ad817cc869218df87e7451 (diff) |
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>
Diffstat (limited to 'src/plugins/clangcodemodel/clangutils.cpp')
-rw-r--r-- | src/plugins/clangcodemodel/clangutils.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/plugins/clangcodemodel/clangutils.cpp b/src/plugins/clangcodemodel/clangutils.cpp index 799bc99e88..0b82c90f00 100644 --- a/src/plugins/clangcodemodel/clangutils.cpp +++ b/src/plugins/clangcodemodel/clangutils.cpp @@ -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: |