CodeCompleteConsumer.cpp (200583) | CodeCompleteConsumer.cpp (201361) |
---|---|
1//===--- CodeCompleteConsumer.cpp - Code Completion Interface ---*- C++ -*-===// 2// 3// The LLVM Compiler Infrastructure 4// 5// This file is distributed under the University of Illinois Open Source 6// License. See LICENSE.TXT for details. 7// 8//===----------------------------------------------------------------------===// --- 23 unchanged lines hidden (view full) --- 32CodeCompletionString::Chunk::Chunk(ChunkKind Kind, llvm::StringRef Text) 33 : Kind(Kind), Text("") 34{ 35 switch (Kind) { 36 case CK_TypedText: 37 case CK_Text: 38 case CK_Placeholder: 39 case CK_Informative: | 1//===--- CodeCompleteConsumer.cpp - Code Completion Interface ---*- C++ -*-===// 2// 3// The LLVM Compiler Infrastructure 4// 5// This file is distributed under the University of Illinois Open Source 6// License. See LICENSE.TXT for details. 7// 8//===----------------------------------------------------------------------===// --- 23 unchanged lines hidden (view full) --- 32CodeCompletionString::Chunk::Chunk(ChunkKind Kind, llvm::StringRef Text) 33 : Kind(Kind), Text("") 34{ 35 switch (Kind) { 36 case CK_TypedText: 37 case CK_Text: 38 case CK_Placeholder: 39 case CK_Informative: |
40 case CK_ResultType: |
|
40 case CK_CurrentParameter: { 41 char *New = new char [Text.size() + 1]; 42 std::memcpy(New, Text.data(), Text.size()); 43 New[Text.size()] = '\0'; 44 this->Text = New; 45 break; 46 } 47 --- 59 unchanged lines hidden (view full) --- 107} 108 109CodeCompletionString::Chunk 110CodeCompletionString::Chunk::CreateInformative(StringRef Informative) { 111 return Chunk(CK_Informative, Informative); 112} 113 114CodeCompletionString::Chunk | 41 case CK_CurrentParameter: { 42 char *New = new char [Text.size() + 1]; 43 std::memcpy(New, Text.data(), Text.size()); 44 New[Text.size()] = '\0'; 45 this->Text = New; 46 break; 47 } 48 --- 59 unchanged lines hidden (view full) --- 108} 109 110CodeCompletionString::Chunk 111CodeCompletionString::Chunk::CreateInformative(StringRef Informative) { 112 return Chunk(CK_Informative, Informative); 113} 114 115CodeCompletionString::Chunk |
116CodeCompletionString::Chunk::CreateResultType(StringRef ResultType) { 117 return Chunk(CK_ResultType, ResultType); 118} 119 120CodeCompletionString::Chunk |
|
115CodeCompletionString::Chunk::CreateCurrentParameter( 116 StringRef CurrentParameter) { 117 return Chunk(CK_CurrentParameter, CurrentParameter); 118} 119 120CodeCompletionString::Chunk CodeCompletionString::Chunk::Clone() const { 121 switch (Kind) { 122 case CK_TypedText: 123 case CK_Text: 124 case CK_Placeholder: 125 case CK_Informative: | 121CodeCompletionString::Chunk::CreateCurrentParameter( 122 StringRef CurrentParameter) { 123 return Chunk(CK_CurrentParameter, CurrentParameter); 124} 125 126CodeCompletionString::Chunk CodeCompletionString::Chunk::Clone() const { 127 switch (Kind) { 128 case CK_TypedText: 129 case CK_Text: 130 case CK_Placeholder: 131 case CK_Informative: |
132 case CK_ResultType: |
|
126 case CK_CurrentParameter: 127 case CK_LeftParen: 128 case CK_RightParen: 129 case CK_LeftBracket: 130 case CK_RightBracket: 131 case CK_LeftBrace: 132 case CK_RightBrace: 133 case CK_LeftAngle: --- 17 unchanged lines hidden (view full) --- 151 case CK_Optional: 152 delete Optional; 153 break; 154 155 case CK_TypedText: 156 case CK_Text: 157 case CK_Placeholder: 158 case CK_Informative: | 133 case CK_CurrentParameter: 134 case CK_LeftParen: 135 case CK_RightParen: 136 case CK_LeftBracket: 137 case CK_RightBracket: 138 case CK_LeftBrace: 139 case CK_RightBrace: 140 case CK_LeftAngle: --- 17 unchanged lines hidden (view full) --- 158 case CK_Optional: 159 delete Optional; 160 break; 161 162 case CK_TypedText: 163 case CK_Text: 164 case CK_Placeholder: 165 case CK_Informative: |
166 case CK_ResultType: |
|
159 case CK_CurrentParameter: 160 delete [] Text; 161 break; 162 163 case CK_LeftParen: 164 case CK_RightParen: 165 case CK_LeftBracket: 166 case CK_RightBracket: --- 14 unchanged lines hidden (view full) --- 181std::string CodeCompletionString::getAsString() const { 182 std::string Result; 183 llvm::raw_string_ostream OS(Result); 184 185 for (iterator C = begin(), CEnd = end(); C != CEnd; ++C) { 186 switch (C->Kind) { 187 case CK_Optional: OS << "{#" << C->Optional->getAsString() << "#}"; break; 188 case CK_Placeholder: OS << "<#" << C->Text << "#>"; break; | 167 case CK_CurrentParameter: 168 delete [] Text; 169 break; 170 171 case CK_LeftParen: 172 case CK_RightParen: 173 case CK_LeftBracket: 174 case CK_RightBracket: --- 14 unchanged lines hidden (view full) --- 189std::string CodeCompletionString::getAsString() const { 190 std::string Result; 191 llvm::raw_string_ostream OS(Result); 192 193 for (iterator C = begin(), CEnd = end(); C != CEnd; ++C) { 194 switch (C->Kind) { 195 case CK_Optional: OS << "{#" << C->Optional->getAsString() << "#}"; break; 196 case CK_Placeholder: OS << "<#" << C->Text << "#>"; break; |
189 case CK_Informative: OS << "[#" << C->Text << "#]"; break; | 197 198 case CK_Informative: 199 case CK_ResultType: 200 OS << "[#" << C->Text << "#]"; 201 break; 202 |
190 case CK_CurrentParameter: OS << "<#" << C->Text << "#>"; break; 191 default: OS << C->Text; break; 192 } 193 } 194 OS.flush(); 195 return Result; 196} 197 --- 33 unchanged lines hidden (view full) --- 231 for (iterator C = begin(), CEnd = end(); C != CEnd; ++C) { 232 WriteUnsigned(OS, C->Kind); 233 234 switch (C->Kind) { 235 case CK_TypedText: 236 case CK_Text: 237 case CK_Placeholder: 238 case CK_Informative: | 203 case CK_CurrentParameter: OS << "<#" << C->Text << "#>"; break; 204 default: OS << C->Text; break; 205 } 206 } 207 OS.flush(); 208 return Result; 209} 210 --- 33 unchanged lines hidden (view full) --- 244 for (iterator C = begin(), CEnd = end(); C != CEnd; ++C) { 245 WriteUnsigned(OS, C->Kind); 246 247 switch (C->Kind) { 248 case CK_TypedText: 249 case CK_Text: 250 case CK_Placeholder: 251 case CK_Informative: |
252 case CK_ResultType: |
|
239 case CK_CurrentParameter: { 240 const char *Text = C->Text; 241 unsigned StrLen = strlen(Text); 242 WriteUnsigned(OS, StrLen); 243 OS.write(Text, StrLen); 244 break; 245 } 246 --- 34 unchanged lines hidden (view full) --- 281 if (ReadUnsigned(Str, StrEnd, KindValue)) 282 return Result; 283 284 switch (ChunkKind Kind = (ChunkKind)KindValue) { 285 case CK_TypedText: 286 case CK_Text: 287 case CK_Placeholder: 288 case CK_Informative: | 253 case CK_CurrentParameter: { 254 const char *Text = C->Text; 255 unsigned StrLen = strlen(Text); 256 WriteUnsigned(OS, StrLen); 257 OS.write(Text, StrLen); 258 break; 259 } 260 --- 34 unchanged lines hidden (view full) --- 295 if (ReadUnsigned(Str, StrEnd, KindValue)) 296 return Result; 297 298 switch (ChunkKind Kind = (ChunkKind)KindValue) { 299 case CK_TypedText: 300 case CK_Text: 301 case CK_Placeholder: 302 case CK_Informative: |
303 case CK_ResultType: |
|
289 case CK_CurrentParameter: { 290 unsigned StrLen; 291 if (ReadUnsigned(Str, StrEnd, StrLen) || (Str + StrLen > StrEnd)) 292 return Result; 293 294 Result->AddChunk(Chunk(Kind, StringRef(Str, StrLen))); 295 Str += StrLen; 296 break; --- 275 unchanged lines hidden --- | 304 case CK_CurrentParameter: { 305 unsigned StrLen; 306 if (ReadUnsigned(Str, StrEnd, StrLen) || (Str + StrLen > StrEnd)) 307 return Result; 308 309 Result->AddChunk(Chunk(Kind, StringRef(Str, StrLen))); 310 Str += StrLen; 311 break; --- 275 unchanged lines hidden --- |