diff options
Diffstat (limited to 'include/clang/Sema/CodeCompleteConsumer.h')
-rw-r--r-- | include/clang/Sema/CodeCompleteConsumer.h | 34 |
1 files changed, 31 insertions, 3 deletions
diff --git a/include/clang/Sema/CodeCompleteConsumer.h b/include/clang/Sema/CodeCompleteConsumer.h index dee53dc14a8c..5d280b5608e7 100644 --- a/include/clang/Sema/CodeCompleteConsumer.h +++ b/include/clang/Sema/CodeCompleteConsumer.h @@ -18,6 +18,7 @@ #include "clang/AST/DeclBase.h" #include "clang/AST/Type.h" #include "clang/Sema/CodeCompleteOptions.h" +#include "clang/Sema/DeclSpec.h" #include "llvm/ADT/DenseMap.h" #include "llvm/ADT/SmallVector.h" #include "llvm/ADT/StringRef.h" @@ -280,6 +281,10 @@ private: /// \brief The identifiers for Objective-C selector parts. ArrayRef<IdentifierInfo *> SelIdents; + /// \brief The scope specifier that comes before the completion token e.g. + /// "a::b::" + llvm::Optional<CXXScopeSpec> ScopeSpecifier; + public: /// \brief Construct a new code-completion context of the given kind. CodeCompletionContext(enum Kind Kind) : Kind(Kind), SelIdents(None) { } @@ -315,8 +320,20 @@ public: /// \brief Determines whether we want C++ constructors as results within this /// context. bool wantConstructorResults() const; -}; + /// \brief Sets the scope specifier that comes before the completion token. + /// This is expected to be set in code completions on qualfied specifiers + /// (e.g. "a::b::"). + void setCXXScopeSpecifier(CXXScopeSpec SS) { + this->ScopeSpecifier = std::move(SS); + } + + llvm::Optional<const CXXScopeSpec *> getCXXScopeSpecifier() { + if (ScopeSpecifier) + return ScopeSpecifier.getPointer(); + return llvm::None; + } +}; /// \brief A "string" used to describe how code completion can /// be performed for an entity. @@ -777,6 +794,12 @@ public: CodeCompletionTUInfo &CCTUInfo, bool IncludeBriefComments); + /// \brief Retrieve the name that should be used to order a result. + /// + /// If the name needs to be constructed as a string, that string will be + /// saved into Saved and the returned StringRef will refer to it. + StringRef getOrderedName(std::string &Saved) const; + private: void computeCursorKindAndAvailability(bool Accessible = true); }; @@ -896,8 +919,13 @@ public: } /// \brief Whether to include global (top-level) declaration results. - bool includeGlobals() const { - return CodeCompleteOpts.IncludeGlobals; + bool includeGlobals() const { return CodeCompleteOpts.IncludeGlobals; } + + /// \brief Whether to include declarations in namespace contexts (including + /// the global namespace). If this is false, `includeGlobals()` will be + /// ignored. + bool includeNamespaceLevelDecls() const { + return CodeCompleteOpts.IncludeNamespaceLevelDecls; } /// \brief Whether to include brief documentation comments within the set of |