]> granicus.if.org Git - clang/commitdiff
Don't include the ':' following code-completion suggestions for
authorDouglas Gregor <dgregor@apple.com>
Tue, 10 Apr 2012 17:56:28 +0000 (17:56 +0000)
committerDouglas Gregor <dgregor@apple.com>
Tue, 10 Apr 2012 17:56:28 +0000 (17:56 +0000)
'public', 'private', or 'protected', unless code completion patterns
are enabled. Fixes <rdar://problem/11189132>.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154413 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/SemaCodeComplete.cpp
test/Index/complete-super.cpp

index 32f36d455965a405fd41e356abd9768c25033c70..2a8a716624606932a15f0ed81f00f518ad31492b 100644 (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()));
       }
     }
index 71c22ad00d1e1b70e9de4e96288ac82b83ad6d84..9ffa7c8a40563c89d951b30726231e312b98db30 100644 (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)