clang  13.0.0git
CodeCompleteConsumer.h
Go to the documentation of this file.
1 //===- CodeCompleteConsumer.h - Code Completion Interface -------*- C++ -*-===//
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 defines the CodeCompleteConsumer class.
10 //
11 //===----------------------------------------------------------------------===//
12 
13 #ifndef LLVM_CLANG_SEMA_CODECOMPLETECONSUMER_H
14 #define LLVM_CLANG_SEMA_CODECOMPLETECONSUMER_H
15 
16 #include "clang-c/Index.h"
17 #include "clang/AST/Type.h"
18 #include "clang/Basic/LLVM.h"
19 #include "clang/Lex/MacroInfo.h"
21 #include "clang/Sema/DeclSpec.h"
22 #include "llvm/ADT/ArrayRef.h"
23 #include "llvm/ADT/DenseMap.h"
24 #include "llvm/ADT/None.h"
25 #include "llvm/ADT/Optional.h"
26 #include "llvm/ADT/SmallPtrSet.h"
27 #include "llvm/ADT/SmallVector.h"
28 #include "llvm/ADT/StringRef.h"
29 #include "llvm/Support/Allocator.h"
30 #include "llvm/Support/type_traits.h"
31 #include <cassert>
32 #include <memory>
33 #include <string>
34 #include <utility>
35 
36 namespace clang {
37 
38 class ASTContext;
39 class Decl;
40 class DeclContext;
41 class FunctionDecl;
42 class FunctionTemplateDecl;
43 class IdentifierInfo;
44 class LangOptions;
45 class NamedDecl;
46 class NestedNameSpecifier;
47 class Preprocessor;
48 class RawComment;
49 class Sema;
50 class UsingShadowDecl;
51 
52 /// Default priority values for code-completion results based
53 /// on their kind.
54 enum {
55  /// Priority for the next initialization in a constructor initializer
56  /// list.
58 
59  /// Priority for an enumeration constant inside a switch whose
60  /// condition is of the enumeration type.
62 
63  /// Priority for a send-to-super completion.
65 
66  /// Priority for a declaration that is in the local scope.
68 
69  /// Priority for a member declaration found from the current
70  /// method or member function.
72 
73  /// Priority for a language keyword (that isn't any of the other
74  /// categories).
76 
77  /// Priority for a code pattern.
79 
80  /// Priority for a non-type declaration.
82 
83  /// Priority for a type.
85 
86  /// Priority for a constant value (e.g., enumerator).
88 
89  /// Priority for a preprocessor macro.
90  CCP_Macro = 70,
91 
92  /// Priority for a nested-name-specifier.
94 
95  /// Priority for a result that isn't likely to be what the user wants,
96  /// but is included for completeness.
98 
99  /// Priority for the Objective-C "_cmd" implicit parameter.
101 };
102 
103 /// Priority value deltas that are added to code-completion results
104 /// based on the context of the result.
105 enum {
106  /// The result is in a base class.
108 
109  /// The result is a C++ non-static member function whose qualifiers
110  /// exactly match the object type on which the member function can be called.
112 
113  /// The selector of the given message exactly matches the selector
114  /// of the current method, which might imply that some kind of delegation
115  /// is occurring.
117 
118  /// Adjustment to the "bool" type in Objective-C, where the typedef
119  /// "BOOL" is preferred.
121 
122  /// Adjustment for KVC code pattern priorities when it doesn't look
123  /// like the
125 
126  /// An Objective-C method being used as a property.
128 
129  /// An Objective-C block property completed as a setter with a
130  /// block placeholder.
132 };
133 
134 /// Priority value factors by which we will divide or multiply the
135 /// priority of a code-completion result.
136 enum {
137  /// Divide by this factor when a code-completion result's type exactly
138  /// matches the type we expect.
140 
141  /// Divide by this factor when a code-completion result's type is
142  /// similar to the type we expect (e.g., both arithmetic types, both
143  /// Objective-C object pointer types).
145 };
146 
147 /// A simplified classification of types used when determining
148 /// "similar" types for code completion.
159 };
160 
161 /// Determine the simplified type class of the given canonical type.
163 
164 /// Determine the type that this declaration will have if it is used
165 /// as a type or in an expression.
166 QualType getDeclUsageType(ASTContext &C, const NamedDecl *ND);
167 
168 /// Determine the priority to be given to a macro code completion result
169 /// with the given name.
170 ///
171 /// \param MacroName The name of the macro.
172 ///
173 /// \param LangOpts Options describing the current language dialect.
174 ///
175 /// \param PreferredTypeIsPointer Whether the preferred type for the context
176 /// of this macro is a pointer type.
177 unsigned getMacroUsagePriority(StringRef MacroName,
178  const LangOptions &LangOpts,
179  bool PreferredTypeIsPointer = false);
180 
181 /// Determine the libclang cursor kind associated with the given
182 /// declaration.
183 CXCursorKind getCursorKindForDecl(const Decl *D);
184 
185 /// The context in which code completion occurred, so that the
186 /// code-completion consumer can process the results accordingly.
188 public:
189  enum Kind {
190  /// An unspecified code-completion context.
192 
193  /// An unspecified code-completion context where we should also add
194  /// macro completions.
196 
197  /// Code completion occurred within a "top-level" completion context,
198  /// e.g., at namespace or global scope.
200 
201  /// Code completion occurred within an Objective-C interface,
202  /// protocol, or category interface.
204 
205  /// Code completion occurred within an Objective-C implementation
206  /// or category implementation.
208 
209  /// Code completion occurred within the instance variable list of
210  /// an Objective-C interface, implementation, or category implementation.
212 
213  /// Code completion occurred within a class, struct, or union.
215 
216  /// Code completion occurred where a statement (or declaration) is
217  /// expected in a function, method, or block.
219 
220  /// Code completion occurred where an expression is expected.
222 
223  /// Code completion occurred where an Objective-C message receiver
224  /// is expected.
226 
227  /// Code completion occurred on the right-hand side of a member
228  /// access expression using the dot operator.
229  ///
230  /// The results of this completion are the members of the type being
231  /// accessed. The type itself is available via
232  /// \c CodeCompletionContext::getType().
234 
235  /// Code completion occurred on the right-hand side of a member
236  /// access expression using the arrow operator.
237  ///
238  /// The results of this completion are the members of the type being
239  /// accessed. The type itself is available via
240  /// \c CodeCompletionContext::getType().
242 
243  /// Code completion occurred on the right-hand side of an Objective-C
244  /// property access expression.
245  ///
246  /// The results of this completion are the members of the type being
247  /// accessed. The type itself is available via
248  /// \c CodeCompletionContext::getType().
250 
251  /// Code completion occurred after the "enum" keyword, to indicate
252  /// an enumeration name.
254 
255  /// Code completion occurred after the "union" keyword, to indicate
256  /// a union name.
258 
259  /// Code completion occurred after the "struct" or "class" keyword,
260  /// to indicate a struct or class name.
262 
263  /// Code completion occurred where a protocol name is expected.
265 
266  /// Code completion occurred where a namespace or namespace alias
267  /// is expected.
269 
270  /// Code completion occurred where a type name is expected.
272 
273  /// Code completion occurred where a new name is expected.
275 
276  /// Code completion occurred where both a new name and an existing symbol is
277  /// permissible.
279 
280  /// Code completion occurred where an existing name(such as type, function
281  /// or variable) is expected.
283 
284  /// Code completion occurred where an macro is being defined.
286 
287  /// Code completion occurred where a macro name is expected
288  /// (without any arguments, in the case of a function-like macro).
290 
291  /// Code completion occurred within a preprocessor expression.
293 
294  /// Code completion occurred where a preprocessor directive is
295  /// expected.
297 
298  /// Code completion occurred in a context where natural language is
299  /// expected, e.g., a comment or string literal.
300  ///
301  /// This context usually implies that no completions should be added,
302  /// unless they come from an appropriate natural-language dictionary.
304 
305  /// Code completion for a selector, as in an \@selector expression.
307 
308  /// Code completion within a type-qualifier list.
310 
311  /// Code completion in a parenthesized expression, which means that
312  /// we may also have types here in C and Objective-C (as well as in C++).
314 
315  /// Code completion where an Objective-C instance message is
316  /// expected.
318 
319  /// Code completion where an Objective-C class message is expected.
321 
322  /// Code completion where the name of an Objective-C class is
323  /// expected.
325 
326  /// Code completion where an Objective-C category name is expected.
328 
329  /// Code completion inside the filename part of a #include directive.
331 
332  /// An unknown context, in which we are recovering from a parsing
333  /// error and don't know which completions we should give.
335  };
336 
338 
339 private:
340  Kind CCKind;
341 
342  /// Indicates whether we are completing a name of a using declaration, e.g.
343  /// using ^;
344  /// using a::^;
345  bool IsUsingDeclaration;
346 
347  /// The type that would prefer to see at this point (e.g., the type
348  /// of an initializer or function parameter).
349  QualType PreferredType;
350 
351  /// The type of the base object in a member access expression.
352  QualType BaseType;
353 
354  /// The identifiers for Objective-C selector parts.
355  ArrayRef<IdentifierInfo *> SelIdents;
356 
357  /// The scope specifier that comes before the completion token e.g.
358  /// "a::b::"
359  llvm::Optional<CXXScopeSpec> ScopeSpecifier;
360 
361  /// A set of declaration contexts visited by Sema when doing lookup for
362  /// code completion.
363  VisitedContextSet VisitedContexts;
364 
365 public:
366  /// Construct a new code-completion context of the given kind.
368  : CCKind(CCKind), IsUsingDeclaration(false), SelIdents(None) {}
369 
370  /// Construct a new code-completion context of the given kind.
372  ArrayRef<IdentifierInfo *> SelIdents = None)
373  : CCKind(CCKind), IsUsingDeclaration(false), SelIdents(SelIdents) {
374  if (CCKind == CCC_DotMemberAccess || CCKind == CCC_ArrowMemberAccess ||
375  CCKind == CCC_ObjCPropertyAccess || CCKind == CCC_ObjCClassMessage ||
376  CCKind == CCC_ObjCInstanceMessage)
377  BaseType = T;
378  else
379  PreferredType = T;
380  }
381 
382  bool isUsingDeclaration() const { return IsUsingDeclaration; }
383  void setIsUsingDeclaration(bool V) { IsUsingDeclaration = V; }
384 
385  /// Retrieve the kind of code-completion context.
386  Kind getKind() const { return CCKind; }
387 
388  /// Retrieve the type that this expression would prefer to have, e.g.,
389  /// if the expression is a variable initializer or a function argument, the
390  /// type of the corresponding variable or function parameter.
391  QualType getPreferredType() const { return PreferredType; }
392  void setPreferredType(QualType T) { PreferredType = T; }
393 
394  /// Retrieve the type of the base object in a member-access
395  /// expression.
396  QualType getBaseType() const { return BaseType; }
397 
398  /// Retrieve the Objective-C selector identifiers.
399  ArrayRef<IdentifierInfo *> getSelIdents() const { return SelIdents; }
400 
401  /// Determines whether we want C++ constructors as results within this
402  /// context.
403  bool wantConstructorResults() const;
404 
405  /// Sets the scope specifier that comes before the completion token.
406  /// This is expected to be set in code completions on qualfied specifiers
407  /// (e.g. "a::b::").
409  this->ScopeSpecifier = std::move(SS);
410  }
411 
412  /// Adds a visited context.
414  VisitedContexts.insert(Ctx);
415  }
416 
417  /// Retrieves all visited contexts.
419  return VisitedContexts;
420  }
421 
423  if (ScopeSpecifier)
424  return ScopeSpecifier.getPointer();
425  return llvm::None;
426  }
427 };
428 
429 /// Get string representation of \p Kind, useful for for debugging.
431 
432 /// A "string" used to describe how code completion can
433 /// be performed for an entity.
434 ///
435 /// A code completion string typically shows how a particular entity can be
436 /// used. For example, the code completion string for a function would show
437 /// the syntax to call it, including the parentheses, placeholders for the
438 /// arguments, etc.
440 public:
441  /// The different kinds of "chunks" that can occur within a code
442  /// completion string.
443  enum ChunkKind {
444  /// The piece of text that the user is expected to type to
445  /// match the code-completion string, typically a keyword or the name of a
446  /// declarator or macro.
448 
449  /// A piece of text that should be placed in the buffer, e.g.,
450  /// parentheses or a comma in a function call.
452 
453  /// A code completion string that is entirely optional. For example,
454  /// an optional code completion string that describes the default arguments
455  /// in a function call.
457 
458  /// A string that acts as a placeholder for, e.g., a function
459  /// call argument.
461 
462  /// A piece of text that describes something about the result but
463  /// should not be inserted into the buffer.
465  /// A piece of text that describes the type of an entity or, for
466  /// functions and methods, the return type.
468 
469  /// A piece of text that describes the parameter that corresponds
470  /// to the code-completion location within a function call, message send,
471  /// macro invocation, etc.
473 
474  /// A left parenthesis ('(').
476 
477  /// A right parenthesis (')').
479 
480  /// A left bracket ('[').
482 
483  /// A right bracket (']').
485 
486  /// A left brace ('{').
488 
489  /// A right brace ('}').
491 
492  /// A left angle bracket ('<').
494 
495  /// A right angle bracket ('>').
497 
498  /// A comma separator (',').
500 
501  /// A colon (':').
503 
504  /// A semicolon (';').
506 
507  /// An '=' sign.
509 
510  /// Horizontal whitespace (' ').
512 
513  /// Vertical whitespace ('\\n' or '\\r\\n', depending on the
514  /// platform).
516  };
517 
518  /// One piece of the code completion string.
519  struct Chunk {
520  /// The kind of data stored in this piece of the code completion
521  /// string.
523 
524  union {
525  /// The text string associated with a CK_Text, CK_Placeholder,
526  /// CK_Informative, or CK_Comma chunk.
527  /// The string is owned by the chunk and will be deallocated
528  /// (with delete[]) when the chunk is destroyed.
529  const char *Text;
530 
531  /// The code completion string associated with a CK_Optional chunk.
532  /// The optional code completion string is owned by the chunk, and will
533  /// be deallocated (with delete) when the chunk is destroyed.
535  };
536 
537  Chunk() : Text(nullptr) {}
538 
539  explicit Chunk(ChunkKind Kind, const char *Text = "");
540 
541  /// Create a new text chunk.
542  static Chunk CreateText(const char *Text);
543 
544  /// Create a new optional chunk.
546 
547  /// Create a new placeholder chunk.
548  static Chunk CreatePlaceholder(const char *Placeholder);
549 
550  /// Create a new informative chunk.
551  static Chunk CreateInformative(const char *Informative);
552 
553  /// Create a new result type chunk.
554  static Chunk CreateResultType(const char *ResultType);
555 
556  /// Create a new current-parameter chunk.
557  static Chunk CreateCurrentParameter(const char *CurrentParameter);
558  };
559 
560 private:
561  friend class CodeCompletionBuilder;
562  friend class CodeCompletionResult;
563 
564  /// The number of chunks stored in this string.
565  unsigned NumChunks : 16;
566 
567  /// The number of annotations for this code-completion result.
568  unsigned NumAnnotations : 16;
569 
570  /// The priority of this code-completion string.
571  unsigned Priority : 16;
572 
573  /// The availability of this code-completion result.
574  unsigned Availability : 2;
575 
576  /// The name of the parent context.
577  StringRef ParentName;
578 
579  /// A brief documentation comment attached to the declaration of
580  /// entity being completed by this result.
581  const char *BriefComment;
582 
583  CodeCompletionString(const Chunk *Chunks, unsigned NumChunks,
584  unsigned Priority, CXAvailabilityKind Availability,
585  const char **Annotations, unsigned NumAnnotations,
586  StringRef ParentName,
587  const char *BriefComment);
588  ~CodeCompletionString() = default;
589 
590 public:
591  CodeCompletionString(const CodeCompletionString &) = delete;
593 
594  using iterator = const Chunk *;
595 
596  iterator begin() const { return reinterpret_cast<const Chunk *>(this + 1); }
597  iterator end() const { return begin() + NumChunks; }
598  bool empty() const { return NumChunks == 0; }
599  unsigned size() const { return NumChunks; }
600 
601  const Chunk &operator[](unsigned I) const {
602  assert(I < size() && "Chunk index out-of-range");
603  return begin()[I];
604  }
605 
606  /// Returns the text in the TypedText chunk.
607  const char *getTypedText() const;
608 
609  /// Retrieve the priority of this code completion result.
610  unsigned getPriority() const { return Priority; }
611 
612  /// Retrieve the availability of this code completion result.
613  unsigned getAvailability() const { return Availability; }
614 
615  /// Retrieve the number of annotations for this code completion result.
616  unsigned getAnnotationCount() const;
617 
618  /// Retrieve the annotation string specified by \c AnnotationNr.
619  const char *getAnnotation(unsigned AnnotationNr) const;
620 
621  /// Retrieve the name of the parent context.
622  StringRef getParentContextName() const {
623  return ParentName;
624  }
625 
626  const char *getBriefComment() const {
627  return BriefComment;
628  }
629 
630  /// Retrieve a string representation of the code completion string,
631  /// which is mainly useful for debugging.
632  std::string getAsString() const;
633 };
634 
635 /// An allocator used specifically for the purpose of code completion.
636 class CodeCompletionAllocator : public llvm::BumpPtrAllocator {
637 public:
638  /// Copy the given string into this allocator.
639  const char *CopyString(const Twine &String);
640 };
641 
642 /// Allocator for a cached set of global code completions.
644 
646  llvm::DenseMap<const DeclContext *, StringRef> ParentNames;
647  std::shared_ptr<GlobalCodeCompletionAllocator> AllocatorRef;
648 
649 public:
651  std::shared_ptr<GlobalCodeCompletionAllocator> Allocator)
652  : AllocatorRef(std::move(Allocator)) {}
653 
654  std::shared_ptr<GlobalCodeCompletionAllocator> getAllocatorRef() const {
655  return AllocatorRef;
656  }
657 
659  assert(AllocatorRef);
660  return *AllocatorRef;
661  }
662 
663  StringRef getParentName(const DeclContext *DC);
664 };
665 
666 } // namespace clang
667 
668 namespace clang {
669 
670 /// A builder class used to construct new code-completion strings.
672 public:
674 
675 private:
676  CodeCompletionAllocator &Allocator;
677  CodeCompletionTUInfo &CCTUInfo;
678  unsigned Priority = 0;
680  StringRef ParentName;
681  const char *BriefComment = nullptr;
682 
683  /// The chunks stored in this string.
684  SmallVector<Chunk, 4> Chunks;
685 
686  SmallVector<const char *, 2> Annotations;
687 
688 public:
690  CodeCompletionTUInfo &CCTUInfo)
691  : Allocator(Allocator), CCTUInfo(CCTUInfo) {}
692 
694  CodeCompletionTUInfo &CCTUInfo,
695  unsigned Priority, CXAvailabilityKind Availability)
696  : Allocator(Allocator), CCTUInfo(CCTUInfo), Priority(Priority),
697  Availability(Availability) {}
698 
699  /// Retrieve the allocator into which the code completion
700  /// strings should be allocated.
701  CodeCompletionAllocator &getAllocator() const { return Allocator; }
702 
703  CodeCompletionTUInfo &getCodeCompletionTUInfo() const { return CCTUInfo; }
704 
705  /// Take the resulting completion string.
706  ///
707  /// This operation can only be performed once.
709 
710  /// Add a new typed-text chunk.
711  void AddTypedTextChunk(const char *Text);
712 
713  /// Add a new text chunk.
714  void AddTextChunk(const char *Text);
715 
716  /// Add a new optional chunk.
718 
719  /// Add a new placeholder chunk.
720  void AddPlaceholderChunk(const char *Placeholder);
721 
722  /// Add a new informative chunk.
723  void AddInformativeChunk(const char *Text);
724 
725  /// Add a new result-type chunk.
726  void AddResultTypeChunk(const char *ResultType);
727 
728  /// Add a new current-parameter chunk.
729  void AddCurrentParameterChunk(const char *CurrentParameter);
730 
731  /// Add a new chunk.
732  void AddChunk(CodeCompletionString::ChunkKind CK, const char *Text = "");
733 
734  void AddAnnotation(const char *A) { Annotations.push_back(A); }
735 
736  /// Add the parent context information to this code completion.
737  void addParentContext(const DeclContext *DC);
738 
739  const char *getBriefComment() const { return BriefComment; }
740  void addBriefComment(StringRef Comment);
741 
742  StringRef getParentName() const { return ParentName; }
743 };
744 
745 /// Captures a result of code completion.
747 public:
748  /// Describes the kind of result generated.
749  enum ResultKind {
750  /// Refers to a declaration.
752 
753  /// Refers to a keyword or symbol.
755 
756  /// Refers to a macro.
758 
759  /// Refers to a precomputed pattern.
761  };
762 
763  /// When Kind == RK_Declaration or RK_Pattern, the declaration we are
764  /// referring to. In the latter case, the declaration might be NULL.
765  const NamedDecl *Declaration = nullptr;
766 
767  union {
768  /// When Kind == RK_Keyword, the string representing the keyword
769  /// or symbol's spelling.
770  const char *Keyword;
771 
772  /// When Kind == RK_Pattern, the code-completion string that
773  /// describes the completion text to insert.
775 
776  /// When Kind == RK_Macro, the identifier that refers to a macro.
778  };
779 
780  /// The priority of this particular code-completion result.
781  unsigned Priority;
782 
783  /// Specifies which parameter (of a function, Objective-C method,
784  /// macro, etc.) we should start with when formatting the result.
785  unsigned StartParameter = 0;
786 
787  /// The kind of result stored here.
789 
790  /// The cursor kind that describes this result.
792 
793  /// The availability of this result.
795 
796  /// Fix-its that *must* be applied before inserting the text for the
797  /// corresponding completion.
798  ///
799  /// By default, CodeCompletionBuilder only returns completions with empty
800  /// fix-its. Extra completions with non-empty fix-its should be explicitly
801  /// requested by setting CompletionOptions::IncludeFixIts.
802  ///
803  /// For the clients to be able to compute position of the cursor after
804  /// applying fix-its, the following conditions are guaranteed to hold for
805  /// RemoveRange of the stored fix-its:
806  /// - Ranges in the fix-its are guaranteed to never contain the completion
807  /// point (or identifier under completion point, if any) inside them, except
808  /// at the start or at the end of the range.
809  /// - If a fix-it range starts or ends with completion point (or starts or
810  /// ends after the identifier under completion point), it will contain at
811  /// least one character. It allows to unambiguously recompute completion
812  /// point after applying the fix-it.
813  ///
814  /// The intuition is that provided fix-its change code around the identifier
815  /// we complete, but are not allowed to touch the identifier itself or the
816  /// completion point. One example of completions with corrections are the ones
817  /// replacing '.' with '->' and vice versa:
818  ///
819  /// std::unique_ptr<std::vector<int>> vec_ptr;
820  /// In 'vec_ptr.^', one of the completions is 'push_back', it requires
821  /// replacing '.' with '->'.
822  /// In 'vec_ptr->^', one of the completions is 'release', it requires
823  /// replacing '->' with '.'.
824  std::vector<FixItHint> FixIts;
825 
826  /// Whether this result is hidden by another name.
827  bool Hidden : 1;
828 
829  /// Whether this is a class member from base class.
830  bool InBaseClass : 1;
831 
832  /// Whether this result was found via lookup into a base class.
834 
835  /// Whether this declaration is the beginning of a
836  /// nested-name-specifier and, therefore, should be followed by '::'.
838 
839  /// Whether all parameters (of a function, Objective-C
840  /// method, etc.) should be considered "informative".
842 
843  /// Whether we're completing a declaration of the given entity,
844  /// rather than a use of that entity.
845  bool DeclaringEntity : 1;
846 
847  /// If the result should have a nested-name-specifier, this is it.
848  /// When \c QualifierIsInformative, the nested-name-specifier is
849  /// informative rather than required.
851 
852  /// If this Decl was unshadowed by using declaration, this can store a
853  /// pointer to the UsingShadowDecl which was used in the unshadowing process.
854  /// This information can be used to uprank CodeCompletionResults / which have
855  /// corresponding `using decl::qualified::name;` nearby.
856  const UsingShadowDecl *ShadowDecl = nullptr;
857 
858  /// If the result is RK_Macro, this can store the information about the macro
859  /// definition. This should be set in most cases but can be missing when
860  /// the macro has been undefined.
861  const MacroInfo *MacroDefInfo = nullptr;
862 
863  /// Build a result that refers to a declaration.
865  NestedNameSpecifier *Qualifier = nullptr,
866  bool QualifierIsInformative = false,
867  bool Accessible = true,
868  std::vector<FixItHint> FixIts = std::vector<FixItHint>())
874  // FIXME: Add assert to check FixIts range requirements.
875  computeCursorKindAndAvailability(Accessible);
876  }
877 
878  /// Build a result that refers to a keyword or symbol.
884 
885  /// Build a result that refers to a macro.
887  const MacroInfo *MI = nullptr,
888  unsigned Priority = CCP_Macro)
893  MacroDefInfo(MI) {}
894 
895  /// Build a result that refers to a pattern.
900  const NamedDecl *D = nullptr)
906 
907  /// Build a result that refers to a pattern with an associated
908  /// declaration.
910  unsigned Priority)
915  computeCursorKindAndAvailability();
916  }
917 
918  /// Retrieve the declaration stored in this result. This might be nullptr if
919  /// Kind is RK_Pattern.
920  const NamedDecl *getDeclaration() const {
921  assert(((Kind == RK_Declaration) || (Kind == RK_Pattern)) &&
922  "Not a declaration or pattern result");
923  return Declaration;
924  }
925 
926  /// Retrieve the keyword stored in this result.
927  const char *getKeyword() const {
928  assert(Kind == RK_Keyword && "Not a keyword result");
929  return Keyword;
930  }
931 
932  /// Create a new code-completion string that describes how to insert
933  /// this result into a program.
934  ///
935  /// \param S The semantic analysis that created the result.
936  ///
937  /// \param Allocator The allocator that will be used to allocate the
938  /// string itself.
940  const CodeCompletionContext &CCContext,
941  CodeCompletionAllocator &Allocator,
942  CodeCompletionTUInfo &CCTUInfo,
943  bool IncludeBriefComments);
945  Preprocessor &PP,
946  const CodeCompletionContext &CCContext,
947  CodeCompletionAllocator &Allocator,
948  CodeCompletionTUInfo &CCTUInfo,
949  bool IncludeBriefComments);
950  /// Creates a new code-completion string for the macro result. Similar to the
951  /// above overloads, except this only requires preprocessor information.
952  /// The result kind must be `RK_Macro`.
955  CodeCompletionAllocator &Allocator,
956  CodeCompletionTUInfo &CCTUInfo);
957 
959  Preprocessor &PP, ASTContext &Ctx, CodeCompletionBuilder &Result,
960  bool IncludeBriefComments, const CodeCompletionContext &CCContext,
961  PrintingPolicy &Policy);
962 
964  Preprocessor &PP, ASTContext &Ctx, CodeCompletionBuilder &Result,
965  bool IncludeBriefComments, const CodeCompletionContext &CCContext,
966  PrintingPolicy &Policy);
967 
968  /// Retrieve the name that should be used to order a result.
969  ///
970  /// If the name needs to be constructed as a string, that string will be
971  /// saved into Saved and the returned StringRef will refer to it.
972  StringRef getOrderedName(std::string &Saved) const;
973 
974 private:
975  void computeCursorKindAndAvailability(bool Accessible = true);
976 };
977 
978 bool operator<(const CodeCompletionResult &X, const CodeCompletionResult &Y);
979 
980 inline bool operator>(const CodeCompletionResult &X,
981  const CodeCompletionResult &Y) {
982  return Y < X;
983 }
984 
985 inline bool operator<=(const CodeCompletionResult &X,
986  const CodeCompletionResult &Y) {
987  return !(Y < X);
988 }
989 
990 inline bool operator>=(const CodeCompletionResult &X,
991  const CodeCompletionResult &Y) {
992  return !(X < Y);
993 }
994 
995 /// Abstract interface for a consumer of code-completion
996 /// information.
998 protected:
1000 
1001 public:
1003  public:
1004  /// Describes the type of overload candidate.
1006  /// The candidate is a function declaration.
1008 
1009  /// The candidate is a function template.
1011 
1012  /// The "candidate" is actually a variable, expression, or block
1013  /// for which we only have a function prototype.
1015  };
1016 
1017  private:
1018  /// The kind of overload candidate.
1019  CandidateKind Kind;
1020 
1021  union {
1022  /// The function overload candidate, available when
1023  /// Kind == CK_Function.
1025 
1026  /// The function template overload candidate, available when
1027  /// Kind == CK_FunctionTemplate.
1029 
1030  /// The function type that describes the entity being called,
1031  /// when Kind == CK_FunctionType.
1033  };
1034 
1035  public:
1037  : Kind(CK_Function), Function(Function) {}
1038 
1041 
1043  : Kind(CK_FunctionType), Type(Type) {}
1044 
1045  /// Determine the kind of overload candidate.
1046  CandidateKind getKind() const { return Kind; }
1047 
1048  /// Retrieve the function overload candidate or the templated
1049  /// function declaration for a function template.
1050  FunctionDecl *getFunction() const;
1051 
1052  /// Retrieve the function template overload candidate.
1054  assert(getKind() == CK_FunctionTemplate && "Not a function template");
1055  return FunctionTemplate;
1056  }
1057 
1058  /// Retrieve the function type of the entity, regardless of how the
1059  /// function is stored.
1060  const FunctionType *getFunctionType() const;
1061 
1062  /// Create a new code-completion string that describes the function
1063  /// signature of this overload candidate.
1064  CodeCompletionString *CreateSignatureString(unsigned CurrentArg,
1065  Sema &S,
1066  CodeCompletionAllocator &Allocator,
1067  CodeCompletionTUInfo &CCTUInfo,
1068  bool IncludeBriefComments) const;
1069  };
1070 
1073 
1074  /// Whether the code-completion consumer wants to see macros.
1075  bool includeMacros() const {
1077  }
1078 
1079  /// Whether the code-completion consumer wants to see code patterns.
1080  bool includeCodePatterns() const {
1082  }
1083 
1084  /// Whether to include global (top-level) declaration results.
1086 
1087  /// Whether to include declarations in namespace contexts (including
1088  /// the global namespace). If this is false, `includeGlobals()` will be
1089  /// ignored.
1092  }
1093 
1094  /// Whether to include brief documentation comments within the set of
1095  /// code completions returned.
1096  bool includeBriefComments() const {
1098  }
1099 
1100  /// Whether to include completion items with small fix-its, e.g. change
1101  /// '.' to '->' on member access, etc.
1103 
1104  /// Hint whether to load data from the external AST in order to provide
1105  /// full results. If false, declarations from the preamble may be omitted.
1106  bool loadExternal() const {
1108  }
1109 
1110  /// Deregisters and destroys this code-completion consumer.
1111  virtual ~CodeCompleteConsumer();
1112 
1113  /// \name Code-completion filtering
1114  /// Check if the result should be filtered out.
1115  virtual bool isResultFilteredOut(StringRef Filter,
1116  CodeCompletionResult Results) {
1117  return false;
1118  }
1119 
1120  /// \name Code-completion callbacks
1121  //@{
1122  /// Process the finalized code-completion results.
1124  CodeCompletionContext Context,
1125  CodeCompletionResult *Results,
1126  unsigned NumResults) {}
1127 
1128  /// \param S the semantic-analyzer object for which code-completion is being
1129  /// done.
1130  ///
1131  /// \param CurrentArg the index of the current argument.
1132  ///
1133  /// \param Candidates an array of overload candidates.
1134  ///
1135  /// \param NumCandidates the number of overload candidates
1136  ///
1137  /// \param OpenParLoc location of the opening parenthesis of the argument
1138  /// list.
1139  virtual void ProcessOverloadCandidates(Sema &S, unsigned CurrentArg,
1140  OverloadCandidate *Candidates,
1141  unsigned NumCandidates,
1142  SourceLocation OpenParLoc) {}
1143  //@}
1144 
1145  /// Retrieve the allocator that will be used to allocate
1146  /// code completion strings.
1147  virtual CodeCompletionAllocator &getAllocator() = 0;
1148 
1150 };
1151 
1152 /// Get the documentation comment used to produce
1153 /// CodeCompletionString::BriefComment for RK_Declaration.
1154 const RawComment *getCompletionComment(const ASTContext &Ctx,
1155  const NamedDecl *Decl);
1156 
1157 /// Get the documentation comment used to produce
1158 /// CodeCompletionString::BriefComment for RK_Pattern.
1159 const RawComment *getPatternCompletionComment(const ASTContext &Ctx,
1160  const NamedDecl *Decl);
1161 
1162 /// Get the documentation comment used to produce
1163 /// CodeCompletionString::BriefComment for OverloadCandidate.
1164 const RawComment *
1165 getParameterComment(const ASTContext &Ctx,
1166  const CodeCompleteConsumer::OverloadCandidate &Result,
1167  unsigned ArgIndex);
1168 
1169 /// A simple code-completion consumer that prints the results it
1170 /// receives in a simple format.
1172  /// The raw output stream.
1173  raw_ostream &OS;
1174 
1175  CodeCompletionTUInfo CCTUInfo;
1176 
1177 public:
1178  /// Create a new printing code-completion consumer that prints its
1179  /// results to the given raw output stream.
1181  raw_ostream &OS)
1183  CCTUInfo(std::make_shared<GlobalCodeCompletionAllocator>()) {}
1184 
1185  /// Prints the finalized code-completion results.
1187  CodeCompletionResult *Results,
1188  unsigned NumResults) override;
1189 
1190  void ProcessOverloadCandidates(Sema &S, unsigned CurrentArg,
1191  OverloadCandidate *Candidates,
1192  unsigned NumCandidates,
1193  SourceLocation OpenParLoc) override;
1194 
1195  bool isResultFilteredOut(StringRef Filter, CodeCompletionResult Results) override;
1196 
1198  return CCTUInfo.getAllocator();
1199  }
1200 
1201  CodeCompletionTUInfo &getCodeCompletionTUInfo() override { return CCTUInfo; }
1202 };
1203 
1204 } // namespace clang
1205 
1206 #endif // LLVM_CLANG_SEMA_CODECOMPLETECONSUMER_H
clang::CodeCompleteConsumer::OverloadCandidate::OverloadCandidate
OverloadCandidate(FunctionDecl *Function)
Definition: CodeCompleteConsumer.h:1036
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::CCF_ExactTypeMatch
@ CCF_ExactTypeMatch
Divide by this factor when a code-completion result's type exactly matches the type we expect.
Definition: CodeCompleteConsumer.h:139
clang::CodeCompleteConsumer::OverloadCandidate::CK_FunctionTemplate
@ CK_FunctionTemplate
The candidate is a function template.
Definition: CodeCompleteConsumer.h:1010
clang::CodeCompleteOptions::IncludeMacros
unsigned IncludeMacros
Show macros in code completion results.
Definition: CodeCompleteOptions.h:18
clang::CodeCompletionContext::CCC_Other
@ CCC_Other
An unspecified code-completion context.
Definition: CodeCompleteConsumer.h:191
clang::CodeCompleteConsumer::OverloadCandidate::CK_Function
@ CK_Function
The candidate is a function declaration.
Definition: CodeCompleteConsumer.h:1007
clang::CodeCompleteConsumer::includeCodePatterns
bool includeCodePatterns() const
Whether the code-completion consumer wants to see code patterns.
Definition: CodeCompleteConsumer.h:1080
clang::CodeCompletionBuilder::addParentContext
void addParentContext(const DeclContext *DC)
Add the parent context information to this code completion.
Definition: CodeCompleteConsumer.cpp:465
clang::CodeCompletionResult::Keyword
const char * Keyword
When Kind == RK_Keyword, the string representing the keyword or symbol's spelling.
Definition: CodeCompleteConsumer.h:770
clang::CodeCompletionString::getAnnotationCount
unsigned getAnnotationCount() const
Retrieve the number of annotations for this code completion result.
Definition: CodeCompleteConsumer.cpp:300
clang::CodeCompletionString::getPriority
unsigned getPriority() const
Retrieve the priority of this code completion result.
Definition: CodeCompleteConsumer.h:610
clang::CodeCompletionContext::Kind
Kind
Definition: CodeCompleteConsumer.h:189
clang::CodeCompleteConsumer::loadExternal
bool loadExternal() const
Hint whether to load data from the external AST in order to provide full results.
Definition: CodeCompleteConsumer.h:1106
clang::CodeCompletionContext::CodeCompletionContext
CodeCompletionContext(Kind CCKind)
Construct a new code-completion context of the given kind.
Definition: CodeCompleteConsumer.h:367
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::CodeCompleteConsumer::includeNamespaceLevelDecls
bool includeNamespaceLevelDecls() const
Whether to include declarations in namespace contexts (including the global namespace).
Definition: CodeCompleteConsumer.h:1090
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
clang::CodeCompletionContext::CCC_Expression
@ CCC_Expression
Code completion occurred where an expression is expected.
Definition: CodeCompleteConsumer.h:221
clang::CodeCompletionResult::CodeCompletionResult
CodeCompletionResult(const IdentifierInfo *Macro, const MacroInfo *MI=nullptr, unsigned Priority=CCP_Macro)
Build a result that refers to a macro.
Definition: CodeCompleteConsumer.h:886
clang::CodeCompletionBuilder::AddOptionalChunk
void AddOptionalChunk(CodeCompletionString *Optional)
Add a new optional chunk.
Definition: CodeCompleteConsumer.cpp:439
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
clang::PrintingCodeCompleteConsumer
A simple code-completion consumer that prints the results it receives in a simple format.
Definition: CodeCompleteConsumer.h:1171
llvm::SmallVector
Definition: LLVM.h:38
clang::STC_Pointer
@ STC_Pointer
Definition: CodeCompleteConsumer.h:156
clang::CodeCompleteConsumer::OverloadCandidate::OverloadCandidate
OverloadCandidate(FunctionTemplateDecl *FunctionTemplateDecl)
Definition: CodeCompleteConsumer.h:1039
clang::SourceLocation
Encodes a location in the source.
Definition: SourceLocation.h:89
clang::CodeCompleteConsumer::includeGlobals
bool includeGlobals() const
Whether to include global (top-level) declaration results.
Definition: CodeCompleteConsumer.h:1085
clang::CodeCompleteOptions::IncludeBriefComments
unsigned IncludeBriefComments
Show brief documentation comments in code completion results.
Definition: CodeCompleteOptions.h:35
clang::CodeCompletionContext::CCC_Type
@ CCC_Type
Code completion occurred where a type name is expected.
Definition: CodeCompleteConsumer.h:271
clang::NamedDecl
This represents a decl that may have a name.
Definition: Decl.h:223
clang::CodeCompleteOptions::IncludeFixIts
unsigned IncludeFixIts
Include results after corrections (small fix-its), e.g.
Definition: CodeCompleteOptions.h:44
clang::CodeCompletionContext::CCC_ObjCImplementation
@ CCC_ObjCImplementation
Code completion occurred within an Objective-C implementation or category implementation.
Definition: CodeCompleteConsumer.h:207
clang::CodeCompletionResult::CreateCodeCompletionString
CodeCompletionString * CreateCodeCompletionString(Sema &S, const CodeCompletionContext &CCContext, CodeCompletionAllocator &Allocator, CodeCompletionTUInfo &CCTUInfo, bool IncludeBriefComments)
Create a new code-completion string that describes how to insert this result into a program.
Definition: SemaCodeComplete.cpp:3280
clang::QualType
A (possibly-)qualified type.
Definition: Type.h:661
clang::CCP_Constant
@ CCP_Constant
Priority for a constant value (e.g., enumerator).
Definition: CodeCompleteConsumer.h:87
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
AttributeLangSupport::C
@ C
Definition: SemaDeclAttr.cpp:52
clang::NestedNameSpecifier
Represents a C++ nested name specifier, such as "\::std::vector<int>::".
Definition: NestedNameSpecifier.h:50
clang::tooling::Filter
llvm::cl::opt< std::string > Filter
clang::CodeCompletionResult::CreateCodeCompletionStringForMacro
CodeCompletionString * CreateCodeCompletionStringForMacro(Preprocessor &PP, CodeCompletionAllocator &Allocator, CodeCompletionTUInfo &CCTUInfo)
Creates a new code-completion string for the macro result.
Definition: SemaCodeComplete.cpp:3288
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
clang::CCP_Macro
@ CCP_Macro
Priority for a preprocessor macro.
Definition: CodeCompleteConsumer.h:90
clang::CodeCompletionBuilder::getCodeCompletionTUInfo
CodeCompletionTUInfo & getCodeCompletionTUInfo() const
Definition: CodeCompleteConsumer.h:703
clang::CCD_ObjectQualifierMatch
@ CCD_ObjectQualifierMatch
The result is a C++ non-static member function whose qualifiers exactly match the object type on whic...
Definition: CodeCompleteConsumer.h:111
clang::CodeCompleteConsumer::OverloadCandidate::getKind
CandidateKind getKind() const
Determine the kind of overload candidate.
Definition: CodeCompleteConsumer.h:1046
Index.h
clang::CCP_CodePattern
@ CCP_CodePattern
Priority for a code pattern.
Definition: CodeCompleteConsumer.h:78
clang::CodeCompletionString::empty
bool empty() const
Definition: CodeCompleteConsumer.h:598
clang::CodeCompletionString::CK_RightParen
@ CK_RightParen
A right parenthesis (')').
Definition: CodeCompleteConsumer.h:478
clang::UsingShadowDecl
Represents a shadow declaration introduced into a scope by a (resolved) using declaration.
Definition: DeclCXX.h:3168
clang::CodeCompleteConsumer::getCodeCompletionTUInfo
virtual CodeCompletionTUInfo & getCodeCompletionTUInfo()=0
clang::CCP_EnumInCase
@ CCP_EnumInCase
Priority for an enumeration constant inside a switch whose condition is of the enumeration type.
Definition: CodeCompleteConsumer.h:61
clang::CodeCompletionBuilder::getBriefComment
const char * getBriefComment() const
Definition: CodeCompleteConsumer.h:739
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::CodeCompletionContext::CCC_IncludedFile
@ CCC_IncludedFile
Code completion inside the filename part of a include directive.
Definition: CodeCompleteConsumer.h:330
clang::CodeCompletionResult::Pattern
CodeCompletionString * Pattern
When Kind == RK_Pattern, the code-completion string that describes the completion text to insert.
Definition: CodeCompleteConsumer.h:774
clang::CCP_ObjC_cmd
@ CCP_ObjC_cmd
Priority for the Objective-C "_cmd" implicit parameter.
Definition: CodeCompleteConsumer.h:100
llvm::SmallPtrSet< DeclContext *, 8 >
clang::MacroInfo
Encapsulates the data about a macro definition (e.g.
Definition: MacroInfo.h:39
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
DeclSpec.h
clang::CodeCompletionResult::Priority
unsigned Priority
The priority of this particular code-completion result.
Definition: CodeCompleteConsumer.h:781
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::CXXScopeSpec
Represents a C++ nested-name-specifier or a global scope specifier.
Definition: DeclSpec.h:64
clang::CodeCompleteConsumer::OverloadCandidate::CandidateKind
CandidateKind
Describes the type of overload candidate.
Definition: CodeCompleteConsumer.h:1005
clang::STC_Void
@ STC_Void
Definition: CodeCompleteConsumer.h:158
clang::PrintingPolicy
Describes how types, statements, expressions, and declarations should be printed.
Definition: PrettyPrinter.h:59
clang::CodeCompletionResult::StartsNestedNameSpecifier
bool StartsNestedNameSpecifier
Whether this declaration is the beginning of a nested-name-specifier and, therefore,...
Definition: CodeCompleteConsumer.h:837
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:3541
clang::getMacroUsagePriority
unsigned getMacroUsagePriority(StringRef MacroName, const LangOptions &LangOpts, bool PreferredTypeIsPointer=false)
Determine the priority to be given to a macro code completion result with the given name.
Definition: SemaCodeComplete.cpp:3814
clang::CodeCompletionString::CK_HorizontalSpace
@ CK_HorizontalSpace
Horizontal whitespace (' ').
Definition: CodeCompleteConsumer.h:511
clang::CodeCompletionContext::getBaseType
QualType getBaseType() const
Retrieve the type of the base object in a member-access expression.
Definition: CodeCompleteConsumer.h:396
clang::CodeCompleteConsumer::OverloadCandidate::FunctionTemplate
FunctionTemplateDecl * FunctionTemplate
The function template overload candidate, available when Kind == CK_FunctionTemplate.
Definition: CodeCompleteConsumer.h:1028
clang::getPatternCompletionComment
const RawComment * getPatternCompletionComment(const ASTContext &Ctx, const NamedDecl *Decl)
Get the documentation comment used to produce CodeCompletionString::BriefComment for RK_Pattern.
Definition: SemaCodeComplete.cpp:3659
clang::CodeCompletionString::end
iterator end() const
Definition: CodeCompleteConsumer.h:597
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::STC_Block
@ STC_Block
Definition: CodeCompleteConsumer.h:152
clang::CCP_NestedNameSpecifier
@ CCP_NestedNameSpecifier
Priority for a nested-name-specifier.
Definition: CodeCompleteConsumer.h:93
clang::CodeCompletionResult
Captures a result of code completion.
Definition: CodeCompleteConsumer.h:746
clang::CCD_MethodAsProperty
@ CCD_MethodAsProperty
An Objective-C method being used as a property.
Definition: CodeCompleteConsumer.h:127
clang::Type
The base class of the type hierarchy.
Definition: Type.h:1478
clang::CodeCompletionString::ChunkKind
ChunkKind
The different kinds of "chunks" that can occur within a code completion string.
Definition: CodeCompleteConsumer.h:443
clang::CodeCompleteConsumer::OverloadCandidate::getFunctionTemplate
FunctionTemplateDecl * getFunctionTemplate() const
Retrieve the function template overload candidate.
Definition: CodeCompleteConsumer.h:1053
clang::CodeGen::AlignmentSource::Decl
@ Decl
The l-value was an access to a declared entity or something equivalently strong, like the address of ...
clang::CodeCompletionContext::CCC_ObjCCategoryName
@ CCC_ObjCCategoryName
Code completion where an Objective-C category name is expected.
Definition: CodeCompleteConsumer.h:327
clang::STC_Array
@ STC_Array
Definition: CodeCompleteConsumer.h:151
clang::CodeCompletionBuilder::CodeCompletionBuilder
CodeCompletionBuilder(CodeCompletionAllocator &Allocator, CodeCompletionTUInfo &CCTUInfo)
Definition: CodeCompleteConsumer.h:689
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::FunctionTemplateDecl
Declaration of a template function.
Definition: DeclTemplate.h:973
clang::CCD_ProbablyNotObjCCollection
@ CCD_ProbablyNotObjCCollection
Adjustment for KVC code pattern priorities when it doesn't look like the.
Definition: CodeCompleteConsumer.h:124
clang::CodeCompletionString::CK_LeftAngle
@ CK_LeftAngle
A left angle bracket ('<').
Definition: CodeCompleteConsumer.h:493
V
#define V(N, I)
Definition: ASTContext.h:3018
clang::CodeCompletionResult::ShadowDecl
const UsingShadowDecl * ShadowDecl
If this Decl was unshadowed by using declaration, this can store a pointer to the UsingShadowDecl whi...
Definition: CodeCompleteConsumer.h:856
clang::CodeCompleteConsumer::ProcessOverloadCandidates
virtual void ProcessOverloadCandidates(Sema &S, unsigned CurrentArg, OverloadCandidate *Candidates, unsigned NumCandidates, SourceLocation OpenParLoc)
Definition: CodeCompleteConsumer.h:1139
clang::operator>
bool operator>(DeclarationName LHS, DeclarationName RHS)
Ordering on two declaration names.
Definition: DeclarationName.h:546
clang::CodeCompletionBuilder::AddCurrentParameterChunk
void AddCurrentParameterChunk(const char *CurrentParameter)
Add a new current-parameter chunk.
Definition: CodeCompleteConsumer.cpp:455
clang::CodeCompletionResult::Availability
CXAvailabilityKind Availability
The availability of this result.
Definition: CodeCompleteConsumer.h:794
clang::CodeCompleteOptions::IncludeGlobals
unsigned IncludeGlobals
Show top-level decls in code completion results.
Definition: CodeCompleteOptions.h:24
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
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
CodeCompleteOptions.h
clang::CodeCompletionString::Chunk::CreateOptional
static Chunk CreateOptional(CodeCompletionString *Optional)
Create a new optional chunk.
Definition: CodeCompleteConsumer.cpp:253
clang::CodeCompleteOptions::IncludeCodePatterns
unsigned IncludeCodePatterns
Show code patterns in code completion results.
Definition: CodeCompleteOptions.h:21
clang::CodeCompletionBuilder
A builder class used to construct new code-completion strings.
Definition: CodeCompleteConsumer.h:671
CXCursor_NotImplemented
@ CXCursor_NotImplemented
Definition: Index.h:1904
clang::CodeCompletionResult::CodeCompletionResult
CodeCompletionResult(CodeCompletionString *Pattern, const NamedDecl *D, unsigned Priority)
Build a result that refers to a pattern with an associated declaration.
Definition: CodeCompleteConsumer.h:909
clang::ASTContext
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
Definition: ASTContext.h:187
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
clang::CodeCompletionString::getParentContextName
StringRef getParentContextName() const
Retrieve the name of the parent context.
Definition: CodeCompleteConsumer.h:622
clang::PrintingCodeCompleteConsumer::getCodeCompletionTUInfo
CodeCompletionTUInfo & getCodeCompletionTUInfo() override
Definition: CodeCompleteConsumer.h:1201
clang::CCP_Keyword
@ CCP_Keyword
Priority for a language keyword (that isn't any of the other categories).
Definition: CodeCompleteConsumer.h:75
clang::CodeCompleteConsumer::isResultFilteredOut
virtual bool isResultFilteredOut(StringRef Filter, CodeCompletionResult Results)
Definition: CodeCompleteConsumer.h:1115
clang::CodeCompleteConsumer::OverloadCandidate::Function
FunctionDecl * Function
The function overload candidate, available when Kind == CK_Function.
Definition: CodeCompleteConsumer.h:1024
clang::CanQualType
CanQual< Type > CanQualType
Represents a canonical, potentially-qualified type.
Definition: CanonicalType.h:212
clang::CCP_LocalDeclaration
@ CCP_LocalDeclaration
Priority for a declaration that is in the local scope.
Definition: CodeCompleteConsumer.h:67
clang::CodeCompletionContext::CCC_ObjCInterfaceName
@ CCC_ObjCInterfaceName
Code completion where the name of an Objective-C class is expected.
Definition: CodeCompleteConsumer.h:324
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
Type.h
clang::CodeCompletionContext::setCXXScopeSpecifier
void setCXXScopeSpecifier(CXXScopeSpec SS)
Sets the scope specifier that comes before the completion token.
Definition: CodeCompleteConsumer.h:408
clang::CodeCompletionString::CK_LeftParen
@ CK_LeftParen
A left parenthesis ('(').
Definition: CodeCompleteConsumer.h:475
clang::CCD_InBaseClass
@ CCD_InBaseClass
The result is in a base class.
Definition: CodeCompleteConsumer.h:107
clang::CodeCompleteConsumer::OverloadCandidate::CK_FunctionType
@ CK_FunctionType
The "candidate" is actually a variable, expression, or block for which we only have a function protot...
Definition: CodeCompleteConsumer.h:1014
clang::CodeCompletionString::Chunk::Optional
CodeCompletionString * Optional
The code completion string associated with a CK_Optional chunk.
Definition: CodeCompleteConsumer.h:534
clang::CodeCompletionContext::CCC_ObjCMessageReceiver
@ CCC_ObjCMessageReceiver
Code completion occurred where an Objective-C message receiver is expected.
Definition: CodeCompleteConsumer.h:225
clang::CodeCompletionResult::MacroDefInfo
const MacroInfo * MacroDefInfo
If the result is RK_Macro, this can store the information about the macro definition.
Definition: CodeCompleteConsumer.h:861
clang::CCP_Type
@ CCP_Type
Priority for a type.
Definition: CodeCompleteConsumer.h:84
clang::CodeCompletionResult::QualifierIsInformative
bool QualifierIsInformative
Whether this result was found via lookup into a base class.
Definition: CodeCompleteConsumer.h:833
clang::CodeCompletionContext::setPreferredType
void setPreferredType(QualType T)
Definition: CodeCompleteConsumer.h:392
clang::CodeCompletionBuilder::getAllocator
CodeCompletionAllocator & getAllocator() const
Retrieve the allocator into which the code completion strings should be allocated.
Definition: CodeCompleteConsumer.h:701
clang::CodeCompletionString::operator=
CodeCompletionString & operator=(const CodeCompletionString &)=delete
clang::getParameterComment
const RawComment * getParameterComment(const ASTContext &Ctx, const CodeCompleteConsumer::OverloadCandidate &Result, unsigned ArgIndex)
Get the documentation comment used to produce CodeCompletionString::BriefComment for OverloadCandidat...
Definition: SemaCodeComplete.cpp:3682
clang::CodeCompletionResult::StartParameter
unsigned StartParameter
Specifies which parameter (of a function, Objective-C method, macro, etc.) we should start with when ...
Definition: CodeCompleteConsumer.h:785
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
clang::CodeCompleteConsumer::OverloadCandidate::CreateSignatureString
CodeCompletionString * CreateSignatureString(unsigned CurrentArg, Sema &S, CodeCompletionAllocator &Allocator, CodeCompletionTUInfo &CCTUInfo, bool IncludeBriefComments) const
Create a new code-completion string that describes the function signature of this overload candidate.
Definition: SemaCodeComplete.cpp:3763
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::CodeCompleteConsumer::includeMacros
bool includeMacros() const
Whether the code-completion consumer wants to see macros.
Definition: CodeCompleteConsumer.h:1075
clang::CodeCompleteConsumer::ProcessCodeCompleteResults
virtual void ProcessCodeCompleteResults(Sema &S, CodeCompletionContext Context, CodeCompletionResult *Results, unsigned NumResults)
Process the finalized code-completion results.
Definition: CodeCompleteConsumer.h:1123
clang::CodeCompletionContext::CCC_OtherWithMacros
@ CCC_OtherWithMacros
An unspecified code-completion context where we should also add macro completions.
Definition: CodeCompleteConsumer.h:195
clang::CodeCompletionResult::createCodeCompletionStringForOverride
CodeCompletionString * createCodeCompletionStringForOverride(Preprocessor &PP, ASTContext &Ctx, CodeCompletionBuilder &Result, bool IncludeBriefComments, const CodeCompletionContext &CCContext, PrintingPolicy &Policy)
Definition: SemaCodeComplete.cpp:3396
clang::CodeCompletionBuilder::AddResultTypeChunk
void AddResultTypeChunk(const char *ResultType)
Add a new result-type chunk.
Definition: CodeCompleteConsumer.cpp:451
clang::CCP_SuperCompletion
@ CCP_SuperCompletion
Priority for a send-to-super completion.
Definition: CodeCompleteConsumer.h:64
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::CodeCompletionString::begin
iterator begin() const
Definition: CodeCompleteConsumer.h:596
clang::CodeCompleteOptions::IncludeNamespaceLevelDecls
unsigned IncludeNamespaceLevelDecls
Show decls in namespace (including the global namespace) in code completion results.
Definition: CodeCompleteOptions.h:32
clang::CodeCompletionString::operator[]
const Chunk & operator[](unsigned I) const
Definition: CodeCompleteConsumer.h:601
clang::CodeCompleteConsumer::OverloadCandidate
Definition: CodeCompleteConsumer.h:1002
clang::getSimplifiedTypeClass
SimplifiedTypeClass getSimplifiedTypeClass(CanQualType T)
Determine the simplified type class of the given canonical type.
Definition: SemaCodeComplete.cpp:842
clang::CodeCompletionResult::Declaration
const NamedDecl * Declaration
When Kind == RK_Declaration or RK_Pattern, the declaration we are referring to.
Definition: CodeCompleteConsumer.h:765
clang::PrintingCodeCompleteConsumer::PrintingCodeCompleteConsumer
PrintingCodeCompleteConsumer(const CodeCompleteOptions &CodeCompleteOpts, raw_ostream &OS)
Create a new printing code-completion consumer that prints its results to the given raw output stream...
Definition: CodeCompleteConsumer.h:1180
clang::CodeCompletionString::CK_RightBrace
@ CK_RightBrace
A right brace ('}').
Definition: CodeCompleteConsumer.h:490
clang::CodeCompletionTUInfo::getAllocatorRef
std::shared_ptr< GlobalCodeCompletionAllocator > getAllocatorRef() const
Definition: CodeCompleteConsumer.h:654
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::CCD_bool_in_ObjC
@ CCD_bool_in_ObjC
Adjustment to the "bool" type in Objective-C, where the typedef "BOOL" is preferred.
Definition: CodeCompleteConsumer.h:120
clang::operator<=
bool operator<=(DeclarationName LHS, DeclarationName RHS)
Ordering on two declaration names.
Definition: DeclarationName.h:552
clang::CodeCompletionContext::getCXXScopeSpecifier
llvm::Optional< const CXXScopeSpec * > getCXXScopeSpecifier()
Definition: CodeCompleteConsumer.h:422
false
#define false
Definition: stdbool.h:17
clang::CodeCompletionContext::CCC_PreprocessorExpression
@ CCC_PreprocessorExpression
Code completion occurred within a preprocessor expression.
Definition: CodeCompleteConsumer.h:292
clang::CodeCompletionBuilder::AddAnnotation
void AddAnnotation(const char *A)
Definition: CodeCompleteConsumer.h:734
clang::CodeCompletionContext::getKind
Kind getKind() const
Retrieve the kind of code-completion context.
Definition: CodeCompleteConsumer.h:386
CXCursor_MacroDefinition
@ CXCursor_MacroDefinition
Definition: Index.h:2654
CXAvailability_Available
@ CXAvailability_Available
The entity is available.
Definition: Index.h:129
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::CodeCompletionResult::Qualifier
NestedNameSpecifier * Qualifier
If the result should have a nested-name-specifier, this is it.
Definition: CodeCompleteConsumer.h:850
clang::CodeCompletionString::getTypedText
const char * getTypedText() const
Returns the text in the TypedText chunk.
Definition: CodeCompleteConsumer.cpp:338
llvm::ArrayRef
Definition: LLVM.h:34
clang::CodeCompletionContext::CCC_PreprocessorDirective
@ CCC_PreprocessorDirective
Code completion occurred where a preprocessor directive is expected.
Definition: CodeCompleteConsumer.h:296
clang::CodeCompleteConsumer::includeFixIts
bool includeFixIts() const
Whether to include completion items with small fix-its, e.g.
Definition: CodeCompleteConsumer.h:1102
clang::CodeCompletionContext::isUsingDeclaration
bool isUsingDeclaration() const
Definition: CodeCompleteConsumer.h:382
CXCursorKind
CXCursorKind
Describes the kind of entity that a cursor refers to.
Definition: Index.h:1706
clang::OverloadCandidate
OverloadCandidate - A single candidate in an overload set (C++ 13.3).
Definition: Overload.h:790
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
LLVM.h
clang::CodeCompletionResult::getKeyword
const char * getKeyword() const
Retrieve the keyword stored in this result.
Definition: CodeCompleteConsumer.h:927
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::CodeCompleteConsumer
Abstract interface for a consumer of code-completion information.
Definition: CodeCompleteConsumer.h:997
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::CodeCompletionResult::Hidden
bool Hidden
Whether this result is hidden by another name.
Definition: CodeCompleteConsumer.h:827
clang::CodeCompletionString::getAvailability
unsigned getAvailability() const
Retrieve the availability of this code completion result.
Definition: CodeCompleteConsumer.h:613
clang::CodeCompletionResult::CodeCompletionResult
CodeCompletionResult(CodeCompletionString *Pattern, unsigned Priority=CCP_CodePattern, CXCursorKind CursorKind=CXCursor_NotImplemented, CXAvailabilityKind Availability=CXAvailability_Available, const NamedDecl *D=nullptr)
Build a result that refers to a pattern.
Definition: CodeCompleteConsumer.h:896
clang::CodeCompletionResult::createCodeCompletionStringForDecl
CodeCompletionString * createCodeCompletionStringForDecl(Preprocessor &PP, ASTContext &Ctx, CodeCompletionBuilder &Result, bool IncludeBriefComments, const CodeCompletionContext &CCContext, PrintingPolicy &Policy)
Definition: SemaCodeComplete.cpp:3427
clang::CodeCompletionResult::Macro
const IdentifierInfo * Macro
When Kind == RK_Macro, the identifier that refers to a macro.
Definition: CodeCompleteConsumer.h:777
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::CodeCompletionResult::getDeclaration
const NamedDecl * getDeclaration() const
Retrieve the declaration stored in this result.
Definition: CodeCompleteConsumer.h:920
clang::CCF_SimilarTypeMatch
@ CCF_SimilarTypeMatch
Divide by this factor when a code-completion result's type is similar to the type we expect (e....
Definition: CodeCompleteConsumer.h:144
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:59
clang::SimplifiedTypeClass
SimplifiedTypeClass
A simplified classification of types used when determining "similar" types for code completion.
Definition: CodeCompleteConsumer.h:149
clang::STC_Function
@ STC_Function
Definition: CodeCompleteConsumer.h:153
Priority
int Priority
Definition: Format.cpp:2153
clang::CodeCompleteConsumer::CodeCompleteOpts
const CodeCompleteOptions CodeCompleteOpts
Definition: CodeCompleteConsumer.h:999
clang::STC_Other
@ STC_Other
Definition: CodeCompleteConsumer.h:155
clang::CodeCompletionString::CK_LeftBracket
@ CK_LeftBracket
A left bracket ('[').
Definition: CodeCompleteConsumer.h:481
clang::CodeCompletionContext::CodeCompletionContext
CodeCompletionContext(Kind CCKind, QualType T, ArrayRef< IdentifierInfo * > SelIdents=None)
Construct a new code-completion context of the given kind.
Definition: CodeCompleteConsumer.h:371
clang::ObjCPropertyAttribute::Kind
Kind
Definition: DeclObjCCommon.h:22
clang::CodeCompleteConsumer::includeBriefComments
bool includeBriefComments() const
Whether to include brief documentation comments within the set of code completions returned.
Definition: CodeCompleteConsumer.h:1096
clang::CodeCompletionString::getBriefComment
const char * getBriefComment() const
Definition: CodeCompleteConsumer.h:626
clang::CodeCompletionResult::RK_Pattern
@ RK_Pattern
Refers to a precomputed pattern.
Definition: CodeCompleteConsumer.h:760
clang::CodeCompletionResult::ResultKind
ResultKind
Describes the kind of result generated.
Definition: CodeCompleteConsumer.h:749
clang::CodeCompletionBuilder::CodeCompletionBuilder
CodeCompletionBuilder(CodeCompletionAllocator &Allocator, CodeCompletionTUInfo &CCTUInfo, unsigned Priority, CXAvailabilityKind Availability)
Definition: CodeCompleteConsumer.h:693
std
Definition: Format.h:3580
clang::CodeCompletionResult::AllParametersAreInformative
bool AllParametersAreInformative
Whether all parameters (of a function, Objective-C method, etc.) should be considered "informative".
Definition: CodeCompleteConsumer.h:841
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::CCP_Declaration
@ CCP_Declaration
Priority for a non-type declaration.
Definition: CodeCompleteConsumer.h:81
clang::STC_Record
@ STC_Record
Definition: CodeCompleteConsumer.h:157
clang
Dataflow Directional Tag Classes.
Definition: CalledOnceCheck.h:17
Text
StringRef Text
Definition: Format.cpp:2150
clang::getCompletionComment
const RawComment * getCompletionComment(const ASTContext &Ctx, const NamedDecl *Decl)
Get the documentation comment used to produce CodeCompletionString::BriefComment for RK_Declaration.
Definition: SemaCodeComplete.cpp:3641
clang::CCP_NextInitializer
@ CCP_NextInitializer
Priority for the next initialization in a constructor initializer list.
Definition: CodeCompleteConsumer.h:57
clang::CodeCompleteConsumer::getAllocator
virtual CodeCompletionAllocator & getAllocator()=0
Retrieve the allocator that will be used to allocate code completion strings.
clang::CodeCompleteConsumer::OverloadCandidate::OverloadCandidate
OverloadCandidate(const FunctionType *Type)
Definition: CodeCompleteConsumer.h:1042
clang::CodeCompletionResult::InBaseClass
bool InBaseClass
Whether this is a class member from base class.
Definition: CodeCompleteConsumer.h:830
MacroInfo.h
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::getDeclUsageType
QualType getDeclUsageType(ASTContext &C, const NamedDecl *ND)
Determine the type that this declaration will have if it is used as a type or in an expression.
Definition: SemaCodeComplete.cpp:911
clang::CCD_SelectorMatch
@ CCD_SelectorMatch
The selector of the given message exactly matches the selector of the current method,...
Definition: CodeCompleteConsumer.h:116
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::CodeCompletionContext::setIsUsingDeclaration
void setIsUsingDeclaration(bool V)
Definition: CodeCompleteConsumer.h:383
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
clang::CodeCompletionTUInfo::CodeCompletionTUInfo
CodeCompletionTUInfo(std::shared_ptr< GlobalCodeCompletionAllocator > Allocator)
Definition: CodeCompleteConsumer.h:650
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
clang::CodeCompleteOptions
Options controlling the behavior of code completion.
Definition: CodeCompleteOptions.h:15
clang::CCD_BlockPropertySetter
@ CCD_BlockPropertySetter
An Objective-C block property completed as a setter with a block placeholder.
Definition: CodeCompleteConsumer.h:131
clang::CodeCompletionAllocator
An allocator used specifically for the purpose of code completion.
Definition: CodeCompleteConsumer.h:636
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::CodeCompleteConsumer::OverloadCandidate::Type
const FunctionType * Type
The function type that describes the entity being called, when Kind == CK_FunctionType.
Definition: CodeCompleteConsumer.h:1032
clang::CodeCompletionResult::DeclaringEntity
bool DeclaringEntity
Whether we're completing a declaration of the given entity, rather than a use of that entity.
Definition: CodeCompleteConsumer.h:845
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::CodeCompletionResult::Kind
ResultKind Kind
The kind of result stored here.
Definition: CodeCompleteConsumer.h:788
clang::CodeCompletionString::CK_Optional
@ CK_Optional
A code completion string that is entirely optional.
Definition: CodeCompleteConsumer.h:456
clang::GlobalCodeCompletionAllocator
Allocator for a cached set of global code completions.
Definition: CodeCompleteConsumer.h:643
clang::getCursorKindForDecl
CXCursorKind getCursorKindForDecl(const Decl *D)
Determine the libclang cursor kind associated with the given declaration.
Definition: SemaCodeComplete.cpp:3837
clang::CodeCompletionContext
The context in which code completion occurred, so that the code-completion consumer can process the r...
Definition: CodeCompleteConsumer.h:187
clang::CodeCompleteOptions::LoadExternal
unsigned LoadExternal
Hint whether to load data from the external AST to provide full results.
Definition: CodeCompleteOptions.h:40
clang::CCP_MemberDeclaration
@ CCP_MemberDeclaration
Priority for a member declaration found from the current method or member function.
Definition: CodeCompleteConsumer.h:71
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::operator>=
bool operator>=(DeclarationName LHS, DeclarationName RHS)
Ordering on two declaration names.
Definition: DeclarationName.h:558
clang::CodeCompletionString::CK_LeftBrace
@ CK_LeftBrace
A left brace ('{').
Definition: CodeCompleteConsumer.h:487
clang::CodeCompletionResult::FixIts
std::vector< FixItHint > FixIts
Fix-its that must be applied before inserting the text for the corresponding completion.
Definition: CodeCompleteConsumer.h:824
clang::CodeCompletionTUInfo::getParentName
StringRef getParentName(const DeclContext *DC)
Definition: CodeCompleteConsumer.cpp:358
clang::Preprocessor
Engages in a tight little dance with the lexer to efficiently preprocess tokens.
Definition: Preprocessor.h:129
clang::STC_ObjectiveC
@ STC_ObjectiveC
Definition: CodeCompleteConsumer.h:154
clang::CodeCompletionTUInfo::getAllocator
CodeCompletionAllocator & getAllocator() const
Definition: CodeCompleteConsumer.h:658
clang::CodeCompletionResult::CodeCompletionResult
CodeCompletionResult(const char *Keyword, unsigned Priority=CCP_Keyword)
Build a result that refers to a keyword or symbol.
Definition: CodeCompleteConsumer.h:879
clang::CodeCompleteConsumer::CodeCompleteConsumer
CodeCompleteConsumer(const CodeCompleteOptions &CodeCompleteOpts)
Definition: CodeCompleteConsumer.h:1071
clang::CodeCompletionString::CK_Colon
@ CK_Colon
A colon (':').
Definition: CodeCompleteConsumer.h:502
clang::CodeCompletionBuilder::getParentName
StringRef getParentName() const
Definition: CodeCompleteConsumer.h:742
clang::CodeCompletionResult::CursorKind
CXCursorKind CursorKind
The cursor kind that describes this result.
Definition: CodeCompleteConsumer.h:791
clang::CodeCompletionContext::getPreferredType
QualType getPreferredType() const
Retrieve the type that this expression would prefer to have, e.g., if the expression is a variable in...
Definition: CodeCompleteConsumer.h:391
clang::CodeCompletionResult::CodeCompletionResult
CodeCompletionResult(const NamedDecl *Declaration, unsigned Priority, NestedNameSpecifier *Qualifier=nullptr, bool QualifierIsInformative=false, bool Accessible=true, std::vector< FixItHint > FixIts=std::vector< FixItHint >())
Build a result that refers to a declaration.
Definition: CodeCompleteConsumer.h:864
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:1821
clang::CCP_Unlikely
@ CCP_Unlikely
Priority for a result that isn't likely to be what the user wants, but is included for completeness.
Definition: CodeCompleteConsumer.h:97
clang::CodeCompletionContext::CCC_UnionTag
@ CCC_UnionTag
Code completion occurred after the "union" keyword, to indicate a union name.
Definition: CodeCompleteConsumer.h:257
clang::CodeCompletionString::size
unsigned size() const
Definition: CodeCompleteConsumer.h:599
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::PrintingCodeCompleteConsumer::getAllocator
CodeCompletionAllocator & getAllocator() override
Retrieve the allocator that will be used to allocate code completion strings.
Definition: CodeCompleteConsumer.h:1197
clang::CodeCompletionContext::CCC_MacroName
@ CCC_MacroName
Code completion occurred where an macro is being defined.
Definition: CodeCompleteConsumer.h:285
clang::CodeCompletionContext::addVisitedContext
void addVisitedContext(DeclContext *Ctx)
Adds a visited context.
Definition: CodeCompleteConsumer.h:413
clang::CodeCompletionContext::getVisitedContexts
const VisitedContextSet & getVisitedContexts() const
Retrieves all visited contexts.
Definition: CodeCompleteConsumer.h:418
clang::CodeCompletionContext::CCC_ObjCClassMessage
@ CCC_ObjCClassMessage
Code completion where an Objective-C class message is expected.
Definition: CodeCompleteConsumer.h:320
clang::CodeCompletionTUInfo
Definition: CodeCompleteConsumer.h:645
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::STC_Arithmetic
@ STC_Arithmetic
Definition: CodeCompleteConsumer.h:150
clang::CodeCompletionContext::getSelIdents
ArrayRef< IdentifierInfo * > getSelIdents() const
Retrieve the Objective-C selector identifiers.
Definition: CodeCompleteConsumer.h:399