Add code completions for C++0x expressions

llvm-svn: 142357
This commit is contained in:
Douglas Gregor
2011-10-18 16:29:03 +00:00
parent e4454e0de2
commit 4205feffcd
2 changed files with 33 additions and 3 deletions

View File

@@ -1811,8 +1811,35 @@ static void AddOrdinaryNameResults(Sema::ParserCompletionContext CCC,
Builder.AddPlaceholderChunk("expression");
Results.AddResult(Result(Builder.TakeString()));
}
// FIXME: Rethrow?
if (SemaRef.getLangOptions().CPlusPlus0x) {
// nullptr
Builder.AddTypedTextChunk("nullptr");
Results.AddResult(Result(Builder.TakeString()));
// alignof
Builder.AddTypedTextChunk("alignof");
Builder.AddChunk(CodeCompletionString::CK_LeftParen);
Builder.AddPlaceholderChunk("type");
Builder.AddChunk(CodeCompletionString::CK_RightParen);
Results.AddResult(Result(Builder.TakeString()));
// noexcept
Builder.AddTypedTextChunk("noexcept");
Builder.AddChunk(CodeCompletionString::CK_LeftParen);
Builder.AddPlaceholderChunk("expression");
Builder.AddChunk(CodeCompletionString::CK_RightParen);
Results.AddResult(Result(Builder.TakeString()));
// sizeof... expression
Builder.AddTypedTextChunk("sizeof...");
Builder.AddChunk(CodeCompletionString::CK_LeftParen);
Builder.AddPlaceholderChunk("parameter-pack");
Builder.AddChunk(CodeCompletionString::CK_RightParen);
Results.AddResult(Result(Builder.TakeString()));
}
}
if (SemaRef.getLangOptions().ObjC1) {

View File

@@ -26,8 +26,11 @@ void g() {
vector<int>(foo(), foo());
}
// RUN: c-index-test -code-completion-at=%s:20:2 %s | FileCheck -check-prefix=CHECK-CC1 %s
// RUN: env CINDEXTEST_EDITING=1 CINDEXTEST_COMPLETION_CACHING=1 c-index-test -code-completion-at=%s:20:2 %s | FileCheck -check-prefix=CHECK-CC1 %s
// RUN: c-index-test -code-completion-at=%s:20:2 %s -std=c++0x | FileCheck -check-prefix=CHECK-CC1 %s
// RUN: env CINDEXTEST_EDITING=1 CINDEXTEST_COMPLETION_CACHING=1 c-index-test -code-completion-at=%s:20:2 -std=c++0x %s | FileCheck -check-prefix=CHECK-CC1 %s
// CHECK-CC1: NotImplemented:{TypedText alignof}{LeftParen (}{Placeholder type}{RightParen )} (40)
// CHECK-CC1: NotImplemented:{TypedText noexcept}{LeftParen (}{Placeholder expression}{RightParen )} (40)
// CHECK-CC1: NotImplemented:{TypedText nullptr} (40)
// CHECK-CC1: NotImplemented:{TypedText operator} (40)
// CHECK-CC1-NOT: push_back
// CHECK-CC1: ClassDecl:{TypedText string} (50)