Skip to content
This repository was archived by the owner on Mar 28, 2020. It is now read-only.

Commit fadd045

Browse files
committed
Merge remote-tracking branch 'origin/apple/stable/20190619' into stable
2 parents 1cf6569 + 89e5753 commit fadd045

File tree

4 files changed

+40
-20
lines changed

4 files changed

+40
-20
lines changed

include/clang/Index/IndexDataStoreSymbolUtils.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,10 @@ indexstore_symbol_subkind_t getIndexStoreSubKind(SymbolSubKind K);
4242
indexstore_symbol_language_t getIndexStoreLang(SymbolLanguage L);
4343

4444
/// Map a SymbolPropertySet to its indexstore representation.
45-
uint64_t getIndexStoreProperties(SymbolPropertySet Props);
45+
indexstore_symbol_property_t getIndexStoreProperties(SymbolPropertySet Props);
4646

4747
/// Map a SymbolRoleSet to its indexstore representation.
48-
uint64_t getIndexStoreRoles(SymbolRoleSet Roles);
48+
indexstore_symbol_role_t getIndexStoreRoles(SymbolRoleSet Roles);
4949

5050
} // end namespace index
5151
} // end namespace clang

include/indexstore/indexstore.h

Lines changed: 29 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,26 @@
8484
# define INDEXSTORE_NOESCAPE
8585
#endif
8686

87+
#if __has_attribute(flag_enum)
88+
# define INDEXSTORE_FLAG_ENUM_ATTR __attribute__((flag_enum))
89+
#else
90+
# define INDEXSTORE_FLAG_ENUM_ATTR
91+
#endif
92+
93+
#if __has_attribute(enum_extensibility)
94+
# define INDEXSTORE_OPEN_ENUM_ATTR __attribute__((enum_extensibility(open)))
95+
#else
96+
# define INDEXSTORE_OPEN_ENUM_ATTR
97+
#endif
98+
99+
#define INDEXSTORE_OPTIONS_ATTRS INDEXSTORE_OPEN_ENUM_ATTR INDEXSTORE_FLAG_ENUM_ATTR
100+
101+
#if __has_extension(cxx_strong_enums) || __has_feature(objc_fixed_enum)
102+
# define INDEXSTORE_OPTIONS(_type, _name) enum INDEXSTORE_OPTIONS_ATTRS _name : _type _name; enum INDEXSTORE_OPTIONS_ATTRS _name : _type
103+
#else
104+
# define INDEXSTORE_OPTIONS(_type, _name) _type _name; enum INDEXSTORE_OPTIONS_ATTRS
105+
#endif
106+
87107
INDEXSTORE_BEGIN_DECLS
88108

89109
typedef void *indexstore_error_t;
@@ -266,7 +286,7 @@ typedef enum {
266286
INDEXSTORE_SYMBOL_SUBKIND_SWIFTACCESSORMODIFY = 1015,
267287
} indexstore_symbol_subkind_t;
268288

