Use horizontal-space markers in code-completion results rather than
embedding single space characters. <rdar://problem/7485503>
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93231 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/SemaCodeComplete.cpp b/lib/Sema/SemaCodeComplete.cpp
index 582b369..d54e4c0 100644
--- a/lib/Sema/SemaCodeComplete.cpp
+++ b/lib/Sema/SemaCodeComplete.cpp
@@ -1677,7 +1677,7 @@
if (Idx > 0) {
std::string Keyword;
if (Idx > StartParameter)
- Keyword = " ";
+ Result->AddChunk(CodeCompletionString::CK_HorizontalSpace);
if (IdentifierInfo *II = Sel.getIdentifierInfoForSlot(Idx))
Keyword += II->getName().str();
Keyword += ":";
@@ -2462,14 +2462,14 @@
// @dynamic
Pattern = new CodeCompletionString;
Pattern->AddTypedTextChunk("dynamic");
- Pattern->AddTextChunk(" ");
+ Pattern->AddChunk(CodeCompletionString::CK_HorizontalSpace);
Pattern->AddPlaceholderChunk("property");
Results.MaybeAddResult(Result(Pattern, 0));
// @synthesize
Pattern = new CodeCompletionString;
Pattern->AddTypedTextChunk("synthesize");
- Pattern->AddTextChunk(" ");
+ Pattern->AddChunk(CodeCompletionString::CK_HorizontalSpace);
Pattern->AddPlaceholderChunk("property");
Results.MaybeAddResult(Result(Pattern, 0));
}
@@ -2493,9 +2493,9 @@
// @class name ;
Pattern = new CodeCompletionString;
Pattern->AddTypedTextChunk("class");
- Pattern->AddTextChunk(" ");
+ Pattern->AddChunk(CodeCompletionString::CK_HorizontalSpace);
Pattern->AddPlaceholderChunk("identifier");
- Pattern->AddTextChunk(";"); // add ';' chunk
+ Pattern->AddChunk(CodeCompletionString::CK_SemiColon);
Results.MaybeAddResult(Result(Pattern, 0));
// @interface name
@@ -2503,30 +2503,35 @@
// such.
Pattern = new CodeCompletionString;
Pattern->AddTypedTextChunk("interface");
- Pattern->AddTextChunk(" ");
+ Pattern->AddChunk(CodeCompletionString::CK_HorizontalSpace);
+
Pattern->AddPlaceholderChunk("class");
Results.MaybeAddResult(Result(Pattern, 0));
// @protocol name
Pattern = new CodeCompletionString;
Pattern->AddTypedTextChunk("protocol");
- Pattern->AddTextChunk(" ");
+ Pattern->AddChunk(CodeCompletionString::CK_HorizontalSpace);
+
Pattern->AddPlaceholderChunk("protocol");
Results.MaybeAddResult(Result(Pattern, 0));
// @implementation name
Pattern = new CodeCompletionString;
Pattern->AddTypedTextChunk("implementation");
- Pattern->AddTextChunk(" ");
+ Pattern->AddChunk(CodeCompletionString::CK_HorizontalSpace);
+
Pattern->AddPlaceholderChunk("class");
Results.MaybeAddResult(Result(Pattern, 0));
// @compatibility_alias name
Pattern = new CodeCompletionString;
Pattern->AddTypedTextChunk("compatibility_alias");
- Pattern->AddTextChunk(" ");
+ Pattern->AddChunk(CodeCompletionString::CK_HorizontalSpace);
+
Pattern->AddPlaceholderChunk("alias");
- Pattern->AddTextChunk(" ");
+ Pattern->AddChunk(CodeCompletionString::CK_HorizontalSpace);
+
Pattern->AddPlaceholderChunk("class");
Results.MaybeAddResult(Result(Pattern, 0));
}
@@ -2593,15 +2598,17 @@
// @throw
Pattern = new CodeCompletionString;
Pattern->AddTypedTextChunk("throw");
- Pattern->AddTextChunk(" ");
+ Pattern->AddChunk(CodeCompletionString::CK_HorizontalSpace);
+
Pattern->AddPlaceholderChunk("expression");
- Pattern->AddTextChunk(";");
- Results.MaybeAddResult(Result(Pattern, 0)); // FIXME: add ';' chunk
+ Pattern->AddChunk(CodeCompletionString::CK_SemiColon);
+ Results.MaybeAddResult(Result(Pattern, 0));
// @synchronized ( expression ) { statements }
Pattern = new CodeCompletionString;
Pattern->AddTypedTextChunk("synchronized");
- Pattern->AddTextChunk(" ");
+ Pattern->AddChunk(CodeCompletionString::CK_HorizontalSpace);
+
Pattern->AddChunk(CodeCompletionString::CK_LeftParen);
Pattern->AddPlaceholderChunk("expression");
Pattern->AddChunk(CodeCompletionString::CK_RightParen);