@@ -1159,239 +1159,13 @@ impl UnsavedFile {
1159
1159
}
1160
1160
1161
1161
/// Convert a cursor kind into a static string.
1162
- pub fn kind_to_str ( x : Enum_CXCursorKind ) -> & ' static str {
1163
- match x {
1164
- CXCursor_UnexposedDecl => "UnexposedDecl" ,
1165
- CXCursor_StructDecl => "StructDecl" ,
1166
- CXCursor_UnionDecl => "UnionDecl" ,
1167
- CXCursor_ClassDecl => "ClassDecl" ,
1168
- CXCursor_EnumDecl => "EnumDecl" ,
1169
- CXCursor_FieldDecl => "FieldDecl" ,
1170
- CXCursor_EnumConstantDecl => "EnumConstantDecl" ,
1171
- CXCursor_FunctionDecl => "FunctionDecl" ,
1172
- CXCursor_VarDecl => "VarDecl" ,
1173
- CXCursor_ParmDecl => "ParmDecl" ,
1174
- CXCursor_ObjCInterfaceDecl => "ObjCInterfaceDecl" ,
1175
- CXCursor_ObjCCategoryDecl => "ObjCCategoryDecl" ,
1176
- CXCursor_ObjCProtocolDecl => "ObjCProtocolDecl" ,
1177
- CXCursor_ObjCPropertyDecl => "ObjCPropertyDecl" ,
1178
- CXCursor_ObjCIvarDecl => "ObjCIvarDecl" ,
1179
- CXCursor_ObjCInstanceMethodDecl => "ObjCInstanceMethodDecl" ,
1180
- CXCursor_ObjCClassMethodDecl => "ObjCClassMethodDecl" ,
1181
- CXCursor_ObjCImplementationDecl => "ObjCImplementationDecl" ,
1182
- CXCursor_ObjCCategoryImplDecl => "ObjCCategoryImplDecl" ,
1183
- CXCursor_TypedefDecl => "TypedefDecl" ,
1184
- CXCursor_CXXMethod => "CXXMethod" ,
1185
- CXCursor_Namespace => "Namespace" ,
1186
- CXCursor_LinkageSpec => "LinkageSpec" ,
1187
- CXCursor_Constructor => "Constructor" ,
1188
- CXCursor_Destructor => "Destructor" ,
1189
- CXCursor_ConversionFunction => "ConversionFunction" ,
1190
- CXCursor_TemplateTypeParameter => "TemplateTypeParameter" ,
1191
- CXCursor_NonTypeTemplateParameter => "NonTypeTemplateParameter" ,
1192
- CXCursor_TemplateTemplateParameter => "TemplateTemplateParameter" ,
1193
- CXCursor_FunctionTemplate => "FunctionTemplate" ,
1194
- CXCursor_ClassTemplate => "ClassTemplate" ,
1195
- CXCursor_ClassTemplatePartialSpecialization => {
1196
- // FIXME: Ugly hack for rustfmt, should go away!
1197
- //
1198
- // I plan to convert this into an enum right away anyway, though.
1199
- return "ClassTemplatePartialSpecialization" ;
1200
- }
1201
- CXCursor_NamespaceAlias => "NamespaceAlias" ,
1202
- CXCursor_UsingDirective => "UsingDirective" ,
1203
- CXCursor_UsingDeclaration => "UsingDeclaration" ,
1204
- CXCursor_TypeAliasDecl => "TypeAliasDecl" ,
1205
- CXCursor_ObjCSynthesizeDecl => "ObjCSynthesizeDecl" ,
1206
- CXCursor_ObjCDynamicDecl => "ObjCDynamicDecl" ,
1207
- CXCursor_CXXAccessSpecifier => "CXXAccessSpecifier" ,
1208
- // CXCursor_FirstDecl => "FirstDecl",
1209
- // CXCursor_LastDecl => "LastDecl",
1210
- CXCursor_FirstRef => "FirstRef" ,
1211
- // CXCursor_ObjCSuperClassRef => "ObjCSuperClassRef",
1212
- CXCursor_ObjCProtocolRef => "ObjCProtocolRef" ,
1213
- CXCursor_ObjCClassRef => "ObjCClassRef" ,
1214
- CXCursor_TypeRef => "TypeRef" ,
1215
- CXCursor_CXXBaseSpecifier => "CXXBaseSpecifier" ,
1216
- CXCursor_TemplateRef => "TemplateRef" ,
1217
- CXCursor_NamespaceRef => "NamespaceRef" ,
1218
- CXCursor_MemberRef => "MemberRef" ,
1219
- // CXCursor_LabelRef => "LabelRef",
1220
- CXCursor_OverloadedDeclRef => "OverloadedDeclRef" ,
1221
- CXCursor_VariableRef => "VariableRef" ,
1222
- // CXCursor_LastRef => "LastRef",
1223
- CXCursor_FirstInvalid => "FirstInvalid" ,
1224
- // CXCursor_InvalidFile => "InvalidFile",
1225
- CXCursor_NoDeclFound => "NoDeclFound" ,
1226
- CXCursor_NotImplemented => "NotImplemented" ,
1227
- CXCursor_InvalidCode => "InvalidCode" ,
1228
- // CXCursor_LastInvalid => "LastInvalid",
1229
- CXCursor_FirstExpr => "FirstExpr" ,
1230
- // CXCursor_UnexposedExpr => "UnexposedExpr",
1231
- CXCursor_DeclRefExpr => "DeclRefExpr" ,
1232
- CXCursor_MemberRefExpr => "MemberRefExpr" ,
1233
- CXCursor_CallExpr => "CallExpr" ,
1234
- CXCursor_ObjCMessageExpr => "ObjCMessageExpr" ,
1235
- CXCursor_BlockExpr => "BlockExpr" ,
1236
- CXCursor_IntegerLiteral => "IntegerLiteral" ,
1237
- CXCursor_FloatingLiteral => "FloatingLiteral" ,
1238
- CXCursor_ImaginaryLiteral => "ImaginaryLiteral" ,
1239
- CXCursor_StringLiteral => "StringLiteral" ,
1240
- CXCursor_CharacterLiteral => "CharacterLiteral" ,
1241
- CXCursor_ParenExpr => "ParenExpr" ,
1242
- CXCursor_UnaryOperator => "UnaryOperator" ,
1243
- CXCursor_ArraySubscriptExpr => "ArraySubscriptExpr" ,
1244
- CXCursor_BinaryOperator => "BinaryOperator" ,
1245
- CXCursor_CompoundAssignOperator => "CompoundAssignOperator" ,
1246
- CXCursor_ConditionalOperator => "ConditionalOperator" ,
1247
- CXCursor_CStyleCastExpr => "CStyleCastExpr" ,
1248
- CXCursor_CompoundLiteralExpr => "CompoundLiteralExpr" ,
1249
- CXCursor_InitListExpr => "InitListExpr" ,
1250
- CXCursor_AddrLabelExpr => "AddrLabelExpr" ,
1251
- CXCursor_StmtExpr => "StmtExpr" ,
1252
- CXCursor_GenericSelectionExpr => "GenericSelectionExpr" ,
1253
- CXCursor_GNUNullExpr => "GNUNullExpr" ,
1254
- CXCursor_CXXStaticCastExpr => "CXXStaticCastExpr" ,
1255
- CXCursor_CXXDynamicCastExpr => "CXXDynamicCastExpr" ,
1256
- CXCursor_CXXReinterpretCastExpr => "CXXReinterpretCastExpr" ,
1257
- CXCursor_CXXConstCastExpr => "CXXConstCastExpr" ,
1258
- CXCursor_CXXFunctionalCastExpr => "CXXFunctionalCastExpr" ,
1259
- CXCursor_CXXTypeidExpr => "CXXTypeidExpr" ,
1260
- CXCursor_CXXBoolLiteralExpr => "CXXBoolLiteralExpr" ,
1261
- CXCursor_CXXNullPtrLiteralExpr => "CXXNullPtrLiteralExpr" ,
1262
- CXCursor_CXXThisExpr => "CXXThisExpr" ,
1263
- CXCursor_CXXThrowExpr => "CXXThrowExpr" ,
1264
- CXCursor_CXXNewExpr => "CXXNewExpr" ,
1265
- CXCursor_CXXDeleteExpr => "CXXDeleteExpr" ,
1266
- CXCursor_UnaryExpr => "UnaryExpr" ,
1267
- CXCursor_ObjCStringLiteral => "ObjCStringLiteral" ,
1268
- CXCursor_ObjCEncodeExpr => "ObjCEncodeExpr" ,
1269
- CXCursor_ObjCSelectorExpr => "ObjCSelectorExpr" ,
1270
- CXCursor_ObjCProtocolExpr => "ObjCProtocolExpr" ,
1271
- CXCursor_ObjCBridgedCastExpr => "ObjCBridgedCastExpr" ,
1272
- CXCursor_PackExpansionExpr => "PackExpansionExpr" ,
1273
- CXCursor_SizeOfPackExpr => "SizeOfPackExpr" ,
1274
- CXCursor_LambdaExpr => "LambdaExpr" ,
1275
- CXCursor_ObjCBoolLiteralExpr => "ObjCBoolLiteralExpr" ,
1276
- // CXCursor_LastExpr => "LastExpr",
1277
- CXCursor_FirstStmt => "FirstStmt" ,
1278
- // CXCursor_UnexposedStmt => "UnexposedStmt",
1279
- CXCursor_LabelStmt => "LabelStmt" ,
1280
- CXCursor_CompoundStmt => "CompoundStmt" ,
1281
- CXCursor_CaseStmt => "CaseStmt" ,
1282
- CXCursor_DefaultStmt => "DefaultStmt" ,
1283
- CXCursor_IfStmt => "IfStmt" ,
1284
- CXCursor_SwitchStmt => "SwitchStmt" ,
1285
- CXCursor_WhileStmt => "WhileStmt" ,
1286
- CXCursor_DoStmt => "DoStmt" ,
1287
- CXCursor_ForStmt => "ForStmt" ,
1288
- CXCursor_GotoStmt => "GotoStmt" ,
1289
- CXCursor_IndirectGotoStmt => "IndirectGotoStmt" ,
1290
- CXCursor_ContinueStmt => "ContinueStmt" ,
1291
- CXCursor_BreakStmt => "BreakStmt" ,
1292
- CXCursor_ReturnStmt => "ReturnStmt" ,
1293
- CXCursor_AsmStmt => "AsmStmt" ,
1294
- CXCursor_ObjCAtTryStmt => "ObjCAtTryStmt" ,
1295
- CXCursor_ObjCAtCatchStmt => "ObjCAtCatchStmt" ,
1296
- CXCursor_ObjCAtFinallyStmt => "ObjCAtFinallyStmt" ,
1297
- CXCursor_ObjCAtThrowStmt => "ObjCAtThrowStmt" ,
1298
- CXCursor_ObjCAtSynchronizedStmt => "ObjCAtSynchronizedStmt" ,
1299
- CXCursor_ObjCAutoreleasePoolStmt => "ObjCAutoreleasePoolStmt" ,
1300
- CXCursor_ObjCForCollectionStmt => "ObjCForCollectionStmt" ,
1301
- CXCursor_CXXCatchStmt => "CXXCatchStmt" ,
1302
- CXCursor_CXXTryStmt => "CXXTryStmt" ,
1303
- CXCursor_CXXForRangeStmt => "CXXForRangeStmt" ,
1304
- CXCursor_SEHTryStmt => "SEHTryStmt" ,
1305
- CXCursor_SEHExceptStmt => "SEHExceptStmt" ,
1306
- CXCursor_SEHFinallyStmt => "SEHFinallyStmt" ,
1307
- CXCursor_NullStmt => "NullStmt" ,
1308
- CXCursor_DeclStmt => "DeclStmt" ,
1309
- // CXCursor_LastStmt => "LastStmt",
1310
- CXCursor_TranslationUnit => "TranslationUnit" ,
1311
- CXCursor_FirstAttr => "FirstAttr" ,
1312
- // CXCursor_UnexposedAttr => "UnexposedAttr",
1313
- CXCursor_IBActionAttr => "IBActionAttr" ,
1314
- CXCursor_IBOutletAttr => "IBOutletAttr" ,
1315
- CXCursor_IBOutletCollectionAttr => "IBOutletCollectionAttr" ,
1316
- CXCursor_CXXFinalAttr => "CXXFinalAttr" ,
1317
- CXCursor_CXXOverrideAttr => "CXXOverrideAttr" ,
1318
- CXCursor_AnnotateAttr => "AnnotateAttr" ,
1319
- CXCursor_AsmLabelAttr => "AsmLabelAttr" ,
1320
- // CXCursor_LastAttr => "LastAttr",
1321
- CXCursor_PreprocessingDirective => "PreprocessingDirective" ,
1322
- CXCursor_MacroDefinition => "MacroDefinition" ,
1323
- CXCursor_MacroExpansion => "MacroExpansion" ,
1324
- // CXCursor_MacroInstantiation => "MacroInstantiation",
1325
- CXCursor_InclusionDirective => "InclusionDirective" ,
1326
- // CXCursor_FirstPreprocessing => "FirstPreprocessing",
1327
- // CXCursor_LastPreprocessing => "LastPreprocessing",
1328
- CXCursor_PackedAttr => "PackedAttr" ,
1329
- CXCursor_ModuleImportDecl => "ModuleImportDecl" ,
1330
- CXCursor_TypeAliasTemplateDecl => "TypeAliasTemplateDecl" ,
1331
- CXCursor_StaticAssert => "StaticAssert" ,
1332
- _ => "?" ,
1333
- }
1162
+ pub fn kind_to_str ( x : Enum_CXCursorKind ) -> String {
1163
+ unsafe { clang_getCursorKindSpelling ( x) } . into ( )
1334
1164
}
1335
1165
1336
1166
/// Convert a type kind to a static string.
1337
- pub fn type_to_str ( x : Enum_CXTypeKind ) -> & ' static str {
1338
- match x {
1339
- CXType_Invalid => "Invalid" ,
1340
- CXType_Unexposed => "Unexposed" ,
1341
- CXType_Void => "Void" ,
1342
- CXType_Bool => "Bool" ,
1343
- CXType_Char_U => "Char_U" ,
1344
- CXType_UChar => "UChar" ,
1345
- CXType_Char16 => "Char16" ,
1346
- CXType_Char32 => "Char32" ,
1347
- CXType_UShort => "UShort" ,
1348
- CXType_UInt => "UInt" ,
1349
- CXType_ULong => "ULong" ,
1350
- CXType_ULongLong => "ULongLong" ,
1351
- CXType_UInt128 => "UInt128" ,
1352
- CXType_Char_S => "Char_S" ,
1353
- CXType_SChar => "SChar" ,
1354
- CXType_WChar => "WChar" ,
1355
- CXType_Short => "Short" ,
1356
- CXType_Int => "Int" ,
1357
- CXType_Long => "Long" ,
1358
- CXType_LongLong => "LongLong" ,
1359
- CXType_Int128 => "Int128" ,
1360
- CXType_Float => "Float" ,
1361
- CXType_Double => "Double" ,
1362
- CXType_LongDouble => "LongDouble" ,
1363
- CXType_NullPtr => "NullPtr" ,
1364
- CXType_Overload => "Overload" ,
1365
- CXType_Dependent => "Dependent" ,
1366
- CXType_ObjCId => "ObjCId" ,
1367
- CXType_ObjCClass => "ObjCClass" ,
1368
- CXType_ObjCSel => "ObjCSel" ,
1369
- // CXType_FirstBuiltin => "FirstBuiltin",
1370
- // CXType_LastBuiltin => "LastBuiltin",
1371
- CXType_Complex => "Complex" ,
1372
- CXType_Pointer => "Pointer" ,
1373
- CXType_BlockPointer => "BlockPointer" ,
1374
- CXType_LValueReference => "LValueReference" ,
1375
- CXType_RValueReference => "RValueReference" ,
1376
- CXType_Record => "Record" ,
1377
- CXType_Enum => "Enum" ,
1378
- CXType_Typedef => "Typedef" ,
1379
- CXType_ObjCInterface => "ObjCInterface" ,
1380
- CXType_ObjCObjectPointer => "ObjCObjectPointer" ,
1381
- CXType_FunctionNoProto => "FunctionNoProto" ,
1382
- CXType_FunctionProto => "FunctionProto" ,
1383
- CXType_ConstantArray => "ConstantArray" ,
1384
- CXType_Vector => "Vector" ,
1385
- CXType_IncompleteArray => "IncompleteArray" ,
1386
- CXType_VariableArray => "VariableArray" ,
1387
- CXType_DependentSizedArray => "DependentSizedArray" ,
1388
- CXType_MemberPointer => "MemberPointer" ,
1389
- #[ cfg( not( feature="llvm_stable" ) ) ]
1390
- CXType_Auto => "Auto" ,
1391
- #[ cfg( not( feature="llvm_stable" ) ) ]
1392
- CXType_Elaborated => "Elaborated" ,
1393
- _ => "?" ,
1394
- }
1167
+ pub fn type_to_str ( x : Enum_CXTypeKind ) -> String {
1168
+ unsafe { clang_getTypeKindSpelling ( x) . into ( ) }
1395
1169
}
1396
1170
1397
1171
/// Dump the Clang AST to stdout for debugging purposes.
0 commit comments