summaryrefslogtreecommitdiffstats
path: root/include/clang/Sema/CodeCompleteConsumer.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/clang/Sema/CodeCompleteConsumer.h')
-rw-r--r--include/clang/Sema/CodeCompleteConsumer.h53
1 files changed, 44 insertions, 9 deletions
diff --git a/include/clang/Sema/CodeCompleteConsumer.h b/include/clang/Sema/CodeCompleteConsumer.h
index 43ff686..ed74761 100644
--- a/include/clang/Sema/CodeCompleteConsumer.h
+++ b/include/clang/Sema/CodeCompleteConsumer.h
@@ -123,6 +123,9 @@ public:
/// \brief Create a new current-parameter chunk.
static Chunk CreateCurrentParameter(llvm::StringRef CurrentParameter);
+ /// \brief Clone the given chunk.
+ Chunk Clone() const;
+
/// \brief Destroy this chunk, deallocating any memory it owns.
void Destroy();
};
@@ -192,15 +195,21 @@ public:
/// \brief Add a new chunk.
void AddChunk(Chunk C) { Chunks.push_back(C); }
+ /// \brief Returns the text in the TypedText chunk.
+ const char *getTypedText() const;
+
/// \brief Retrieve a string representation of the code completion string,
/// which is mainly useful for debugging.
std::string getAsString() const;
+ /// \brief Clone this code-completion string.
+ CodeCompletionString *Clone() const;
+
/// \brief Serialize this code-completion string to the given stream.
void Serialize(llvm::raw_ostream &OS) const;
/// \brief Deserialize a code-completion string from the given string.
- static CodeCompletionString *Deserialize(llvm::StringRef &Str);
+ static CodeCompletionString *Deserialize(llvm::StringRef &Str);
};
llvm::raw_ostream &operator<<(llvm::raw_ostream &OS,
@@ -220,7 +229,8 @@ public:
enum ResultKind {
RK_Declaration = 0, //< Refers to a declaration
RK_Keyword, //< Refers to a keyword or symbol.
- RK_Macro //< Refers to a macro
+ RK_Macro, //< Refers to a macro
+ RK_Pattern //< Refers to a precomputed pattern.
};
/// \brief The kind of result stored here.
@@ -235,6 +245,10 @@ public:
/// or symbol's spelling.
const char *Keyword;
+ /// \brief When Kind == RK_Pattern, the code-completion string that
+ /// describes the completion text to insert.
+ CodeCompletionString *Pattern;
+
/// \brief When Kind == RK_Macro, the identifier that refers to a macro.
IdentifierInfo *Macro;
};
@@ -243,6 +257,10 @@ public:
/// result and progressively higher numbers representing poorer results.
unsigned Rank;
+ /// \brief Specifiers which parameter (of a function, Objective-C method,
+ /// macro, etc.) we should start with when formatting the result.
+ unsigned StartParameter;
+
/// \brief Whether this result is hidden by another name.
bool Hidden : 1;
@@ -252,7 +270,11 @@ public:
/// \brief Whether this declaration is the beginning of a
/// nested-name-specifier and, therefore, should be followed by '::'.
bool StartsNestedNameSpecifier : 1;
-
+
+ /// \brief Whether all parameters (of a function, Objective-C
+ /// method, etc.) should be considered "informative".
+ bool AllParametersAreInformative : 1;
+
/// \brief If the result should have a nested-name-specifier, this is it.
/// When \c QualifierIsInformative, the nested-name-specifier is
/// informative rather than required.
@@ -263,20 +285,31 @@ public:
NestedNameSpecifier *Qualifier = 0,
bool QualifierIsInformative = false)
: Kind(RK_Declaration), Declaration(Declaration), Rank(Rank),
- Hidden(false), QualifierIsInformative(QualifierIsInformative),
- StartsNestedNameSpecifier(false), Qualifier(Qualifier) { }
+ StartParameter(0), Hidden(false),
+ QualifierIsInformative(QualifierIsInformative),
+ StartsNestedNameSpecifier(false), AllParametersAreInformative(false),
+ Qualifier(Qualifier) { }
/// \brief Build a result that refers to a keyword or symbol.
Result(const char *Keyword, unsigned Rank)
- : Kind(RK_Keyword), Keyword(Keyword), Rank(Rank), Hidden(false),
- QualifierIsInformative(0), StartsNestedNameSpecifier(false),
+ : Kind(RK_Keyword), Keyword(Keyword), Rank(Rank), StartParameter(0),
+ Hidden(false), QualifierIsInformative(0),
+ StartsNestedNameSpecifier(false), AllParametersAreInformative(false),
Qualifier(0) { }
/// \brief Build a result that refers to a macro.
Result(IdentifierInfo *Macro, unsigned Rank)
- : Kind(RK_Macro), Macro(Macro), Rank(Rank), Hidden(false),
- QualifierIsInformative(0), StartsNestedNameSpecifier(false),
+ : Kind(RK_Macro), Macro(Macro), Rank(Rank), StartParameter(0),
+ Hidden(false), QualifierIsInformative(0),
+ StartsNestedNameSpecifier(false), AllParametersAreInformative(false),
Qualifier(0) { }
+
+ /// \brief Build a result that refers to a pattern.
+ Result(CodeCompletionString *Pattern, unsigned Rank)
+ : Kind(RK_Pattern), Pattern(Pattern), Rank(Rank), StartParameter(0),
+ Hidden(false), QualifierIsInformative(0),
+ StartsNestedNameSpecifier(false), AllParametersAreInformative(false),
+ Qualifier(0) { }
/// \brief Retrieve the declaration stored in this result.
NamedDecl *getDeclaration() const {
@@ -293,6 +326,8 @@ public:
/// \brief Create a new code-completion string that describes how to insert
/// this result into a program.
CodeCompletionString *CreateCodeCompletionString(Sema &S);
+
+ void Destroy();
};
class OverloadCandidate {
OpenPOWER on IntegriCloud