1 /**************************************************************************** 2 ** 3 ** Copyright (C) 2016 The Qt Company Ltd. 4 ** Contact: https://www.qt.io/licensing/ 5 ** 6 ** This file is part of Qt Creator. 7 ** 8 ** Commercial License Usage 9 ** Licensees holding valid commercial Qt licenses may use this file in 10 ** accordance with the commercial license agreement provided with the 11 ** Software or, alternatively, in accordance with the terms contained in 12 ** a written agreement between you and The Qt Company. For licensing terms 13 ** and conditions see https://www.qt.io/terms-conditions. For further 14 ** information use the contact form at https://www.qt.io/contact-us. 15 ** 16 ** GNU General Public License Usage 17 ** Alternatively, this file may be used under the terms of the GNU 18 ** General Public License version 3 as published by the Free Software 19 ** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT 20 ** included in the packaging of this file. Please review the following 21 ** information to ensure the GNU General Public License requirements will 22 ** be met: https://www.gnu.org/licenses/gpl-3.0.html. 23 ** 24 ****************************************************************************/ 25 26 #pragma once 27 28 #include <utils/sizedarray.h> 29 30 #include <QtCore/qglobal.h> 31 32 #include <utils/smallstringfwd.h> 33 34 #if defined(CLANGSUPPORT_BUILD_LIB) 35 # define CLANGSUPPORT_EXPORT Q_DECL_EXPORT 36 #elif defined(CLANGSUPPORT_BUILD_STATIC_LIB) 37 # define CLANGSUPPORT_EXPORT 38 #else 39 # define CLANGSUPPORT_EXPORT Q_DECL_IMPORT 40 #endif 41 42 #ifdef Q_CC_GNU 43 # define CLANGSUPPORT_GCCEXPORT __attribute__((visibility("default"))) 44 #else 45 # define CLANGSUPPORT_GCCEXPORT 46 #endif 47 48 #ifndef CLANGBACKENDPROCESSPATH 49 # define CLANGBACKENDPROCESSPATH "" 50 #endif 51 52 #ifdef UNIT_TESTS 53 #define unittest_public public 54 #else 55 #define unittest_public private 56 #endif 57 58 namespace ClangBackEnd { 59 60 enum class DiagnosticSeverity : quint32 // one to one mapping of the clang enum numbers 61 { 62 Ignored = 0, 63 Note = 1, 64 Warning = 2, 65 Error = 3, 66 Fatal = 4 67 }; 68 69 enum class HighlightingType : quint8 70 { 71 Invalid, 72 Keyword, 73 StringLiteral, 74 NumberLiteral, 75 Comment, 76 Function, 77 VirtualFunction, 78 Type, 79 PrimitiveType, 80 LocalVariable, 81 Parameter, 82 Field, 83 GlobalVariable, 84 Enumeration, 85 Operator, 86 OverloadedOperator, 87 Preprocessor, 88 PreprocessorDefinition, 89 PreprocessorExpansion, 90 Punctuation, 91 Label, 92 Declaration, 93 FunctionDefinition, 94 OutputArgument, 95 Namespace, 96 Class, 97 Struct, 98 Enum, 99 Union, 100 TypeAlias, 101 Typedef, 102 QtProperty, 103 ObjectiveCClass, 104 ObjectiveCCategory, 105 ObjectiveCProtocol, 106 ObjectiveCInterface, 107 ObjectiveCImplementation, 108 ObjectiveCProperty, 109 ObjectiveCMethod, 110 TemplateTypeParameter, 111 TemplateTemplateParameter, 112 AngleBracketOpen, 113 AngleBracketClose, 114 DoubleAngleBracketClose, // clang parses ">>" as one token, even if it's closing a nested template 115 TernaryIf, 116 TernaryElse, 117 }; 118 119 enum class StorageClass : quint8 120 { 121 Invalid, 122 None, 123 Extern, 124 Static, 125 PrivateExtern, 126 Auto, 127 Register 128 }; 129 130 enum class AccessSpecifier : quint8 131 { 132 Invalid, 133 Public, 134 Protected, 135 Private 136 }; 137 138 enum class CompletionCorrection : quint32 139 { 140 NoCorrection, 141 DotToArrowCorrection 142 }; 143 144 enum class MessageType : quint8 { 145 InvalidMessage, 146 AliveMessage, 147 EchoMessage, 148 EndMessage, 149 150 DocumentsOpenedMessage, 151 DocumentsChangedMessage, 152 DocumentsClosedMessage, 153 DocumentVisibilityChangedMessage, 154 155 UnsavedFilesUpdatedMessage, 156 UnsavedFilesRemovedMessage, 157 158 RequestAnnotationsMessage, 159 AnnotationsMessage, 160 161 RequestReferencesMessage, 162 ReferencesMessage, 163 164 RequestFollowSymbolMessage, 165 FollowSymbolMessage, 166 167 RequestToolTipMessage, 168 ToolTipMessage, 169 170 RequestCompletionsMessage, 171 CompletionsMessage, 172 }; 173 174 template<MessageType messageEnumeration> 175 struct MessageTypeTrait; 176 177 template<class Message> 178 struct MessageTrait; 179 180 #define DECLARE_MESSAGE(Message) \ 181 template<> \ 182 struct MessageTrait<Message> \ 183 { \ 184 static const MessageType enumeration = MessageType::Message; \ 185 }; 186 187 using MixinHighlightingTypes = Utils::SizedArray<HighlightingType, 6>; 188 189 struct HighlightingTypes { 190 HighlightingType mainHighlightingType = HighlightingType::Invalid; 191 MixinHighlightingTypes mixinHighlightingTypes; 192 }; 193 194 enum class SourceLocationKind : uchar { 195 Definition = 1, 196 Declaration, 197 DeclarationReference, 198 MacroDefinition = 128, 199 MacroUndefinition, 200 MacroUsage, 201 None = 255, 202 }; 203 204 enum class SymbolKind : uchar 205 { 206 None = 0, 207 Enumeration, 208 Record, 209 Function, 210 Variable, 211 Macro 212 }; 213 214 using SymbolKinds = Utils::SizedArray<SymbolKind, 8>; 215 216 enum class SymbolTag : uchar 217 { 218 None = 0, 219 Class, 220 Struct, 221 Union, 222 MsvcInterface 223 }; 224 225 using SymbolTags = Utils::SizedArray<SymbolTag, 7>; 226 227 enum class ProgressType { Invalid, PrecompiledHeader, Indexing, DependencyCreation }; 228 } // namespace ClangBackEnd 229