From f7f6f823a4d71e7febbeaf1db4fccbb5a83005d3 Mon Sep 17 00:00:00 2001 From: Alex Lorenz Date: Tue, 9 May 2017 16:05:04 +0000 Subject: [CodeCompletion] Complete platform names in @available expressions rdar://32074504 llvm-svn: 302545 --- clang/lib/Sema/SemaCodeComplete.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'clang/lib/Sema/SemaCodeComplete.cpp') diff --git a/clang/lib/Sema/SemaCodeComplete.cpp b/clang/lib/Sema/SemaCodeComplete.cpp index cfac3f1dc1d..dba916e0b99 100644 --- a/clang/lib/Sema/SemaCodeComplete.cpp +++ b/clang/lib/Sema/SemaCodeComplete.cpp @@ -7811,6 +7811,23 @@ void Sema::CodeCompleteNaturalLanguage() { nullptr, 0); } +void Sema::CodeCompleteAvailabilityPlatformName() { + ResultBuilder Results(*this, CodeCompleter->getAllocator(), + CodeCompleter->getCodeCompletionTUInfo(), + CodeCompletionContext::CCC_Other); + Results.EnterNewScope(); + static const char *Platforms[] = {"macOS", "iOS", "watchOS", "tvOS"}; + for (const char *Platform : llvm::makeArrayRef(Platforms)) { + Results.AddResult(CodeCompletionResult(Platform)); + Results.AddResult(CodeCompletionResult(Results.getAllocator().CopyString( + Twine(Platform) + "ApplicationExtension"))); + } + Results.ExitScope(); + HandleCodeCompleteResults(this, CodeCompleter, + CodeCompletionContext::CCC_Other, Results.data(), + Results.size()); +} + void Sema::GatherGlobalCodeCompletions(CodeCompletionAllocator &Allocator, CodeCompletionTUInfo &CCTUInfo, SmallVectorImpl &Results) { -- cgit v1.2.3