Skip to content

Commit 6120b53

Browse files
committed
Add size for indexstoredb_symbol_role_t
This was previously miscompiling with clang (would be 32 bit instead of 64 bit) and now errors with clang 19. Note that this doesn't seem to have had any impact within indexstore-db itself - the C++ side is using a different enum (`SymbolRole`) which has: ``` Canonical = uint64_t(1) << 63, ``` And seems like the only real use of `Canonical` is `foreachCanonicalSymbolOccurrenceImpl` itself (also C++).
1 parent 6e5fa59 commit 6120b53

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

Sources/IndexStoreDB/SymbolRole.swift

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,7 @@ public struct SymbolRole: OptionSet, Hashable, Sendable {
4242

4343
// MARK: Additional IndexStoreDB index roles
4444

45-
// Note: the imported constant INDEXSTOREDB_SYMBOL_ROLE_CANONICAL is signed by default and
46-
// fails to construct in Swift.
47-
public static let canonical: SymbolRole = SymbolRole(rawValue: 1 << 63)
45+
public static let canonical: SymbolRole = SymbolRole(rawValue: INDEXSTOREDB_SYMBOL_ROLE_CANONICAL)
4846

4947
public static let all: SymbolRole = SymbolRole(rawValue: ~0)
5048

include/CIndexStoreDB/CIndexStoreDB.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ typedef void *indexstoredb_symbol_location_t;
5959
typedef void *indexstoredb_symbol_relation_t;
6060
typedef void *indexstoredb_unit_info_t;
6161

62-
typedef enum {
62+
typedef enum : uint64_t {
6363
INDEXSTOREDB_SYMBOL_ROLE_DECLARATION = 1 << 0,
6464
INDEXSTOREDB_SYMBOL_ROLE_DEFINITION = 1 << 1,
6565
INDEXSTOREDB_SYMBOL_ROLE_REFERENCE = 1 << 2,
@@ -82,7 +82,7 @@ typedef enum {
8282
INDEXSTOREDB_SYMBOL_ROLE_REL_IBTYPEOF = 1 << 17,
8383
INDEXSTOREDB_SYMBOL_ROLE_REL_SPECIALIZATIONOF = 1 << 18,
8484

85-
INDEXSTOREDB_SYMBOL_ROLE_CANONICAL = 1 << 63,
85+
INDEXSTOREDB_SYMBOL_ROLE_CANONICAL = (uint64_t)1 << 63,
8686
} indexstoredb_symbol_role_t;
8787

8888
typedef enum {

0 commit comments

Comments
 (0)