Don't include the ':' following code-completion suggestions for

'public', 'private', or 'protected', unless code completion patterns
are enabled. Fixes <rdar://problem/11189132>.

llvm-svn: 154413
This commit is contained in:
Douglas Gregor 2012-04-10 17:56:28 +00:00
parent df5a244797
commit 9489cdf29f
2 changed files with 15 additions and 3 deletions

View File

@ -1542,17 +1542,20 @@ static void AddOrdinaryNameResults(Sema::ParserCompletionContext CCC,
// public:
Builder.AddTypedTextChunk("public");
Builder.AddChunk(CodeCompletionString::CK_Colon);
if (Results.includeCodePatterns())
Builder.AddChunk(CodeCompletionString::CK_Colon);
Results.AddResult(Result(Builder.TakeString()));
// protected:
Builder.AddTypedTextChunk("protected");
Builder.AddChunk(CodeCompletionString::CK_Colon);
if (Results.includeCodePatterns())
Builder.AddChunk(CodeCompletionString::CK_Colon);
Results.AddResult(Result(Builder.TakeString()));
// private:
Builder.AddTypedTextChunk("private");
Builder.AddChunk(CodeCompletionString::CK_Colon);
if (Results.includeCodePatterns())
Builder.AddChunk(CodeCompletionString::CK_Colon);
Results.AddResult(Result(Builder.TakeString()));
}
}

View File

@ -31,3 +31,12 @@ void B::bar(float real) {
// RUN: c-index-test -code-completion-at=%s:16:6 %s | FileCheck -check-prefix=CHECK-FOO-QUAL %s
// CHECK-FOO-QUAL: CXXMethod:{TypedText foo}{LeftParen (}{Placeholder a}{Comma , }{Placeholder b}{RightParen )} (20)
// RUN: c-index-test -code-completion-at=%s:5:1 %s | FileCheck -check-prefix=CHECK-ACCESS %s
// CHECK-ACCESS: NotImplemented:{TypedText private} (40)
// CHECK-ACCESS: NotImplemented:{TypedText protected} (40)
// CHECK-ACCESS: NotImplemented:{TypedText public} (40)
// RUN: env CINDEXTEST_CODE_COMPLETE_PATTERNS=1 c-index-test -code-completion-at=%s:5:1 %s | FileCheck -check-prefix=CHECK-ACCESS-PATTERN %s
// CHECK-ACCESS-PATTERN: NotImplemented:{TypedText private}{Colon :} (40)
// CHECK-ACCESS-PATTERN: NotImplemented:{TypedText protected}{Colon :} (40)
// CHECK-ACCESS-PATTERN: NotImplemented:{TypedText public}{Colon :} (40)