269-
typedef enum {
289+
typedef INDEXSTORE_OPTIONS(uint64_t, indexstore_symbol_property_t) {
270290
INDEXSTORE_SYMBOL_PROPERTY_GENERIC = 1 << 0,
271291
INDEXSTORE_SYMBOL_PROPERTY_TEMPLATE_PARTIAL_SPECIALIZATION = 1 << 1,
272292
INDEXSTORE_SYMBOL_PROPERTY_TEMPLATE_SPECIALIZATION = 1 << 2,
@@ -276,7 +296,7 @@ typedef enum {
276296
INDEXSTORE_SYMBOL_PROPERTY_GKINSPECTABLE = 1 << 6,
277297
INDEXSTORE_SYMBOL_PROPERTY_LOCAL = 1 << 7,
278298
INDEXSTORE_SYMBOL_PROPERTY_PROTOCOL_INTERFACE = 1 << 8,
279-
} indexstore_symbol_property_t;
299+
};
280300

281301
typedef enum {
282302
INDEXSTORE_SYMBOL_LANG_C = 0,
@@ -286,7 +306,7 @@ typedef enum {
286306
INDEXSTORE_SYMBOL_LANG_SWIFT = 100,
287307
} indexstore_symbol_language_t;
288308

289-
typedef enum {
309+
typedef INDEXSTORE_OPTIONS(uint64_t, indexstore_symbol_role_t) {
290310
INDEXSTORE_SYMBOL_ROLE_DECLARATION = 1 << 0,
291311
INDEXSTORE_SYMBOL_ROLE_DEFINITION = 1 << 1,
292312
INDEXSTORE_SYMBOL_ROLE_REFERENCE = 1 << 2,
@@ -310,7 +330,7 @@ typedef enum {
310330
INDEXSTORE_SYMBOL_ROLE_REL_CONTAINEDBY = 1 << 16,
311331
INDEXSTORE_SYMBOL_ROLE_REL_IBTYPEOF = 1 << 17,
312332
INDEXSTORE_SYMBOL_ROLE_REL_SPECIALIZATIONOF = 1 << 18,
313-
} indexstore_symbol_role_t;
333+
};
314334

315335
INDEXSTORE_PUBLIC indexstore_symbol_language_t
316336
indexstore_symbol_get_language(indexstore_symbol_t);
@@ -321,13 +341,13 @@ indexstore_symbol_get_kind(indexstore_symbol_t);
321341
INDEXSTORE_PUBLIC indexstore_symbol_subkind_t
322342
indexstore_symbol_get_subkind(indexstore_symbol_t);
323343

324-
INDEXSTORE_PUBLIC uint64_t
344+
INDEXSTORE_PUBLIC indexstore_symbol_property_t
325345
indexstore_symbol_get_properties(indexstore_symbol_t);
326346

327-
INDEXSTORE_PUBLIC uint64_t
347+
INDEXSTORE_PUBLIC indexstore_symbol_role_t
328348
indexstore_symbol_get_roles(indexstore_symbol_t);
329349

330-
INDEXSTORE_PUBLIC uint64_t
350+
INDEXSTORE_PUBLIC indexstore_symbol_role_t
331351
indexstore_symbol_get_related_roles(indexstore_symbol_t);
332352

333353
INDEXSTORE_PUBLIC indexstore_string_ref_t
@@ -341,7 +361,7 @@ indexstore_symbol_get_codegen_name(indexstore_symbol_t);
341361

342362
typedef void *indexstore_symbol_relation_t;
343363

344-
INDEXSTORE_PUBLIC uint64_t
364+
INDEXSTORE_PUBLIC indexstore_symbol_role_t
345365
indexstore_symbol_relation_get_roles(indexstore_symbol_relation_t);
346366

347367
INDEXSTORE_PUBLIC indexstore_symbol_t
@@ -363,7 +383,7 @@ indexstore_occurrence_relations_apply_f(indexstore_occurrence_t,
363383
void *context,
364384
INDEXSTORE_NOESCAPE bool(*applier)(void *context, indexstore_symbol_relation_t symbol_rel));
365385

366-
INDEXSTORE_PUBLIC uint64_t
386+
INDEXSTORE_PUBLIC indexstore_symbol_role_t
367387
indexstore_occurrence_get_roles(indexstore_occurrence_t);
368388

369389
INDEXSTORE_PUBLIC void

lib/Index/IndexDataStoreUtils.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -412,7 +412,7 @@ indexstore_symbol_language_t index::getIndexStoreLang(SymbolLanguage L) {
412412
}
413413

414414
/// Map a SymbolPropertySet to its indexstore representation.
415-
uint64_t index::getIndexStoreProperties(SymbolPropertySet Props) {
415+
indexstore_symbol_property_t index::getIndexStoreProperties(SymbolPropertySet Props) {
416416
uint64_t storeProp = 0;
417417
applyForEachSymbolProperty(Props, [&](SymbolProperty prop) {
418418
switch (prop) {
@@ -445,11 +445,11 @@ uint64_t index::getIndexStoreProperties(SymbolPropertySet Props) {
445445
break;
446446
}
447447
});
448-
return storeProp;
448+
return static_cast<indexstore_symbol_property_t>(storeProp);
449449
}
450450

451451
/// Map a SymbolRoleSet to its indexstore representation.
452-
uint64_t index::getIndexStoreRoles(SymbolRoleSet Roles) {
452+
indexstore_symbol_role_t index::getIndexStoreRoles(SymbolRoleSet Roles) {
453453
uint64_t storeRoles = 0;
454454
applyForEachSymbolRole(Roles, [&](SymbolRole role) {
455455
switch (role) {
@@ -518,5 +518,5 @@ uint64_t index::getIndexStoreRoles(SymbolRoleSet Roles) {
518518
break;
519519
}
520520
});
521-
return storeRoles;
521+
return static_cast<indexstore_symbol_role_t>(storeRoles);
522522
}

tools/IndexStore/IndexStore.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -321,17 +321,17 @@ indexstore_symbol_get_language(indexstore_symbol_t sym) {
321321
return getIndexStoreLang(static_cast<IndexRecordDecl *>(sym)->SymInfo.Lang);
322322
}
323323

324-
uint64_t
324+
indexstore_symbol_property_t
325325
indexstore_symbol_get_properties(indexstore_symbol_t sym) {
326326
return getIndexStoreProperties(static_cast<IndexRecordDecl *>(sym)->SymInfo.Properties);
327327
}
328328

329-
uint64_t
329+
indexstore_symbol_role_t
330330
indexstore_symbol_get_roles(indexstore_symbol_t sym) {
331331
return getIndexStoreRoles(static_cast<IndexRecordDecl *>(sym)->Roles);
332332
}
333333

334-
uint64_t
334+
indexstore_symbol_role_t
335335
indexstore_symbol_get_related_roles(indexstore_symbol_t sym) {
336336
return getIndexStoreRoles(static_cast<IndexRecordDecl *>(sym)->RelatedRoles);
337337
}
@@ -354,7 +354,7 @@ indexstore_symbol_get_codegen_name(indexstore_symbol_t sym) {
354354
return toIndexStoreString(D->CodeGenName);
355355
}
356356

357-
uint64_t
357+
indexstore_symbol_role_t
358358
indexstore_symbol_relation_get_roles(indexstore_symbol_relation_t sym_rel) {
359359
return getIndexStoreRoles(static_cast<IndexRecordRelation *>(sym_rel)->Roles);
360360
}
@@ -394,7 +394,7 @@ indexstore_occurrence_relations_apply_f(indexstore_occurrence_t occur,
394394
return true;
395395
}
396396

397-
uint64_t
397+
indexstore_symbol_role_t
398398
indexstore_occurrence_get_roles(indexstore_occurrence_t occur) {
399399
return getIndexStoreRoles(static_cast<IndexRecordOccurrence*>(occur)->Roles);
400400
}

0 commit comments

Comments
 (0)