Add code completion for @import <rdar://problem/13344306>.
authorDouglas Gregor <dgregor@apple.com>
Thu, 7 Mar 2013 23:26:24 +0000 (23:26 +0000)
committerDouglas Gregor <dgregor@apple.com>
Thu, 7 Mar 2013 23:26:24 +0000 (23:26 +0000)
llvm-svn: 176666

clang/lib/Sema/SemaCodeComplete.cpp
clang/test/Index/complete-modules.m

index e20330b..e485b35 100644 (file)
@@ -4477,6 +4477,14 @@ static void AddObjCTopLevelResults(ResultBuilder &Results, bool NeedAt) {
   Builder.AddChunk(CodeCompletionString::CK_HorizontalSpace);
   Builder.AddPlaceholderChunk("class");
   Results.AddResult(Result(Builder.TakeString()));
+
+  if (Results.getSema().getLangOpts().Modules) {
+    // @import name
+    Builder.AddTypedTextChunk(OBJC_AT_KEYWORD_NAME(NeedAt, "import"));
+    Builder.AddChunk(CodeCompletionString::CK_HorizontalSpace);
+    Builder.AddPlaceholderChunk("module");
+    Results.AddResult(Result(Builder.TakeString()));
+  }
 }
 
 void Sema::CodeCompleteObjCAtDirective(Scope *S) {
index d1cf127..d63c4b8 100644 (file)
@@ -12,3 +12,6 @@
 // RUN: c-index-test -code-completion-at=%s:4:14 -fmodules-cache-path=%t -fmodules -F %S/Inputs/Frameworks -I %S/Inputs/Headers %s | FileCheck -check-prefix=CHECK-LIBA %s
 // CHECK-LIBA: NotImplemented:{TypedText Extensions} (50)
 
+// RUN: c-index-test -code-completion-at=%s:4:1 -fmodules-cache-path=%t -fmodules -F %S/Inputs/Frameworks -I %S/Inputs/Headers %s | FileCheck -check-prefix=CHECK-TOP %s
+// CHECK-TOP: NotImplemented:{TypedText @import}{HorizontalSpace  }{Placeholder module} (40)
+