diff options
Diffstat (limited to 'include/clang/Sema/CodeCompleteConsumer.h')
-rw-r--r-- | include/clang/Sema/CodeCompleteConsumer.h | 37 |
1 files changed, 19 insertions, 18 deletions
diff --git a/include/clang/Sema/CodeCompleteConsumer.h b/include/clang/Sema/CodeCompleteConsumer.h index b128bd866903..a1ddec7520ad 100644 --- a/include/clang/Sema/CodeCompleteConsumer.h +++ b/include/clang/Sema/CodeCompleteConsumer.h @@ -13,13 +13,13 @@ #ifndef LLVM_CLANG_SEMA_CODECOMPLETECONSUMER_H #define LLVM_CLANG_SEMA_CODECOMPLETECONSUMER_H -#include "clang/AST/Type.h" +#include "clang-c/Index.h" #include "clang/AST/CanonicalType.h" +#include "clang/AST/Type.h" #include "clang/Sema/CodeCompleteOptions.h" #include "llvm/ADT/SmallVector.h" #include "llvm/ADT/StringRef.h" #include "llvm/Support/Allocator.h" -#include "clang-c/Index.h" #include <string> namespace clang { @@ -121,7 +121,7 @@ SimplifiedTypeClass getSimplifiedTypeClass(CanQualType T); /// \brief Determine the type that this declaration will have if it is used /// as a type or in an expression. -QualType getDeclUsageType(ASTContext &C, NamedDecl *ND); +QualType getDeclUsageType(ASTContext &C, const NamedDecl *ND); /// \brief Determine the priority to be given to a macro code completion result /// with the given name. @@ -138,7 +138,7 @@ unsigned getMacroUsagePriority(StringRef MacroName, /// \brief Determine the libclang cursor kind associated with the given /// declaration. -CXCursorKind getCursorKindForDecl(Decl *D); +CXCursorKind getCursorKindForDecl(const Decl *D); class FunctionDecl; class FunctionType; @@ -245,7 +245,8 @@ public: /// \brief Code completion in a parenthesized expression, which means that /// we may also have types here in C and Objective-C (as well as in C++). CCC_ParenthesizedExpression, - /// \brief Code completion where an Objective-C instance message is expcted. + /// \brief Code completion where an Objective-C instance message is + /// expected. CCC_ObjCInstanceMessage, /// \brief Code completion where an Objective-C class message is expected. CCC_ObjCClassMessage, @@ -530,7 +531,7 @@ class GlobalCodeCompletionAllocator }; class CodeCompletionTUInfo { - llvm::DenseMap<DeclContext *, StringRef> ParentNames; + llvm::DenseMap<const DeclContext *, StringRef> ParentNames; IntrusiveRefCntPtr<GlobalCodeCompletionAllocator> AllocatorRef; public: @@ -546,7 +547,7 @@ public: return *AllocatorRef; } - StringRef getParentName(DeclContext *DC); + StringRef getParentName(const DeclContext *DC); }; } // end namespace clang @@ -629,8 +630,9 @@ public: void AddAnnotation(const char *A) { Annotations.push_back(A); } /// \brief Add the parent context information to this code completion. - void addParentContext(DeclContext *DC); + void addParentContext(const DeclContext *DC); + const char *getBriefComment() const { return BriefComment; } void addBriefComment(StringRef Comment); StringRef getParentName() const { return ParentName; } @@ -649,7 +651,7 @@ public: /// \brief When Kind == RK_Declaration or RK_Pattern, the declaration we are /// referring to. In the latter case, the declaration might be NULL. - NamedDecl *Declaration; + const NamedDecl *Declaration; union { /// \brief When Kind == RK_Keyword, the string representing the keyword @@ -661,7 +663,7 @@ public: CodeCompletionString *Pattern; /// \brief When Kind == RK_Macro, the identifier that refers to a macro. - IdentifierInfo *Macro; + const IdentifierInfo *Macro; }; /// \brief The priority of this particular code-completion result. @@ -704,11 +706,12 @@ public: NestedNameSpecifier *Qualifier; /// \brief Build a result that refers to a declaration. - CodeCompletionResult(NamedDecl *Declaration, + CodeCompletionResult(const NamedDecl *Declaration, + unsigned Priority, NestedNameSpecifier *Qualifier = 0, bool QualifierIsInformative = false, bool Accessible = true) - : Declaration(Declaration), Priority(getPriorityFromDecl(Declaration)), + : Declaration(Declaration), Priority(Priority), StartParameter(0), Kind(RK_Declaration), Availability(CXAvailability_Available), Hidden(false), QualifierIsInformative(QualifierIsInformative), @@ -728,7 +731,8 @@ public: } /// \brief Build a result that refers to a macro. - CodeCompletionResult(IdentifierInfo *Macro, unsigned Priority = CCP_Macro) + CodeCompletionResult(const IdentifierInfo *Macro, + unsigned Priority = CCP_Macro) : Declaration(0), Macro(Macro), Priority(Priority), StartParameter(0), Kind(RK_Macro), CursorKind(CXCursor_MacroDefinition), Availability(CXAvailability_Available), Hidden(false), @@ -742,7 +746,7 @@ public: unsigned Priority = CCP_CodePattern, CXCursorKind CursorKind = CXCursor_NotImplemented, CXAvailabilityKind Availability = CXAvailability_Available, - NamedDecl *D = 0) + const NamedDecl *D = 0) : Declaration(D), Pattern(Pattern), Priority(Priority), StartParameter(0), Kind(RK_Pattern), CursorKind(CursorKind), Availability(Availability), Hidden(false), QualifierIsInformative(0), @@ -763,7 +767,7 @@ public: } /// \brief Retrieve the declaration stored in this result. - NamedDecl *getDeclaration() const { + const NamedDecl *getDeclaration() const { assert(Kind == RK_Declaration && "Not a declaration result"); return Declaration; } @@ -791,9 +795,6 @@ public: CodeCompletionTUInfo &CCTUInfo, bool IncludeBriefComments); - /// \brief Determine a base priority for the given declaration. - static unsigned getPriorityFromDecl(NamedDecl *ND); - private: void computeCursorKindAndAvailability(bool Accessible = true); }; |