Clang Project

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