1 /*
2 SPDX-FileCopyrightText: 2014 Kevin Funk <kfunk@kde.org>
3
4 SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
5 */
6
7 #include "clangdebug.h"
8
9 #include "clangtypes.h"
10
11 #include <language/editor/documentcursor.h>
12 #include <language/editor/documentrange.h>
13
14 // Keep in sync with declare_qt_logging_category call
15 const QtMsgType defaultMsgType = QtInfoMsg;
16 Q_LOGGING_CATEGORY(KDEV_CLANG, "kdevelop.plugins.clang", defaultMsgType)
17
18 using namespace KDevelop;
19
operator <<(QDebug dbg,CXString string)20 QDebug operator<<(QDebug dbg, CXString string)
21 {
22 dbg << ClangString(string).c_str();
23 return dbg;
24 }
25
operator <<(QDebug dbg,CXSourceLocation location)26 QDebug operator<<(QDebug dbg, CXSourceLocation location)
27 {
28 dbg << DocumentCursor(ClangLocation(location));
29 return dbg;
30 }
31
operator <<(QDebug dbg,CXSourceRange range)32 QDebug operator<<(QDebug dbg, CXSourceRange range)
33 {
34 dbg << ClangRange(range).toDocumentRange();
35 return dbg;
36 }
37
operator <<(QDebug dbg,CXCursor cursor)38 QDebug operator<<(QDebug dbg, CXCursor cursor)
39 {
40 return dbg << clang_getCursorKind(cursor) << clang_getCursorDisplayName(cursor) << clang_getCursorType(cursor) << clang_getCursorLocation(cursor);
41 }
42
operator <<(QDebug dbg,CXCursorKind kind)43 QDebug operator<<(QDebug dbg, CXCursorKind kind)
44 {
45 return dbg << clang_getCursorKindSpelling(kind);
46 }
47
operator <<(QDebug dbg,CXType type)48 QDebug operator<<(QDebug dbg, CXType type)
49 {
50 return dbg << type.kind << clang_getTypeSpelling(type);
51 }
52
operator <<(QDebug dbg,CXTypeKind typeKind)53 QDebug operator<<(QDebug dbg, CXTypeKind typeKind)
54 {
55 return dbg << clang_getTypeKindSpelling(typeKind);
56 }
57