Skip to content

Commit 627a35c

Browse files
committed
[IndexStore] Add an API to retrieve the indexstore version
Allow clients to conditionalize on the indexstore version they're using.
1 parent 149f529 commit 627a35c

File tree

4 files changed

+11
-0
lines changed

4 files changed

+11
-0
lines changed

clang/include/indexstore/IndexStoreCXX.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,10 @@ class IndexStore {
138138
return indexstore_format_version();
139139
}
140140

141+
static unsigned version() {
142+
return indexstore_version();
143+
}
144+
141145
bool isValid() const { return obj; }
142146
bool isInvalid() const { return !isValid(); }
143147
explicit operator bool() const { return isValid(); }

clang/include/indexstore/indexstore.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,8 @@ typedef struct {
128128
INDEXSTORE_PUBLIC unsigned
129129
indexstore_format_version(void);
130130

131+
INDEXSTORE_PUBLIC unsigned indexstore_version(void);
132+
131133
typedef void *indexstore_t;
132134
typedef void *indexstore_creation_options_t;
133135

clang/tools/IndexStore/IndexStore.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,10 @@ indexstore_format_version(void) {
101101
return IndexDataStore::getFormatVersion();
102102
}
103103

104+
unsigned indexstore_version(void) {
105+
return INDEXSTORE_VERSION;
106+
}
107+
104108
indexstore_creation_options_t
105109
indexstore_creation_options_create(void) {
106110
return new IndexStoreCreationOptions();

clang/tools/IndexStore/IndexStore.exports

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ indexstore_creation_options_dispose
44
indexstore_error_get_description
55
indexstore_error_dispose
66
indexstore_format_version
7+
indexstore_version
78
indexstore_store_create
89
indexstore_store_create_with_options
910
indexstore_store_dispose

0 commit comments

Comments
 (0)