From 78aa734eee0a481cb13743f74a4b66a340e207fa Mon Sep 17 00:00:00 2001 From: John McCall Date: Mon, 23 Jul 2018 02:01:50 -0400 Subject: [PATCH] Add indexing infrastructure for Swift's read and modify accessors. --- include/clang/Index/IndexSymbol.h | 2 ++ include/indexstore/indexstore.h | 2 ++ lib/Index/IndexDataStoreUtils.cpp | 8 ++++++++ lib/Index/IndexSymbol.cpp | 2 ++ 4 files changed, 14 insertions(+) diff --git a/include/clang/Index/IndexSymbol.h b/include/clang/Index/IndexSymbol.h index ac9f6f5a412..b320f92495b 100644 --- a/include/clang/Index/IndexSymbol.h +++ b/include/clang/Index/IndexSymbol.h @@ -81,6 +81,8 @@ enum class SymbolSubKind : uint8_t { SwiftAccessorDidSet, SwiftAccessorAddressor, SwiftAccessorMutableAddressor, + SwiftAccessorRead, + SwiftAccessorModify, SwiftExtensionOfStruct, SwiftExtensionOfClass, diff --git a/include/indexstore/indexstore.h b/include/indexstore/indexstore.h index f4f41db0023..405b3709b0d 100644 --- a/include/indexstore/indexstore.h +++ b/include/indexstore/indexstore.h @@ -237,6 +237,8 @@ typedef enum { INDEXSTORE_SYMBOL_SUBKIND_SWIFTSUBSCRIPT = 1011, INDEXSTORE_SYMBOL_SUBKIND_SWIFTASSOCIATEDTYPE = 1012, INDEXSTORE_SYMBOL_SUBKIND_SWIFTGENERICTYPEPARAM = 1013, + INDEXSTORE_SYMBOL_SUBKIND_SWIFTACCESSORREAD = 1014, + INDEXSTORE_SYMBOL_SUBKIND_SWIFTACCESSORMODIFY = 1015, } indexstore_symbol_subkind_t; typedef enum { diff --git a/lib/Index/IndexDataStoreUtils.cpp b/lib/Index/IndexDataStoreUtils.cpp index 3efaec95e23..b4c8f815a54 100644 --- a/lib/Index/IndexDataStoreUtils.cpp +++ b/lib/Index/IndexDataStoreUtils.cpp @@ -129,6 +129,10 @@ SymbolSubKind index::getSymbolSubKind(indexstore_symbol_subkind_t K) { return SymbolSubKind::SwiftAccessorAddressor; case INDEXSTORE_SYMBOL_SUBKIND_SWIFTACCESSORMUTABLEADDRESSOR: return SymbolSubKind::SwiftAccessorMutableAddressor; + case INDEXSTORE_SYMBOL_SUBKIND_SWIFTACCESSORREAD: + return SymbolSubKind::SwiftAccessorRead; + case INDEXSTORE_SYMBOL_SUBKIND_SWIFTACCESSORMODIFY: + return SymbolSubKind::SwiftAccessorModify; case INDEXSTORE_SYMBOL_SUBKIND_SWIFTEXTENSIONOFSTRUCT: return SymbolSubKind::SwiftExtensionOfStruct; case INDEXSTORE_SYMBOL_SUBKIND_SWIFTEXTENSIONOFCLASS: @@ -269,6 +273,10 @@ indexstore_symbol_subkind_t index::getIndexStoreSubKind(SymbolSubKind K) { return INDEXSTORE_SYMBOL_SUBKIND_SWIFTACCESSORADDRESSOR; case SymbolSubKind::SwiftAccessorMutableAddressor: return INDEXSTORE_SYMBOL_SUBKIND_SWIFTACCESSORMUTABLEADDRESSOR; + case SymbolSubKind::SwiftAccessorRead: + return INDEXSTORE_SYMBOL_SUBKIND_SWIFTACCESSORREAD; + case SymbolSubKind::SwiftAccessorModify: + return INDEXSTORE_SYMBOL_SUBKIND_SWIFTACCESSORMODIFY; case SymbolSubKind::SwiftExtensionOfStruct: return INDEXSTORE_SYMBOL_SUBKIND_SWIFTEXTENSIONOFSTRUCT; case SymbolSubKind::SwiftExtensionOfClass: diff --git a/lib/Index/IndexSymbol.cpp b/lib/Index/IndexSymbol.cpp index 8657f62303f..73e0bd73ac6 100644 --- a/lib/Index/IndexSymbol.cpp +++ b/lib/Index/IndexSymbol.cpp @@ -484,6 +484,8 @@ StringRef index::getSymbolSubKindString(SymbolSubKind K) { case SymbolSubKind::SwiftAccessorDidSet: return "acc-didset"; case SymbolSubKind::SwiftAccessorAddressor: return "acc-addr"; case SymbolSubKind::SwiftAccessorMutableAddressor: return "acc-mutaddr"; + case SymbolSubKind::SwiftAccessorRead: return "acc-read"; + case SymbolSubKind::SwiftAccessorModify: return "acc-modify"; case SymbolSubKind::SwiftExtensionOfStruct: return "ext-struct"; case SymbolSubKind::SwiftExtensionOfClass: return "ext-class"; case SymbolSubKind::SwiftExtensionOfEnum: return "ext-enum";