Add CollectVariableType request to SourceKit

- Add VariableTypeCollector
  This new SourceEntityWalker collects types from variable declarations.
- Add SwiftLangSupport::collectVariableTypes
- Implement CollectVariableType request
- Provide information about explicit types in CollectVarType
- Fix HasExplicitType in VariableTypeArray
- Fix typo
- Implement ranged CollectVariableTypes requests
- Use offset/length params for CollectVariableType in sourcekitd-test
- Address a bunch of PR suggestions
- Remove CanonicalType from VariableTypeCollector
  This turned out not to be needed (for now).
- Improve doc comment on VariableTypeCollector::getTypeOffsets
- Remove unused CanonicalTy variable
- Remove out-of-date comment
- Run clang-format on the CollectVariableType implementation
- Fix some minor style issues
- Use emplace_back while collecting variable infos
- Pass CollectVariableType range to VariableTypeCollector
- Use capitalized variable names in VariableTypeArray
  ...as recommended by the LLVM coding standards
- Use PrintOptions for type printing in VariableTypeCollector
- Return void for collectVariableType
  This seems to be cleaner stylistically.
- Avoid visiting subranges of invalid range in VariableTypeCollector
- Use std::string for type buffer in VariableTypeCollectorASTConsumer
- Use plural for PrintedType in VariableTypeArray
- Remove unused fields in VariableTypeArrayBuilder
- Add suggested doc comments to VariableTypeArray
- Remove unused VariableTypeInfo.TypeLength
- Fix typo of ostream in VariableTypeCollectorASTConsumer
- Fix typo
- Document Offset and Length semantics in collectVariableTypes
This commit is contained in:
Fredrik Wieczerkowski
2021-06-10 01:57:54 +02:00
parent 775bff003c
commit 2703d08877
17 changed files with 576 additions and 0 deletions

View File

@@ -177,6 +177,11 @@ UID_KEYS = [
KEY('ExpressionOffset', 'key.expression_offset'),
KEY('ExpressionLength', 'key.expression_length'),
KEY('ExpressionType', 'key.expression_type'),
KEY('VariableTypeList', 'key.variable_type_list'),
KEY('VariableOffset', 'key.variable_offset'),
KEY('VariableLength', 'key.variable_length'),
KEY('VariableType', 'key.variable_type'),
KEY('VariableTypeExplicit', 'key.variable_type_explicit'),
KEY('CanonicalizeType', 'key.canonicalize_type'),
KEY('InternalDiagnostic', 'key.internal_diagnostic'),
KEY('VFSName', 'key.vfs.name'),
@@ -251,6 +256,7 @@ UID_REQUESTS = [
'source.request.enable-compile-notifications'),
REQUEST('TestNotification', 'source.request.test_notification'),
REQUEST('CollectExpressionType', 'source.request.expression.type'),
REQUEST('CollectVariableType', 'source.request.variable.type'),
REQUEST('GlobalConfiguration', 'source.request.configuration.global'),
REQUEST('DependencyUpdated', 'source.request.dependency_updated'),
]