clang  13.0.0git
CodeCompleteConsumer.cpp
Go to the documentation of this file.
1 //===- CodeCompleteConsumer.cpp - Code Completion Interface ---------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // This file implements the CodeCompleteConsumer class.
10 //
11 //===----------------------------------------------------------------------===//
12 
14 #include "clang-c/Index.h"
15 #include "clang/AST/Decl.h"
16 #include "clang/AST/DeclBase.h"
17 #include "clang/AST/DeclObjC.h"
18 #include "clang/AST/DeclTemplate.h"
20 #include "clang/AST/Type.h"
22 #include "clang/Lex/Preprocessor.h"
23 #include "clang/Sema/Sema.h"
24 #include "llvm/ADT/SmallString.h"
25 #include "llvm/ADT/SmallVector.h"
26 #include "llvm/ADT/StringExtras.h"
27 #include "llvm/ADT/StringRef.h"
28 #include "llvm/ADT/Twine.h"
29 #include "llvm/Support/Casting.h"
30 #include "llvm/Support/Compiler.h"
31 #include "llvm/Support/ErrorHandling.h"
32 #include "llvm/Support/FormatVariadic.h"
33 #include "llvm/Support/raw_ostream.h"
34 #include <algorithm>
35 #include <cassert>
36 #include <cstdint>
37 #include <string>
38 
39 using namespace clang;
40 
41 //===----------------------------------------------------------------------===//
42 // Code completion context implementation
43 //===----------------------------------------------------------------------===//
44 
46  switch (CCKind) {
47  case CCC_Recovery:
48  case CCC_Statement:
49  case CCC_Expression:
52  case CCC_Symbol:
54  return true;
55 
56  case CCC_TopLevel:
57  case CCC_ObjCInterface:
59  case CCC_ObjCIvarList:
64  case CCC_EnumTag:
65  case CCC_UnionTag:
68  case CCC_Namespace:
69  case CCC_Type:
70  case CCC_NewName:
71  case CCC_MacroName:
72  case CCC_MacroNameUse:
76  case CCC_SelectorName:
77  case CCC_TypeQualifiers:
78  case CCC_Other:
84  case CCC_IncludedFile:
85  return false;
86  }
87 
88  llvm_unreachable("Invalid CodeCompletionContext::Kind!");
89 }
90 
92  using CCKind = CodeCompletionContext::Kind;
93  switch (Kind) {
94  case CCKind::CCC_Other:
95  return "Other";
96  case CCKind::CCC_OtherWithMacros:
97  return "OtherWithMacros";
98  case CCKind::CCC_TopLevel:
99  return "TopLevel";
100  case CCKind::CCC_ObjCInterface:
101  return "ObjCInterface";
102  case CCKind::CCC_ObjCImplementation:
103  return "ObjCImplementation";
104  case CCKind::CCC_ObjCIvarList:
105  return "ObjCIvarList";
106  case CCKind::CCC_ClassStructUnion:
107  return "ClassStructUnion";
108  case CCKind::CCC_Statement:
109  return "Statement";
110  case CCKind::CCC_Expression:
111  return "Expression";
112  case CCKind::CCC_ObjCMessageReceiver:
113  return "ObjCMessageReceiver";
114  case CCKind::CCC_DotMemberAccess:
115  return "DotMemberAccess";
116  case CCKind::CCC_ArrowMemberAccess:
117  return "ArrowMemberAccess";
118  case CCKind::CCC_ObjCPropertyAccess:
119  return "ObjCPropertyAccess";
120  case CCKind::CCC_EnumTag:
121  return "EnumTag";
122  case CCKind::CCC_UnionTag:
123  return "UnionTag";
124  case CCKind::CCC_ClassOrStructTag:
125  return "ClassOrStructTag";
126  case CCKind::CCC_ObjCProtocolName:
127  return "ObjCProtocolName";
128  case CCKind::CCC_Namespace:
129  return "Namespace";
130  case CCKind::CCC_Type:
131  return "Type";
132  case CCKind::CCC_NewName:
133  return "NewName";
134  case CCKind::CCC_Symbol:
135  return "Symbol";
136  case CCKind::CCC_SymbolOrNewName:
137  return "SymbolOrNewName";
138  case CCKind::CCC_MacroName:
139  return "MacroName";
140  case CCKind::CCC_MacroNameUse:
141  return "MacroNameUse";
142  case CCKind::CCC_PreprocessorExpression:
143  return "PreprocessorExpression";
144  case CCKind::CCC_PreprocessorDirective:
145  return "PreprocessorDirective";
146  case CCKind::CCC_NaturalLanguage:
147  return "NaturalLanguage";
148  case CCKind::CCC_SelectorName:
149  return "SelectorName";
150  case CCKind::CCC_TypeQualifiers:
151  return "TypeQualifiers";
152  case CCKind::CCC_ParenthesizedExpression:
153  return "ParenthesizedExpression";
154  case CCKind::CCC_ObjCInstanceMessage:
155  return "ObjCInstanceMessage";
156  case CCKind::CCC_ObjCClassMessage:
157  return "ObjCClassMessage";
158  case CCKind::CCC_ObjCInterfaceName:
159  return "ObjCInterfaceName";
160  case CCKind::CCC_ObjCCategoryName:
161  return "ObjCCategoryName";
162  case CCKind::CCC_IncludedFile:
163  return "IncludedFile";
164  case CCKind::CCC_Recovery:
165  return "Recovery";
166  }
167  llvm_unreachable("Invalid CodeCompletionContext::Kind!");
168 }
169 
170 //===----------------------------------------------------------------------===//
171 // Code completion string implementation
172 //===----------------------------------------------------------------------===//
173 
175  : Kind(Kind), Text("") {
176  switch (Kind) {
177  case CK_TypedText:
178  case CK_Text:
179  case CK_Placeholder:
180  case CK_Informative:
181  case CK_ResultType:
182  case CK_CurrentParameter:
183  this->Text = Text;
184  break;
185 
186  case CK_Optional:
187  llvm_unreachable("Optional strings cannot be created from text");
188 
189  case CK_LeftParen:
190  this->Text = "(";
191  break;
192 
193  case CK_RightParen:
194  this->Text = ")";
195  break;
196 
197  case CK_LeftBracket:
198  this->Text = "[";
199  break;
200 
201  case CK_RightBracket:
202  this->Text = "]";
203  break;
204 
205  case CK_LeftBrace:
206  this->Text = "{";
207  break;
208 
209  case CK_RightBrace:
210  this->Text = "}";
211  break;
212 
213  case CK_LeftAngle:
214  this->Text = "<";
215  break;
216 
217  case CK_RightAngle:
218  this->Text = ">";
219  break;
220 
221  case CK_Comma:
222  this->Text = ", ";
223  break;
224 
225  case CK_Colon:
226  this->Text = ":";
227  break;
228 
229  case CK_SemiColon:
230  this->Text = ";";
231  break;
232 
233  case CK_Equal:
234  this->Text = " = ";
235  break;
236 
237  case CK_HorizontalSpace:
238  this->Text = " ";
239  break;
240 
241  case CK_VerticalSpace:
242  this->Text = "\n";
243  break;
244  }
245 }
246 
249  return Chunk(CK_Text, Text);
250 }
251 
254  Chunk Result;
255  Result.Kind = CK_Optional;
256  Result.Optional = Optional;
257  return Result;
258 }
259 
262  return Chunk(CK_Placeholder, Placeholder);
263 }
264 
267  return Chunk(CK_Informative, Informative);
268 }
269 
272  return Chunk(CK_ResultType, ResultType);
273 }
274 
276  const char *CurrentParameter) {
277  return Chunk(CK_CurrentParameter, CurrentParameter);
278 }
279 
280 CodeCompletionString::CodeCompletionString(
281  const Chunk *Chunks, unsigned NumChunks, unsigned Priority,
282  CXAvailabilityKind Availability, const char **Annotations,
283  unsigned NumAnnotations, StringRef ParentName, const char *BriefComment)
284  : NumChunks(NumChunks), NumAnnotations(NumAnnotations), Priority(Priority),
285  Availability(Availability), ParentName(ParentName),
286  BriefComment(BriefComment) {
287  assert(NumChunks <= 0xffff);
288  assert(NumAnnotations <= 0xffff);
289 
290  Chunk *StoredChunks = reinterpret_cast<Chunk *>(this + 1);
291  for (unsigned I = 0; I != NumChunks; ++I)
292  StoredChunks[I] = Chunks[I];
293 
294  const char **StoredAnnotations =
295  reinterpret_cast<const char **>(StoredChunks + NumChunks);
296  for (unsigned I = 0; I != NumAnnotations; ++I)
297  StoredAnnotations[I] = Annotations[I];
298 }
299 
301  return NumAnnotations;
302 }
303 
304 const char *CodeCompletionString::getAnnotation(unsigned AnnotationNr) const {
305  if (AnnotationNr < NumAnnotations)
306  return reinterpret_cast<const char *const *>(end())[AnnotationNr];
307  else
308  return nullptr;
309 }
310 
312  std::string Result;
313  llvm::raw_string_ostream OS(Result);
314 
315  for (const Chunk &C : *this) {
316  switch (C.Kind) {
317  case CK_Optional:
318  OS << "{#" << C.Optional->getAsString() << "#}";
319  break;
320  case CK_Placeholder:
321  OS << "<#" << C.Text << "#>";
322  break;
323  case CK_Informative:
324  case CK_ResultType:
325  OS << "[#" << C.Text << "#]";
326  break;
327  case CK_CurrentParameter:
328  OS << "<#" << C.Text << "#>";
329  break;
330  default:
331  OS << C.Text;
332  break;
333  }
334  }
335  return OS.str();
336 }
337 
339  for (const Chunk &C : *this)
340  if (C.Kind == CK_TypedText)
341  return C.Text;
342 
343  return nullptr;
344 }
345 
346 const char *CodeCompletionAllocator::CopyString(const Twine &String) {
347  SmallString<128> Data;
348  StringRef Ref = String.toStringRef(Data);
349  // FIXME: It would be more efficient to teach Twine to tell us its size and
350  // then add a routine there to fill in an allocated char* with the contents
351  // of the string.
352  char *Mem = (char *)Allocate(Ref.size() + 1, 1);
353  std::copy(Ref.begin(), Ref.end(), Mem);
354  Mem[Ref.size()] = 0;
355  return Mem;
356 }
357 
359  if (!isa<NamedDecl>(DC))
360  return {};
361 
362  // Check whether we've already cached the parent name.
363  StringRef &CachedParentName = ParentNames[DC];
364  if (!CachedParentName.empty())
365  return CachedParentName;
366 
367  // If we already processed this DeclContext and assigned empty to it, the
368  // data pointer will be non-null.
369  if (CachedParentName.data() != nullptr)
370  return {};
371 
372  // Find the interesting names.
374  while (DC && !DC->isFunctionOrMethod()) {
375  if (const auto *ND = dyn_cast<NamedDecl>(DC)) {
376  if (ND->getIdentifier())
377  Contexts.push_back(DC);
378  }
379 
380  DC = DC->getParent();
381  }
382 
383  {
385  llvm::raw_svector_ostream OS(S);
386  bool First = true;
387  for (unsigned I = Contexts.size(); I != 0; --I) {
388  if (First)
389  First = false;
390  else {
391  OS << "::";
392  }
393 
394  const DeclContext *CurDC = Contexts[I - 1];
395  if (const auto *CatImpl = dyn_cast<ObjCCategoryImplDecl>(CurDC))
396  CurDC = CatImpl->getCategoryDecl();
397 
398  if (const auto *Cat = dyn_cast<ObjCCategoryDecl>(CurDC)) {
399  const ObjCInterfaceDecl *Interface = Cat->getClassInterface();
400  if (!Interface) {
401  // Assign an empty StringRef but with non-null data to distinguish
402  // between empty because we didn't process the DeclContext yet.
403  CachedParentName = StringRef((const char *)(uintptr_t)~0U, 0);
404  return {};
405  }
406 
407  OS << Interface->getName() << '(' << Cat->getName() << ')';
408  } else {
409  OS << cast<NamedDecl>(CurDC)->getName();
410  }
411  }
412 
413  CachedParentName = AllocatorRef->CopyString(OS.str());
414  }
415 
416  return CachedParentName;
417 }
418 
420  void *Mem = getAllocator().Allocate(
421  sizeof(CodeCompletionString) + sizeof(Chunk) * Chunks.size() +
422  sizeof(const char *) * Annotations.size(),
423  alignof(CodeCompletionString));
424  CodeCompletionString *Result = new (Mem) CodeCompletionString(
425  Chunks.data(), Chunks.size(), Priority, Availability, Annotations.data(),
426  Annotations.size(), ParentName, BriefComment);
427  Chunks.clear();
428  return Result;
429 }
430 
432  Chunks.push_back(Chunk(CodeCompletionString::CK_TypedText, Text));
433 }
434 
436  Chunks.push_back(Chunk::CreateText(Text));
437 }
438 
440  Chunks.push_back(Chunk::CreateOptional(Optional));
441 }
442 
443 void CodeCompletionBuilder::AddPlaceholderChunk(const char *Placeholder) {
444  Chunks.push_back(Chunk::CreatePlaceholder(Placeholder));
445 }
446 
448  Chunks.push_back(Chunk::CreateInformative(Text));
449 }
450 
451 void CodeCompletionBuilder::AddResultTypeChunk(const char *ResultType) {
452  Chunks.push_back(Chunk::CreateResultType(ResultType));
453 }
454 
456  const char *CurrentParameter) {
457  Chunks.push_back(Chunk::CreateCurrentParameter(CurrentParameter));
458 }
459 
461  const char *Text) {
462  Chunks.push_back(Chunk(CK, Text));
463 }
464 
466  if (DC->isTranslationUnit())
467  return;
468 
469  if (DC->isFunctionOrMethod())
470  return;
471 
472  if (!isa<NamedDecl>(DC))
473  return;
474 
475  ParentName = getCodeCompletionTUInfo().getParentName(DC);
476 }
477 
478 void CodeCompletionBuilder::addBriefComment(StringRef Comment) {
479  BriefComment = Allocator.CopyString(Comment);
480 }
481 
482 //===----------------------------------------------------------------------===//
483 // Code completion overload candidate implementation
484 //===----------------------------------------------------------------------===//
486  if (getKind() == CK_Function)
487  return Function;
488  else if (getKind() == CK_FunctionTemplate)
489  return FunctionTemplate->getTemplatedDecl();
490  else
491  return nullptr;
492 }
493 
494 const FunctionType *
496  switch (Kind) {
497  case CK_Function:
498  return Function->getType()->getAs<FunctionType>();
499 
500  case CK_FunctionTemplate:
501  return FunctionTemplate->getTemplatedDecl()
502  ->getType()
503  ->getAs<FunctionType>();
504 
505  case CK_FunctionType:
506  return Type;
507  }
508 
509  llvm_unreachable("Invalid CandidateKind!");
510 }
511 
512 //===----------------------------------------------------------------------===//
513 // Code completion consumer implementation
514 //===----------------------------------------------------------------------===//
515 
517 
519  StringRef Filter, CodeCompletionResult Result) {
520  switch (Result.Kind) {
522  return !(Result.Declaration->getIdentifier() &&
523  Result.Declaration->getIdentifier()->getName().startswith(Filter));
525  return !StringRef(Result.Keyword).startswith(Filter);
527  return !Result.Macro->getName().startswith(Filter);
529  return !(Result.Pattern->getTypedText() &&
530  StringRef(Result.Pattern->getTypedText()).startswith(Filter));
531  }
532  llvm_unreachable("Unknown code completion result Kind.");
533 }
534 
536  Sema &SemaRef, CodeCompletionContext Context, CodeCompletionResult *Results,
537  unsigned NumResults) {
538  std::stable_sort(Results, Results + NumResults);
539 
540  if (!Context.getPreferredType().isNull())
541  OS << "PREFERRED-TYPE: " << Context.getPreferredType().getAsString()
542  << "\n";
543 
544  StringRef Filter = SemaRef.getPreprocessor().getCodeCompletionFilter();
545  // Print the completions.
546  for (unsigned I = 0; I != NumResults; ++I) {
547  if (!Filter.empty() && isResultFilteredOut(Filter, Results[I]))
548  continue;
549  OS << "COMPLETION: ";
550  switch (Results[I].Kind) {
552  OS << *Results[I].Declaration;
553  {
554  std::vector<std::string> Tags;
555  if (Results[I].Hidden)
556  Tags.push_back("Hidden");
557  if (Results[I].InBaseClass)
558  Tags.push_back("InBase");
559  if (Results[I].Availability ==
561  Tags.push_back("Inaccessible");
562  if (!Tags.empty())
563  OS << " (" << llvm::join(Tags, ",") << ")";
564  }
565  if (CodeCompletionString *CCS = Results[I].CreateCodeCompletionString(
566  SemaRef, Context, getAllocator(), CCTUInfo,
567  includeBriefComments())) {
568  OS << " : " << CCS->getAsString();
569  if (const char *BriefComment = CCS->getBriefComment())
570  OS << " : " << BriefComment;
571  }
572  break;
573 
575  OS << Results[I].Keyword;
576  break;
577 
579  OS << Results[I].Macro->getName();
580  if (CodeCompletionString *CCS = Results[I].CreateCodeCompletionString(
581  SemaRef, Context, getAllocator(), CCTUInfo,
582  includeBriefComments())) {
583  OS << " : " << CCS->getAsString();
584  }
585  break;
586 
588  OS << "Pattern : " << Results[I].Pattern->getAsString();
589  break;
590  }
591  for (const FixItHint &FixIt : Results[I].FixIts) {
592  const SourceLocation BLoc = FixIt.RemoveRange.getBegin();
593  const SourceLocation ELoc = FixIt.RemoveRange.getEnd();
594 
595  SourceManager &SM = SemaRef.SourceMgr;
596  std::pair<FileID, unsigned> BInfo = SM.getDecomposedLoc(BLoc);
597  std::pair<FileID, unsigned> EInfo = SM.getDecomposedLoc(ELoc);
598  // Adjust for token ranges.
599  if (FixIt.RemoveRange.isTokenRange())
600  EInfo.second += Lexer::MeasureTokenLength(ELoc, SM, SemaRef.LangOpts);
601 
602  OS << " (requires fix-it:"
603  << " {" << SM.getLineNumber(BInfo.first, BInfo.second) << ':'
604  << SM.getColumnNumber(BInfo.first, BInfo.second) << '-'
605  << SM.getLineNumber(EInfo.first, EInfo.second) << ':'
606  << SM.getColumnNumber(EInfo.first, EInfo.second) << "}"
607  << " to \"" << FixIt.CodeToInsert << "\")";
608  }
609  OS << '\n';
610  }
611 }
612 
613 // This function is used solely to preserve the former presentation of overloads
614 // by "clang -cc1 -code-completion-at", since CodeCompletionString::getAsString
615 // needs to be improved for printing the newer and more detailed overload
616 // chunks.
618  std::string Result;
619  llvm::raw_string_ostream OS(Result);
620 
621  for (auto &C : CCS) {
622  switch (C.Kind) {
625  OS << "[#" << C.Text << "#]";
626  break;
627 
629  OS << "<#" << C.Text << "#>";
630  break;
631 
632  // FIXME: We can also print optional parameters of an overload.
634  break;
635 
636  default:
637  OS << C.Text;
638  break;
639  }
640  }
641  return OS.str();
642 }
643 
645  Sema &SemaRef, unsigned CurrentArg, OverloadCandidate *Candidates,
646  unsigned NumCandidates, SourceLocation OpenParLoc) {
647  OS << "OPENING_PAREN_LOC: ";
648  OpenParLoc.print(OS, SemaRef.getSourceManager());
649  OS << "\n";
650 
651  for (unsigned I = 0; I != NumCandidates; ++I) {
652  if (CodeCompletionString *CCS = Candidates[I].CreateSignatureString(
653  CurrentArg, SemaRef, getAllocator(), CCTUInfo,
654  includeBriefComments())) {
655  OS << "OVERLOAD: " << getOverloadAsString(*CCS) << "\n";
656  }
657  }
658 }
659 
660 /// Retrieve the effective availability of the given declaration.
663  if (isa<EnumConstantDecl>(D))
664  AR = std::max(AR, cast<Decl>(D->getDeclContext())->getAvailability());
665  return AR;
666 }
667 
668 void CodeCompletionResult::computeCursorKindAndAvailability(bool Accessible) {
669  switch (Kind) {
670  case RK_Pattern:
671  if (!Declaration) {
672  // Do nothing: Patterns can come with cursor kinds!
673  break;
674  }
675  LLVM_FALLTHROUGH;
676 
677  case RK_Declaration: {
678  // Set the availability based on attributes.
679  switch (getDeclAvailability(Declaration)) {
680  case AR_Available:
681  case AR_NotYetIntroduced:
682  Availability = CXAvailability_Available;
683  break;
684 
685  case AR_Deprecated:
686  Availability = CXAvailability_Deprecated;
687  break;
688 
689  case AR_Unavailable:
690  Availability = CXAvailability_NotAvailable;
691  break;
692  }
693 
694  if (const auto *Function = dyn_cast<FunctionDecl>(Declaration))
695  if (Function->isDeleted())
696  Availability = CXAvailability_NotAvailable;
697 
698  CursorKind = getCursorKindForDecl(Declaration);
699  if (CursorKind == CXCursor_UnexposedDecl) {
700  // FIXME: Forward declarations of Objective-C classes and protocols
701  // are not directly exposed, but we want code completion to treat them
702  // like a definition.
703  if (isa<ObjCInterfaceDecl>(Declaration))
704  CursorKind = CXCursor_ObjCInterfaceDecl;
705  else if (isa<ObjCProtocolDecl>(Declaration))
706  CursorKind = CXCursor_ObjCProtocolDecl;
707  else
708  CursorKind = CXCursor_NotImplemented;
709  }
710  break;
711  }
712 
713  case RK_Macro:
714  case RK_Keyword:
715  llvm_unreachable("Macro and keyword kinds are handled by the constructors");
716  }
717 
718  if (!Accessible)
719  Availability = CXAvailability_NotAccessible;
720 }
721 
722 /// Retrieve the name that should be used to order a result.
723 ///
724 /// If the name needs to be constructed as a string, that string will be
725 /// saved into Saved and the returned StringRef will refer to it.
727  switch (Kind) {
728  case RK_Keyword:
729  return Keyword;
730  case RK_Pattern:
731  return Pattern->getTypedText();
732  case RK_Macro:
733  return Macro->getName();
734  case RK_Declaration:
735  // Handle declarations below.
736  break;
737  }
738 
739  DeclarationName Name = Declaration->getDeclName();
740 
741  // If the name is a simple identifier (by far the common case), or a
742  // zero-argument selector, just return a reference to that identifier.
743  if (IdentifierInfo *Id = Name.getAsIdentifierInfo())
744  return Id->getName();
745  if (Name.isObjCZeroArgSelector())
746  if (IdentifierInfo *Id = Name.getObjCSelector().getIdentifierInfoForSlot(0))
747  return Id->getName();
748 
749  Saved = Name.getAsString();
750  return Saved;
751 }
752 
754  const CodeCompletionResult &Y) {
755  std::string XSaved, YSaved;
756  StringRef XStr = X.getOrderedName(XSaved);
757  StringRef YStr = Y.getOrderedName(YSaved);
758  int cmp = XStr.compare_lower(YStr);
759  if (cmp)
760  return cmp < 0;
761 
762  // If case-insensitive comparison fails, try case-sensitive comparison.
763  return XStr.compare(YStr) < 0;
764 }
clang::CodeCompletionContext::CCC_SymbolOrNewName
@ CCC_SymbolOrNewName
Code completion occurred where both a new name and an existing symbol is permissible.
Definition: CodeCompleteConsumer.h:278
clang::ObjCInterfaceDecl
Represents an ObjC class declaration.
Definition: DeclObjC.h:1148
clang::CodeCompletionContext::CCC_Other
@ CCC_Other
An unspecified code-completion context.
Definition: CodeCompleteConsumer.h:191
max
__DEVICE__ int max(int __a, int __b)
Definition: __clang_cuda_math.h:194
clang::CodeCompletionBuilder::addParentContext
void addParentContext(const DeclContext *DC)
Add the parent context information to this code completion.
Definition: CodeCompleteConsumer.cpp:465
clang::CodeCompletionString::getAnnotationCount
unsigned getAnnotationCount() const
Retrieve the number of annotations for this code completion result.
Definition: CodeCompleteConsumer.cpp:300
clang::CodeCompletionContext::Kind
Kind
Definition: CodeCompleteConsumer.h:189
string
string(SUBSTRING ${CMAKE_CURRENT_BINARY_DIR} 0 ${PATH_LIB_START} PATH_HEAD) string(SUBSTRING $
Definition: CMakeLists.txt:22
clang::DeclContext
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
Definition: DeclBase.h:1347
clang::CodeCompletionBuilder::TakeString
CodeCompletionString * TakeString()
Take the resulting completion string.
Definition: CodeCompleteConsumer.cpp:419
clang::CodeCompletionContext::CCC_ObjCInstanceMessage
@ CCC_ObjCInstanceMessage
Code completion where an Objective-C instance message is expected.
Definition: CodeCompleteConsumer.h:317
Optional
llvm::Optional< T > Optional
Definition: ByteCodeExprGen.cpp:23
clang::CodeCompletionContext::CCC_Expression
@ CCC_Expression
Code completion occurred where an expression is expected.
Definition: CodeCompleteConsumer.h:221
clang::CodeCompletionBuilder::AddOptionalChunk
void AddOptionalChunk(CodeCompletionString *Optional)
Add a new optional chunk.
Definition: CodeCompleteConsumer.cpp:439
clang::Sema::SourceMgr
SourceManager & SourceMgr
Definition: Sema.h:411
clang::CodeCompletionAllocator::CopyString
const char * CopyString(const Twine &String)
Copy the given string into this allocator.
Definition: CodeCompleteConsumer.cpp:346
clang::PrintingCodeCompleteConsumer::isResultFilteredOut
bool isResultFilteredOut(StringRef Filter, CodeCompletionResult Results) override
Definition: CodeCompleteConsumer.cpp:518
llvm::SmallVector
Definition: LLVM.h:38
clang::AR_Deprecated
@ AR_Deprecated
Definition: DeclBase.h:78
clang::SourceLocation
Encodes a location in the source.
Definition: SourceLocation.h:89
clang::CodeCompletionContext::CCC_Type
@ CCC_Type
Code completion occurred where a type name is expected.
Definition: CodeCompleteConsumer.h:271
clang::CodeCompletionContext::CCC_ObjCImplementation
@ CCC_ObjCImplementation
Code completion occurred within an Objective-C implementation or category implementation.
Definition: CodeCompleteConsumer.h:207
clang::CodeCompletionBuilder::AddChunk
void AddChunk(CodeCompletionString::ChunkKind CK, const char *Text="")
Add a new chunk.
Definition: CodeCompleteConsumer.cpp:460
clang::CodeCompletionString::CK_Text
@ CK_Text
A piece of text that should be placed in the buffer, e.g., parentheses or a comma in a function call.
Definition: CodeCompleteConsumer.h:451
clang::tooling::Filter
llvm::cl::opt< std::string > Filter
clang::CodeCompleteConsumer::OverloadCandidate::getFunctionType
const FunctionType * getFunctionType() const
Retrieve the function type of the entity, regardless of how the function is stored.
Definition: CodeCompleteConsumer.cpp:495
Index.h
clang::CodeCompletionString::CK_RightParen
@ CK_RightParen
A right parenthesis (')').
Definition: CodeCompleteConsumer.h:478
clang::Sema::getSourceManager
SourceManager & getSourceManager() const
Definition: Sema.h:1539
CodeCompleteConsumer.h
clang::CodeCompletionString::CK_TypedText
@ CK_TypedText
The piece of text that the user is expected to type to match the code-completion string,...
Definition: CodeCompleteConsumer.h:447
llvm::Optional
Definition: LLVM.h:40
clang::ComparisonCategoryType::First
@ First
clang::CodeCompletionContext::CCC_IncludedFile
@ CCC_IncludedFile
Code completion inside the filename part of a include directive.
Definition: CodeCompleteConsumer.h:330
clang::CodeCompletionResult::RK_Keyword
@ RK_Keyword
Refers to a keyword or symbol.
Definition: CodeCompleteConsumer.h:754
clang::CodeCompletionString::Chunk::Chunk
Chunk()
Definition: CodeCompleteConsumer.h:537
clang::CodeCompletionString::CK_VerticalSpace
@ CK_VerticalSpace
Vertical whitespace ('\n' or '\r\n', depending on the platform).
Definition: CodeCompleteConsumer.h:515
clang::tooling::X
static ToolExecutorPluginRegistry::Add< AllTUsToolExecutorPlugin > X("all-TUs", "Runs FrontendActions on all TUs in the compilation database. " "Tool results are stored in memory.")
clang::Lexer::MeasureTokenLength
static unsigned MeasureTokenLength(SourceLocation Loc, const SourceManager &SM, const LangOptions &LangOpts)
MeasureTokenLength - Relex the token at the specified location and return its length in bytes in the ...
Definition: Lexer.cpp:447
clang::CodeCompletionBuilder::AddTypedTextChunk
void AddTypedTextChunk(const char *Text)
Add a new typed-text chunk.
Definition: CodeCompleteConsumer.cpp:431
clang::FunctionType
FunctionType - C99 6.7.5.3 - Function Declarators.
Definition: Type.h:3545
clang::CodeCompletionString::CK_HorizontalSpace
@ CK_HorizontalSpace
Horizontal whitespace (' ').
Definition: CodeCompleteConsumer.h:511
clang::DeclarationName
The name of a declaration.
Definition: DeclarationName.h:145
clang::CodeCompletionString::end
iterator end() const
Definition: CodeCompleteConsumer.h:597
CXAvailability_NotAvailable
@ CXAvailability_NotAvailable
The entity is not available; any use of it will be an error.
Definition: Index.h:138
clang::CodeCompletionString::CK_ResultType
@ CK_ResultType
A piece of text that describes the type of an entity or, for functions and methods,...
Definition: CodeCompleteConsumer.h:467
clang::SourceManager
This class handles loading and caching of source files into memory.
Definition: SourceManager.h:624
clang::CodeCompletionResult
Captures a result of code completion.
Definition: CodeCompleteConsumer.h:746
clang::Type
The base class of the type hierarchy.
Definition: Type.h:1482
Preprocessor.h
clang::Decl::getAvailability
AvailabilityResult getAvailability(std::string *Message=nullptr, VersionTuple EnclosingVersion=VersionTuple(), StringRef *RealizedPlatform=nullptr) const
Determine the availability of the given declaration.
Definition: DeclBase.cpp:622
Decl.h
DeclObjC.h
clang::CodeCompletionString::ChunkKind
ChunkKind
The different kinds of "chunks" that can occur within a code completion string.
Definition: CodeCompleteConsumer.h:443
clang::FixItHint
Annotates a diagnostic with some code that should be inserted, removed, or replaced to fix the proble...
Definition: Diagnostic.h:70
clang::CodeCompletionContext::CCC_ObjCCategoryName
@ CCC_ObjCCategoryName
Code completion where an Objective-C category name is expected.
Definition: CodeCompleteConsumer.h:327
U
clang::CodeCompletionContext::CCC_TopLevel
@ CCC_TopLevel
Code completion occurred within a "top-level" completion context, e.g., at namespace or global scope.
Definition: CodeCompleteConsumer.h:199
clang::CodeCompletionString::CK_LeftAngle
@ CK_LeftAngle
A left angle bracket ('<').
Definition: CodeCompleteConsumer.h:493
clang::SourceLocation::print
void print(raw_ostream &OS, const SourceManager &SM) const
Definition: SourceLocation.cpp:62
clang::Decl::Kind
Kind
Lists the kind of concrete classes of Decl.
Definition: DeclBase.h:92
clang::CodeCompletionBuilder::AddCurrentParameterChunk
void AddCurrentParameterChunk(const char *CurrentParameter)
Add a new current-parameter chunk.
Definition: CodeCompleteConsumer.cpp:455
clang::AR_Available
@ AR_Available
Definition: DeclBase.h:76
clang::CodeCompletionContext::CCC_Recovery
@ CCC_Recovery
An unknown context, in which we are recovering from a parsing error and don't know which completions ...
Definition: CodeCompleteConsumer.h:334
clang::CodeCompletionString::CK_RightBracket
@ CK_RightBracket
A right bracket (']').
Definition: CodeCompleteConsumer.h:484
DeclTemplate.h
clang::CodeCompletionContext::CCC_ObjCProtocolName
@ CCC_ObjCProtocolName
Code completion occurred where a protocol name is expected.
Definition: CodeCompleteConsumer.h:264
clang::CodeCompletionContext::CCC_EnumTag
@ CCC_EnumTag
Code completion occurred after the "enum" keyword, to indicate an enumeration name.
Definition: CodeCompleteConsumer.h:253
Id
int Id
Definition: ASTDiff.cpp:191
clang::CodeCompletionString::Chunk::CreateOptional
static Chunk CreateOptional(CodeCompletionString *Optional)
Create a new optional chunk.
Definition: CodeCompleteConsumer.cpp:253
DeclBase.h
CXCursor_NotImplemented
@ CXCursor_NotImplemented
Definition: Index.h:1904
getOverloadAsString
static std::string getOverloadAsString(const CodeCompletionString &CCS)
Definition: CodeCompleteConsumer.cpp:617
CXCursor_ObjCProtocolDecl
@ CXCursor_ObjCProtocolDecl
An Objective-C @protocol declaration.
Definition: Index.h:1744
clang::CodeCompletionContext::CCC_ArrowMemberAccess
@ CCC_ArrowMemberAccess
Code completion occurred on the right-hand side of a member access expression using the arrow operato...
Definition: CodeCompleteConsumer.h:241
clang::CodeCompletionContext::CCC_Symbol
@ CCC_Symbol
Code completion occurred where an existing name(such as type, function or variable) is expected.
Definition: CodeCompleteConsumer.h:282
clang::CodeCompletionBuilder::AddTextChunk
void AddTextChunk(const char *Text)
Add a new text chunk.
Definition: CodeCompleteConsumer.cpp:435
clang::CodeCompletionString::Chunk::CreateResultType
static Chunk CreateResultType(const char *ResultType)
Create a new result type chunk.
Definition: CodeCompleteConsumer.cpp:271
CXAvailability_NotAccessible
@ CXAvailability_NotAccessible
The entity is available, but not accessible; any use of it will be an error.
Definition: Index.h:143
clang::Type::getAs
const T * getAs() const
Member-template getAs<specific type>'.
Definition: Type.h:7157
clang::CodeCompletionContext::CCC_ObjCInterfaceName
@ CCC_ObjCInterfaceName
Code completion where the name of an Objective-C class is expected.
Definition: CodeCompleteConsumer.h:324
uintptr_t
__UINTPTR_TYPE__ uintptr_t
An unsigned integer type with the property that any valid pointer to void can be converted to this ty...
Definition: opencl-c-base.h:92
clang::CodeCompletionString::CK_Informative
@ CK_Informative
A piece of text that describes something about the result but should not be inserted into the buffer.
Definition: CodeCompleteConsumer.h:464
IdentifierTable.h
clang::DeclContext::isTranslationUnit
bool isTranslationUnit() const
Definition: DeclBase.h:1935
Type.h
llvm::SmallString< 128 >
clang::CodeCompletionString::CK_LeftParen
@ CK_LeftParen
A left parenthesis ('(').
Definition: CodeCompleteConsumer.h:475
clang::CodeCompletionContext::CCC_ObjCMessageReceiver
@ CCC_ObjCMessageReceiver
Code completion occurred where an Objective-C message receiver is expected.
Definition: CodeCompleteConsumer.h:225
clang::Preprocessor::getCodeCompletionFilter
StringRef getCodeCompletionFilter()
Get the code completion token for filtering purposes.
Definition: Preprocessor.h:1283
clang::CodeCompletionString::getAsString
std::string getAsString() const
Retrieve a string representation of the code completion string, which is mainly useful for debugging.
Definition: CodeCompleteConsumer.cpp:311
getKind
static Decl::Kind getKind(const Decl *D)
Definition: DeclBase.cpp:994
Sema.h
clang::CodeCompletionString
A "string" used to describe how code completion can be performed for an entity.
Definition: CodeCompleteConsumer.h:439
clang::CodeCompletionString::Chunk::CreateCurrentParameter
static Chunk CreateCurrentParameter(const char *CurrentParameter)
Create a new current-parameter chunk.
Definition: CodeCompleteConsumer.cpp:275
clang::Sema::LangOpts
const LangOptions & LangOpts
Definition: Sema.h:406
clang::CodeCompletionContext::CCC_OtherWithMacros
@ CCC_OtherWithMacros
An unspecified code-completion context where we should also add macro completions.
Definition: CodeCompleteConsumer.h:195
clang::CodeCompletionBuilder::AddResultTypeChunk
void AddResultTypeChunk(const char *ResultType)
Add a new result-type chunk.
Definition: CodeCompleteConsumer.cpp:451
clang::CodeCompletionContext::CCC_Namespace
@ CCC_Namespace
Code completion occurred where a namespace or namespace alias is expected.
Definition: CodeCompleteConsumer.h:268
clang::CodeCompletionResult::RK_Macro
@ RK_Macro
Refers to a macro.
Definition: CodeCompleteConsumer.h:757
clang::CodeCompleteConsumer::OverloadCandidate
Definition: CodeCompleteConsumer.h:1002
clang::CodeCompletionString::CK_RightBrace
@ CK_RightBrace
A right brace ('}').
Definition: CodeCompleteConsumer.h:490
clang::CodeCompletionContext::CCC_ObjCPropertyAccess
@ CCC_ObjCPropertyAccess
Code completion occurred on the right-hand side of an Objective-C property access expression.
Definition: CodeCompleteConsumer.h:249
clang::CodeCompletionString::Chunk::Kind
ChunkKind Kind
The kind of data stored in this piece of the code completion string.
Definition: CodeCompleteConsumer.h:522
clang::CodeCompletionString::CK_SemiColon
@ CK_SemiColon
A semicolon (';').
Definition: CodeCompleteConsumer.h:505
clang::CodeCompletionContext::CCC_PreprocessorExpression
@ CCC_PreprocessorExpression
Code completion occurred within a preprocessor expression.
Definition: CodeCompleteConsumer.h:292
clang::NamedDecl::getIdentifier
IdentifierInfo * getIdentifier() const
Get the identifier that names this declaration, if there is one.
Definition: Decl.h:244
CXAvailability_Available
@ CXAvailability_Available
The entity is available.
Definition: Index.h:129
clang::DeclContext::getParent
DeclContext * getParent()
getParent - Returns the containing DeclContext.
Definition: DeclBase.h:1860
clang::PrintingCodeCompleteConsumer::ProcessOverloadCandidates
void ProcessOverloadCandidates(Sema &S, unsigned CurrentArg, OverloadCandidate *Candidates, unsigned NumCandidates, SourceLocation OpenParLoc) override
Definition: CodeCompleteConsumer.cpp:644
CXAvailabilityKind
CXAvailabilityKind
Describes the availability of a particular entity, which indicates whether the use of this entity wil...
Definition: Index.h:125
clang::CodeCompletionString::getTypedText
const char * getTypedText() const
Returns the text in the TypedText chunk.
Definition: CodeCompleteConsumer.cpp:338
clang::frontend::FixIt
@ FixIt
Parse and apply any fixits to the source.
Definition: FrontendOptions.h:79
clang::CodeCompletionContext::CCC_PreprocessorDirective
@ CCC_PreprocessorDirective
Code completion occurred where a preprocessor directive is expected.
Definition: CodeCompleteConsumer.h:296
clang::Decl
Decl - This represents one declaration (or definition), e.g.
Definition: DeclBase.h:89
clang::PrintingCodeCompleteConsumer::ProcessCodeCompleteResults
void ProcessCodeCompleteResults(Sema &S, CodeCompletionContext Context, CodeCompletionResult *Results, unsigned NumResults) override
Prints the finalized code-completion results.
Definition: CodeCompleteConsumer.cpp:535
clang::CodeCompletionString::CK_Equal
@ CK_Equal
An '=' sign.
Definition: CodeCompleteConsumer.h:508
clang::Sema
Sema - This implements semantic analysis and AST building for C.
Definition: Sema.h:352
clang::CodeCompletionContext::CCC_ClassStructUnion
@ CCC_ClassStructUnion
Code completion occurred within a class, struct, or union.
Definition: CodeCompleteConsumer.h:214
clang::CodeCompletionContext::CCC_Statement
@ CCC_Statement
Code completion occurred where a statement (or declaration) is expected in a function,...
Definition: CodeCompleteConsumer.h:218
clang::CodeCompletionContext::CCC_DotMemberAccess
@ CCC_DotMemberAccess
Code completion occurred on the right-hand side of a member access expression using the dot operator.
Definition: CodeCompleteConsumer.h:233
clang::CodeCompletionString::CK_CurrentParameter
@ CK_CurrentParameter
A piece of text that describes the parameter that corresponds to the code-completion location within ...
Definition: CodeCompleteConsumer.h:472
clang::CodeCompletionString::getAnnotation
const char * getAnnotation(unsigned AnnotationNr) const
Retrieve the annotation string specified by AnnotationNr.
Definition: CodeCompleteConsumer.cpp:304
clang::IdentifierInfo
One of these records is kept for each identifier that is lexed.
Definition: IdentifierTable.h:67
Priority
int Priority
Definition: Format.cpp:2180
clang::CodeCompletionString::CK_LeftBracket
@ CK_LeftBracket
A left bracket ('[').
Definition: CodeCompleteConsumer.h:481
clang::ObjCPropertyAttribute::Kind
Kind
Definition: DeclObjCCommon.h:22
clang::CodeCompletionResult::RK_Pattern
@ RK_Pattern
Refers to a precomputed pattern.
Definition: CodeCompleteConsumer.h:760
clang::Sema::getPreprocessor
Preprocessor & getPreprocessor() const
Definition: Sema.h:1540
DeclarationName.h
clang::CodeCompletionString::Chunk::CreatePlaceholder
static Chunk CreatePlaceholder(const char *Placeholder)
Create a new placeholder chunk.
Definition: CodeCompleteConsumer.cpp:261
clang::CodeCompletionContext::CCC_NaturalLanguage
@ CCC_NaturalLanguage
Code completion occurred in a context where natural language is expected, e.g., a comment or string l...
Definition: CodeCompleteConsumer.h:303
clang::CodeCompletionString::CK_Placeholder
@ CK_Placeholder
A string that acts as a placeholder for, e.g., a function call argument.
Definition: CodeCompleteConsumer.h:460
clang::AR_NotYetIntroduced
@ AR_NotYetIntroduced
Definition: DeclBase.h:77
clang::IdentifierInfo::getName
StringRef getName() const
Return the actual identifier string.
Definition: IdentifierTable.h:168
clang::AR_Unavailable
@ AR_Unavailable
Definition: DeclBase.h:79
clang
Definition: CalledOnceCheck.h:17
Text
StringRef Text
Definition: Format.cpp:2177
clang::CodeCompletionContext::CCC_NewName
@ CCC_NewName
Code completion occurred where a new name is expected.
Definition: CodeCompleteConsumer.h:274
clang::CodeCompletionString::Chunk::CreateInformative
static Chunk CreateInformative(const char *Informative)
Create a new informative chunk.
Definition: CodeCompleteConsumer.cpp:266
clang::AvailabilityResult
AvailabilityResult
Captures the result of checking the availability of a declaration.
Definition: DeclBase.h:75
clang::CodeCompletionResult::getOrderedName
StringRef getOrderedName(std::string &Saved) const
Retrieve the name that should be used to order a result.
Definition: CodeCompleteConsumer.cpp:726
clang::operator<
bool operator<(DeclarationName LHS, DeclarationName RHS)
Ordering on two declaration names.
Definition: DeclarationName.h:540
clang::CodeCompletionBuilder::AddPlaceholderChunk
void AddPlaceholderChunk(const char *Placeholder)
Add a new placeholder chunk.
Definition: CodeCompleteConsumer.cpp:443
clang::CodeCompletionBuilder::addBriefComment
void addBriefComment(StringRef Comment)
Definition: CodeCompleteConsumer.cpp:478
CXCursor_UnexposedDecl
@ CXCursor_UnexposedDecl
A declaration whose specific kind is not exposed via this interface.
Definition: Index.h:1717
clang::CodeCompletionContext::CCC_ObjCIvarList
@ CCC_ObjCIvarList
Code completion occurred within the instance variable list of an Objective-C interface,...
Definition: CodeCompleteConsumer.h:211
clang::CodeCompletionString::CK_RightAngle
@ CK_RightAngle
A right angle bracket ('>').
Definition: CodeCompleteConsumer.h:496
clang::CodeCompletionResult::RK_Declaration
@ RK_Declaration
Refers to a declaration.
Definition: CodeCompleteConsumer.h:751
CXAvailability_Deprecated
@ CXAvailability_Deprecated
The entity is available, but has been deprecated (and its use is not recommended).
Definition: Index.h:134
clang::CodeCompletionContext::CCC_ParenthesizedExpression
@ CCC_ParenthesizedExpression
Code completion in a parenthesized expression, which means that we may also have types here in C and ...
Definition: CodeCompleteConsumer.h:313
clang::CodeCompletionString::Chunk::CreateText
static Chunk CreateText(const char *Text)
Create a new text chunk.
Definition: CodeCompleteConsumer.cpp:248
clang::CodeCompletionContext::wantConstructorResults
bool wantConstructorResults() const
Determines whether we want C++ constructors as results within this context.
Definition: CodeCompleteConsumer.cpp:45
clang::CodeCompletionString::Chunk
One piece of the code completion string.
Definition: CodeCompleteConsumer.h:519
clang::CodeCompletionContext::CCC_SelectorName
@ CCC_SelectorName
Code completion for a selector, as in an @selector expression.
Definition: CodeCompleteConsumer.h:306
clang::CodeCompleteConsumer::~CodeCompleteConsumer
virtual ~CodeCompleteConsumer()
Deregisters and destroys this code-completion consumer.
clang::index::SymbolKind::Function
@ Function
clang::CodeCompletionString::CK_Optional
@ CK_Optional
A code completion string that is entirely optional.
Definition: CodeCompleteConsumer.h:456
clang::getCursorKindForDecl
CXCursorKind getCursorKindForDecl(const Decl *D)
Determine the libclang cursor kind associated with the given declaration.
Definition: SemaCodeComplete.cpp:3836
clang::CodeCompletionContext
The context in which code completion occurred, so that the code-completion consumer can process the r...
Definition: CodeCompleteConsumer.h:187
clang::getCompletionKindString
llvm::StringRef getCompletionKindString(CodeCompletionContext::Kind Kind)
Get string representation of Kind, useful for for debugging.
Definition: CodeCompleteConsumer.cpp:91
clang::CodeCompletionBuilder::AddInformativeChunk
void AddInformativeChunk(const char *Text)
Add a new informative chunk.
Definition: CodeCompleteConsumer.cpp:447
clang::CodeCompletionString::CK_LeftBrace
@ CK_LeftBrace
A left brace ('{').
Definition: CodeCompleteConsumer.h:487
clang::CodeCompletionTUInfo::getParentName
StringRef getParentName(const DeclContext *DC)
Definition: CodeCompleteConsumer.cpp:358
SM
#define SM(sm)
Definition: Cuda.cpp:70
CXCursor_ObjCInterfaceDecl
@ CXCursor_ObjCInterfaceDecl
An Objective-C @interface.
Definition: Index.h:1740
clang::DeclContext::isFunctionOrMethod
bool isFunctionOrMethod() const
Definition: DeclBase.h:1912
clang::CodeCompletionString::CK_Colon
@ CK_Colon
A colon (':').
Definition: CodeCompleteConsumer.h:502
clang::CodeCompletionString::CK_Comma
@ CK_Comma
A comma separator (',').
Definition: CodeCompleteConsumer.h:499
clang::CodeCompletionString::Chunk::Text
const char * Text
The text string associated with a CK_Text, CK_Placeholder, CK_Informative, or CK_Comma chunk.
Definition: CodeCompleteConsumer.h:529
clang::FunctionDecl
Represents a function declaration or definition.
Definition: Decl.h:1825
getDeclAvailability
static AvailabilityResult getDeclAvailability(const Decl *D)
Retrieve the effective availability of the given declaration.
Definition: CodeCompleteConsumer.cpp:661
clang::CodeCompletionContext::CCC_UnionTag
@ CCC_UnionTag
Code completion occurred after the "union" keyword, to indicate a union name.
Definition: CodeCompleteConsumer.h:257
clang::CodeCompleteConsumer::OverloadCandidate::getFunction
FunctionDecl * getFunction() const
Retrieve the function overload candidate or the templated function declaration for a function templat...
Definition: CodeCompleteConsumer.cpp:485
clang::CodeCompletionContext::CCC_MacroName
@ CCC_MacroName
Code completion occurred where an macro is being defined.
Definition: CodeCompleteConsumer.h:285
clang::CodeCompletionContext::CCC_ObjCClassMessage
@ CCC_ObjCClassMessage
Code completion where an Objective-C class message is expected.
Definition: CodeCompleteConsumer.h:320
clang::CodeCompletionContext::CCC_ObjCInterface
@ CCC_ObjCInterface
Code completion occurred within an Objective-C interface, protocol, or category interface.
Definition: CodeCompleteConsumer.h:203
clang::CodeCompletionContext::CCC_ClassOrStructTag
@ CCC_ClassOrStructTag
Code completion occurred after the "struct" or "class" keyword, to indicate a struct or class name.
Definition: CodeCompleteConsumer.h:261
clang::CodeCompletionContext::CCC_TypeQualifiers
@ CCC_TypeQualifiers
Code completion within a type-qualifier list.
Definition: CodeCompleteConsumer.h:309
clang::CodeCompletionContext::CCC_MacroNameUse
@ CCC_MacroNameUse
Code completion occurred where a macro name is expected (without any arguments, in the case of a func...
Definition: CodeCompleteConsumer.h:289
clang::Decl::getDeclContext
DeclContext * getDeclContext()
Definition: DeclBase.h:439
clang::NamedDecl::getName
StringRef getName() const
Get the name of identifier for this declaration as a StringRef.
Definition: Decl.h:250