[cfe-commits] r112028 - in /cfe/trunk: include/clang/Frontend/ASTUnit.h include/clang/Sema/CodeCompleteConsumer.h include/clang/Sema/Sema.h lib/Frontend/ASTUnit.cpp lib/Sema/CodeCompleteConsumer.cpp lib/Sema/SemaCodeComplete.cpp tools/libclang/CIndexCodeCompletion.cpp
John McCall
rjmccall at apple.com
Tue Aug 24 23:19:51 PDT 2010
Author: rjmccall
Date: Wed Aug 25 01:19:51 2010
New Revision: 112028
URL: http://llvm.org/viewvc/llvm-project?rev=112028&view=rev
Log:
Teach Sema to live without CodeCompleteConsumer.h.
Modified:
cfe/trunk/include/clang/Frontend/ASTUnit.h
cfe/trunk/include/clang/Sema/CodeCompleteConsumer.h
cfe/trunk/include/clang/Sema/Sema.h
cfe/trunk/lib/Frontend/ASTUnit.cpp
cfe/trunk/lib/Sema/CodeCompleteConsumer.cpp
cfe/trunk/lib/Sema/SemaCodeComplete.cpp
cfe/trunk/tools/libclang/CIndexCodeCompletion.cpp
Modified: cfe/trunk/include/clang/Frontend/ASTUnit.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Frontend/ASTUnit.h?rev=112028&r1=112027&r2=112028&view=diff
==============================================================================
--- cfe/trunk/include/clang/Frontend/ASTUnit.h (original)
+++ cfe/trunk/include/clang/Frontend/ASTUnit.h Wed Aug 25 01:19:51 2010
@@ -17,6 +17,7 @@
#include "clang/Index/ASTLocation.h"
#include "clang/Serialization/ASTBitCodes.h"
#include "clang/Sema/Sema.h"
+#include "clang/Sema/CodeCompleteConsumer.h"
#include "clang/Lex/PreprocessingRecord.h"
#include "clang/Basic/SourceManager.h"
#include "clang/Basic/FileManager.h"
Modified: cfe/trunk/include/clang/Sema/CodeCompleteConsumer.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/CodeCompleteConsumer.h?rev=112028&r1=112027&r2=112028&view=diff
==============================================================================
--- cfe/trunk/include/clang/Sema/CodeCompleteConsumer.h (original)
+++ cfe/trunk/include/clang/Sema/CodeCompleteConsumer.h Wed Aug 25 01:19:51 2010
@@ -22,7 +22,7 @@
#include <string>
namespace llvm {
-class raw_ostream;
+ class raw_ostream;
}
namespace clang {
@@ -109,7 +109,7 @@
/// of this macro is a pointer type.
unsigned getMacroUsagePriority(llvm::StringRef MacroName,
bool PreferredTypeIsPointer = false);
-
+
class FunctionDecl;
class FunctionType;
class FunctionTemplateDecl;
@@ -428,6 +428,151 @@
/// \returns true if successful, false otherwise.
bool Deserialize(const char *&Str, const char *StrEnd);
};
+
+/// \brief Captures a result of code completion.
+class CodeCompletionResult {
+public:
+ /// \brief Describes the kind of result generated.
+ enum ResultKind {
+ RK_Declaration = 0, //< Refers to a declaration
+ RK_Keyword, //< Refers to a keyword or symbol.
+ RK_Macro, //< Refers to a macro
+ RK_Pattern //< Refers to a precomputed pattern.
+ };
+
+ /// \brief The kind of result stored here.
+ ResultKind Kind;
+
+ union {
+ /// \brief When Kind == RK_Declaration, the declaration we are referring
+ /// to.
+ NamedDecl *Declaration;
+
+ /// \brief When Kind == RK_Keyword, the string representing the keyword
+ /// 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;
+ };
+
+ /// \brief The priority of this particular code-completion result.
+ unsigned Priority;
+
+ /// \brief The cursor kind that describes this result.
+ CXCursorKind CursorKind;
+
+ /// \brief The availability of this result.
+ CXAvailabilityKind Availability;
+
+ /// \brief Specifies 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;
+
+ /// \brief Whether this result was found via lookup into a base class.
+ bool QualifierIsInformative : 1;
+
+ /// \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 Whether we're completing a declaration of the given entity,
+ /// rather than a use of that entity.
+ bool DeclaringEntity : 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.
+ NestedNameSpecifier *Qualifier;
+
+ /// \brief Build a result that refers to a declaration.
+ CodeCompletionResult(NamedDecl *Declaration,
+ NestedNameSpecifier *Qualifier = 0,
+ bool QualifierIsInformative = false)
+ : Kind(RK_Declaration), Declaration(Declaration),
+ Priority(getPriorityFromDecl(Declaration)),
+ Availability(CXAvailability_Available), StartParameter(0),
+ Hidden(false), QualifierIsInformative(QualifierIsInformative),
+ StartsNestedNameSpecifier(false), AllParametersAreInformative(false),
+ DeclaringEntity(false), Qualifier(Qualifier) {
+ computeCursorKindAndAvailability();
+ }
+
+ /// \brief Build a result that refers to a keyword or symbol.
+ CodeCompletionResult(const char *Keyword, unsigned Priority = CCP_Keyword)
+ : Kind(RK_Keyword), Keyword(Keyword), Priority(Priority),
+ Availability(CXAvailability_Available),
+ StartParameter(0), Hidden(false), QualifierIsInformative(0),
+ StartsNestedNameSpecifier(false), AllParametersAreInformative(false),
+ DeclaringEntity(false), Qualifier(0) {
+ computeCursorKindAndAvailability();
+ }
+
+ /// \brief Build a result that refers to a macro.
+ CodeCompletionResult(IdentifierInfo *Macro, unsigned Priority = CCP_Macro)
+ : Kind(RK_Macro), Macro(Macro), Priority(Priority),
+ Availability(CXAvailability_Available), StartParameter(0),
+ Hidden(false), QualifierIsInformative(0),
+ StartsNestedNameSpecifier(false), AllParametersAreInformative(false),
+ DeclaringEntity(false), Qualifier(0) {
+ computeCursorKindAndAvailability();
+ }
+
+ /// \brief Build a result that refers to a pattern.
+ CodeCompletionResult(CodeCompletionString *Pattern,
+ unsigned Priority = CCP_CodePattern,
+ CXCursorKind CursorKind = CXCursor_NotImplemented,
+ CXAvailabilityKind Availability = CXAvailability_Available)
+ : Kind(RK_Pattern), Pattern(Pattern), Priority(Priority),
+ CursorKind(CursorKind), Availability(Availability), StartParameter(0),
+ Hidden(false), QualifierIsInformative(0),
+ StartsNestedNameSpecifier(false), AllParametersAreInformative(false),
+ DeclaringEntity(false), Qualifier(0)
+ {
+ }
+
+ /// \brief Retrieve the declaration stored in this result.
+ NamedDecl *getDeclaration() const {
+ assert(Kind == RK_Declaration && "Not a declaration result");
+ return Declaration;
+ }
+
+ /// \brief Retrieve the keyword stored in this result.
+ const char *getKeyword() const {
+ assert(Kind == RK_Keyword && "Not a keyword result");
+ return Keyword;
+ }
+
+ /// \brief Create a new code-completion string that describes how to insert
+ /// this result into a program.
+ ///
+ /// \param S The semantic analysis that created the result.
+ ///
+ /// \param Result If non-NULL, the already-allocated, empty
+ /// code-completion string that will be populated with the
+ /// appropriate code completion string for this result.
+ CodeCompletionString *CreateCodeCompletionString(Sema &S,
+ CodeCompletionString *Result = 0);
+
+ void Destroy();
+
+ /// brief Determine a base priority for the given declaration.
+ static unsigned getPriorityFromDecl(NamedDecl *ND);
+
+private:
+ void computeCursorKindAndAvailability();
+};
llvm::raw_ostream &operator<<(llvm::raw_ostream &OS,
const CodeCompletionString &CCS);
@@ -452,149 +597,6 @@
bool OutputIsBinary;
public:
- /// \brief Captures a result of code completion.
- struct Result {
- /// \brief Describes the kind of result generated.
- enum ResultKind {
- RK_Declaration = 0, //< Refers to a declaration
- RK_Keyword, //< Refers to a keyword or symbol.
- RK_Macro, //< Refers to a macro
- RK_Pattern //< Refers to a precomputed pattern.
- };
-
- /// \brief The kind of result stored here.
- ResultKind Kind;
-
- union {
- /// \brief When Kind == RK_Declaration, the declaration we are referring
- /// to.
- NamedDecl *Declaration;
-
- /// \brief When Kind == RK_Keyword, the string representing the keyword
- /// 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;
- };
-
- /// \brief The priority of this particular code-completion result.
- unsigned Priority;
-
- /// \brief The cursor kind that describes this result.
- CXCursorKind CursorKind;
-
- /// \brief The availability of this result.
- CXAvailabilityKind Availability;
-
- /// \brief Specifies 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;
-
- /// \brief Whether this result was found via lookup into a base class.
- bool QualifierIsInformative : 1;
-
- /// \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 Whether we're completing a declaration of the given entity,
- /// rather than a use of that entity.
- bool DeclaringEntity : 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.
- NestedNameSpecifier *Qualifier;
-
- /// \brief Build a result that refers to a declaration.
- Result(NamedDecl *Declaration,
- NestedNameSpecifier *Qualifier = 0,
- bool QualifierIsInformative = false)
- : Kind(RK_Declaration), Declaration(Declaration),
- Priority(getPriorityFromDecl(Declaration)),
- Availability(CXAvailability_Available), StartParameter(0),
- Hidden(false), QualifierIsInformative(QualifierIsInformative),
- StartsNestedNameSpecifier(false), AllParametersAreInformative(false),
- DeclaringEntity(false), Qualifier(Qualifier) {
- computeCursorKindAndAvailability();
- }
-
- /// \brief Build a result that refers to a keyword or symbol.
- Result(const char *Keyword, unsigned Priority = CCP_Keyword)
- : Kind(RK_Keyword), Keyword(Keyword), Priority(Priority),
- Availability(CXAvailability_Available),
- StartParameter(0), Hidden(false), QualifierIsInformative(0),
- StartsNestedNameSpecifier(false), AllParametersAreInformative(false),
- DeclaringEntity(false), Qualifier(0) {
- computeCursorKindAndAvailability();
- }
-
- /// \brief Build a result that refers to a macro.
- Result(IdentifierInfo *Macro, unsigned Priority = CCP_Macro)
- : Kind(RK_Macro), Macro(Macro), Priority(Priority),
- Availability(CXAvailability_Available), StartParameter(0),
- Hidden(false), QualifierIsInformative(0),
- StartsNestedNameSpecifier(false), AllParametersAreInformative(false),
- DeclaringEntity(false), Qualifier(0) {
- computeCursorKindAndAvailability();
- }
-
- /// \brief Build a result that refers to a pattern.
- Result(CodeCompletionString *Pattern, unsigned Priority = CCP_CodePattern,
- CXCursorKind CursorKind = CXCursor_NotImplemented,
- CXAvailabilityKind Availability = CXAvailability_Available)
- : Kind(RK_Pattern), Pattern(Pattern), Priority(Priority),
- CursorKind(CursorKind), Availability(Availability), StartParameter(0),
- Hidden(false), QualifierIsInformative(0),
- StartsNestedNameSpecifier(false), AllParametersAreInformative(false),
- DeclaringEntity(false), Qualifier(0)
- {
- }
-
- /// \brief Retrieve the declaration stored in this result.
- NamedDecl *getDeclaration() const {
- assert(Kind == RK_Declaration && "Not a declaration result");
- return Declaration;
- }
-
- /// \brief Retrieve the keyword stored in this result.
- const char *getKeyword() const {
- assert(Kind == RK_Keyword && "Not a keyword result");
- return Keyword;
- }
-
- /// \brief Create a new code-completion string that describes how to insert
- /// this result into a program.
- ///
- /// \param S The semantic analysis that created the result.
- ///
- /// \param Result If non-NULL, the already-allocated, empty
- /// code-completion string that will be populated with the
- /// appropriate code completion string for this result.
- CodeCompletionString *CreateCodeCompletionString(Sema &S,
- CodeCompletionString *Result = 0);
-
- void Destroy();
-
- /// brief Determine a base priority for the given declaration.
- static unsigned getPriorityFromDecl(NamedDecl *ND);
-
- private:
- void computeCursorKindAndAvailability();
- };
-
class OverloadCandidate {
public:
/// \brief Describes the type of overload candidate.
@@ -687,7 +689,7 @@
/// \brief Process the finalized code-completion results.
virtual void ProcessCodeCompleteResults(Sema &S,
CodeCompletionContext Context,
- Result *Results,
+ CodeCompletionResult *Results,
unsigned NumResults) { }
/// \param S the semantic-analyzer object for which code-completion is being
@@ -703,7 +705,7 @@
unsigned NumCandidates) { }
//@}
};
-
+
/// \brief A simple code-completion consumer that prints the results it
/// receives in a simple format.
class PrintingCodeCompleteConsumer : public CodeCompleteConsumer {
@@ -722,7 +724,7 @@
/// \brief Prints the finalized code-completion results.
virtual void ProcessCodeCompleteResults(Sema &S,
CodeCompletionContext Context,
- Result *Results,
+ CodeCompletionResult *Results,
unsigned NumResults);
virtual void ProcessOverloadCandidates(Sema &S, unsigned CurrentArg,
@@ -748,14 +750,14 @@
/// \brief Prints the finalized code-completion results.
virtual void ProcessCodeCompleteResults(Sema &S,
CodeCompletionContext Context,
- Result *Results,
+ CodeCompletionResult *Results,
unsigned NumResults);
virtual void ProcessOverloadCandidates(Sema &S, unsigned CurrentArg,
OverloadCandidate *Candidates,
unsigned NumCandidates);
};
-
+
} // end namespace clang
#endif // LLVM_CLANG_SEMA_CODECOMPLETECONSUMER_H
Modified: cfe/trunk/include/clang/Sema/Sema.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/Sema.h?rev=112028&r1=112027&r2=112028&view=diff
==============================================================================
--- cfe/trunk/include/clang/Sema/Sema.h (original)
+++ cfe/trunk/include/clang/Sema/Sema.h Wed Aug 25 01:19:51 2010
@@ -17,7 +17,6 @@
#include "clang/Sema/Action.h"
#include "clang/Sema/AnalysisBasedWarnings.h"
-#include "clang/Sema/CodeCompleteConsumer.h"
#include "clang/Sema/IdentifierResolver.h"
#include "clang/Sema/ObjCMethodList.h"
#include "clang/Sema/SemaDiagnostic.h"
@@ -54,6 +53,8 @@
class ClassTemplateDecl;
class ClassTemplatePartialSpecializationDecl;
class ClassTemplateSpecializationDecl;
+ class CodeCompleteConsumer;
+ class CodeCompletionResult;
class Decl;
class DeclAccessPair;
class DeclContext;
@@ -4497,7 +4498,7 @@
MacroInfo *MacroInfo,
unsigned Argument);
void GatherGlobalCodeCompletions(
- llvm::SmallVectorImpl<CodeCompleteConsumer::Result> &Results);
+ llvm::SmallVectorImpl<CodeCompletionResult> &Results);
//@}
//===--------------------------------------------------------------------===//
Modified: cfe/trunk/lib/Frontend/ASTUnit.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/ASTUnit.cpp?rev=112028&r1=112027&r2=112028&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/ASTUnit.cpp (original)
+++ cfe/trunk/lib/Frontend/ASTUnit.cpp Wed Aug 25 01:19:51 2010
@@ -176,7 +176,7 @@
ClearCachedCompletionResults();
// Gather the set of global code completions.
- typedef CodeCompleteConsumer::Result Result;
+ typedef CodeCompletionResult Result;
llvm::SmallVector<Result, 8> Results;
TheSema->GatherGlobalCodeCompletions(Results);
@@ -1506,7 +1506,7 @@
virtual void ProcessCodeCompleteResults(Sema &S,
CodeCompletionContext Context,
- Result *Results,
+ CodeCompletionResult *Results,
unsigned NumResults);
virtual void ProcessOverloadCandidates(Sema &S, unsigned CurrentArg,
@@ -1520,7 +1520,7 @@
/// \brief Helper function that computes which global names are hidden by the
/// local code-completion results.
void CalculateHiddenNames(const CodeCompletionContext &Context,
- CodeCompleteConsumer::Result *Results,
+ CodeCompletionResult *Results,
unsigned NumResults,
ASTContext &Ctx,
llvm::StringSet<> &HiddenNames) {
@@ -1556,7 +1556,7 @@
return;
}
- typedef CodeCompleteConsumer::Result Result;
+ typedef CodeCompletionResult Result;
for (unsigned I = 0; I != NumResults; ++I) {
if (Results[I].Kind != Result::RK_Declaration)
continue;
@@ -1590,7 +1590,7 @@
void AugmentedCodeCompleteConsumer::ProcessCodeCompleteResults(Sema &S,
CodeCompletionContext Context,
- Result *Results,
+ CodeCompletionResult *Results,
unsigned NumResults) {
// Merge the results we were given with the results we cached.
bool AddedResult = false;
@@ -1601,7 +1601,7 @@
// Contains the set of names that are hidden by "local" completion results.
llvm::StringSet<> HiddenNames;
llvm::SmallVector<CodeCompletionString *, 4> StringsToDestroy;
- typedef CodeCompleteConsumer::Result Result;
+ typedef CodeCompletionResult Result;
llvm::SmallVector<Result, 8> AllResults;
for (ASTUnit::cached_completion_iterator
C = AST.cached_completion_begin(),
Modified: cfe/trunk/lib/Sema/CodeCompleteConsumer.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/CodeCompleteConsumer.cpp?rev=112028&r1=112027&r2=112028&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/CodeCompleteConsumer.cpp (original)
+++ cfe/trunk/lib/Sema/CodeCompleteConsumer.cpp Wed Aug 25 01:19:51 2010
@@ -376,14 +376,14 @@
return true;
}
-void CodeCompleteConsumer::Result::Destroy() {
+void CodeCompletionResult::Destroy() {
if (Kind == RK_Pattern) {
delete Pattern;
Pattern = 0;
}
}
-unsigned CodeCompleteConsumer::Result::getPriorityFromDecl(NamedDecl *ND) {
+unsigned CodeCompletionResult::getPriorityFromDecl(NamedDecl *ND) {
if (!ND)
return CCP_Unlikely;
@@ -441,13 +441,13 @@
void
PrintingCodeCompleteConsumer::ProcessCodeCompleteResults(Sema &SemaRef,
CodeCompletionContext Context,
- Result *Results,
+ CodeCompletionResult *Results,
unsigned NumResults) {
// Print the results.
for (unsigned I = 0; I != NumResults; ++I) {
OS << "COMPLETION: ";
switch (Results[I].Kind) {
- case Result::RK_Declaration:
+ case CodeCompletionResult::RK_Declaration:
OS << Results[I].Declaration;
if (Results[I].Hidden)
OS << " (Hidden)";
@@ -460,11 +460,11 @@
OS << '\n';
break;
- case Result::RK_Keyword:
+ case CodeCompletionResult::RK_Keyword:
OS << Results[I].Keyword << '\n';
break;
- case Result::RK_Macro: {
+ case CodeCompletionResult::RK_Macro: {
OS << Results[I].Macro->getName();
if (CodeCompletionString *CCS
= Results[I].CreateCodeCompletionString(SemaRef)) {
@@ -475,7 +475,7 @@
break;
}
- case Result::RK_Pattern: {
+ case CodeCompletionResult::RK_Pattern: {
OS << "Pattern : "
<< Results[I].Pattern->getAsString() << '\n';
break;
@@ -498,7 +498,7 @@
}
}
-void CodeCompleteConsumer::Result::computeCursorKindAndAvailability() {
+void CodeCompletionResult::computeCursorKindAndAvailability() {
switch (Kind) {
case RK_Declaration:
// Set the availability based on attributes.
@@ -599,17 +599,17 @@
}
break;
- case Result::RK_Macro:
+ case RK_Macro:
Availability = CXAvailability_Available;
CursorKind = CXCursor_MacroDefinition;
break;
- case Result::RK_Keyword:
+ case RK_Keyword:
Availability = CXAvailability_Available;
CursorKind = CXCursor_NotImplemented;
break;
- case Result::RK_Pattern:
+ case RK_Pattern:
// Do nothing: Patterns can come with cursor kinds!
break;
}
@@ -618,7 +618,7 @@
void
CIndexCodeCompleteConsumer::ProcessCodeCompleteResults(Sema &SemaRef,
CodeCompletionContext Context,
- Result *Results,
+ CodeCompletionResult *Results,
unsigned NumResults) {
// Print the results.
for (unsigned I = 0; I != NumResults; ++I) {
Modified: cfe/trunk/lib/Sema/SemaCodeComplete.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaCodeComplete.cpp?rev=112028&r1=112027&r2=112028&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaCodeComplete.cpp (original)
+++ cfe/trunk/lib/Sema/SemaCodeComplete.cpp Wed Aug 25 01:19:51 2010
@@ -40,7 +40,7 @@
/// filtered out (returns false).
typedef bool (ResultBuilder::*LookupFilter)(NamedDecl *) const;
- typedef CodeCompleteConsumer::Result Result;
+ typedef CodeCompletionResult Result;
private:
/// \brief The actual results we have found.
@@ -1001,7 +1001,7 @@
/// \brief Add type specifiers for the current language as keyword results.
static void AddTypeSpecifierResults(const LangOptions &LangOpts,
ResultBuilder &Results) {
- typedef CodeCompleteConsumer::Result Result;
+ typedef CodeCompletionResult Result;
Results.AddResult(Result("short", CCP_Type));
Results.AddResult(Result("long", CCP_Type));
Results.AddResult(Result("signed", CCP_Type));
@@ -1079,7 +1079,7 @@
static void AddStorageSpecifiers(Action::ParserCompletionContext CCC,
const LangOptions &LangOpts,
ResultBuilder &Results) {
- typedef CodeCompleteConsumer::Result Result;
+ typedef CodeCompletionResult Result;
// Note: we don't suggest either "auto" or "register", because both
// are pointless as storage specifiers. Elsewhere, we suggest "auto"
// in C++0x as a type specifier.
@@ -1090,7 +1090,7 @@
static void AddFunctionSpecifiers(Action::ParserCompletionContext CCC,
const LangOptions &LangOpts,
ResultBuilder &Results) {
- typedef CodeCompleteConsumer::Result Result;
+ typedef CodeCompletionResult Result;
switch (CCC) {
case Action::PCC_Class:
case Action::PCC_MemberTemplate:
@@ -1141,7 +1141,7 @@
Pattern->AddPlaceholderChunk("type");
Pattern->AddChunk(CodeCompletionString::CK_HorizontalSpace);
Pattern->AddPlaceholderChunk("name");
- Results.AddResult(CodeCompleteConsumer::Result(Pattern));
+ Results.AddResult(CodeCompletionResult(Pattern));
}
static bool WantTypesInContext(Action::ParserCompletionContext CCC,
@@ -1178,7 +1178,7 @@
Scope *S,
Sema &SemaRef,
ResultBuilder &Results) {
- typedef CodeCompleteConsumer::Result Result;
+ typedef CodeCompletionResult Result;
switch (CCC) {
case Action::PCC_Namespace:
if (SemaRef.getLangOptions().CPlusPlus) {
@@ -1942,7 +1942,7 @@
/// how to use this result, or NULL to indicate that the string or name of the
/// result is all that is needed.
CodeCompletionString *
-CodeCompleteConsumer::Result::CreateCodeCompletionString(Sema &S,
+CodeCompletionResult::CreateCodeCompletionString(Sema &S,
CodeCompletionString *Result) {
typedef CodeCompletionString::Chunk Chunk;
@@ -2231,7 +2231,7 @@
namespace {
struct SortCodeCompleteResult {
- typedef CodeCompleteConsumer::Result Result;
+ typedef CodeCompletionResult Result;
/// \brief Retrieve the name that should be used to order a result.
///
@@ -2306,7 +2306,7 @@
static void AddMacroResults(Preprocessor &PP, ResultBuilder &Results,
bool TargetTypeIsPointer = false) {
- typedef CodeCompleteConsumer::Result Result;
+ typedef CodeCompletionResult Result;
Results.EnterNewScope();
for (Preprocessor::macro_iterator M = PP.macro_begin(),
@@ -2321,7 +2321,7 @@
static void AddPrettyFunctionResults(const LangOptions &LangOpts,
ResultBuilder &Results) {
- typedef CodeCompleteConsumer::Result Result;
+ typedef CodeCompletionResult Result;
Results.EnterNewScope();
Results.AddResult(Result("__PRETTY_FUNCTION__", CCP_Constant));
@@ -2334,7 +2334,7 @@
static void HandleCodeCompleteResults(Sema *S,
CodeCompleteConsumer *CodeCompleter,
CodeCompletionContext Context,
- CodeCompleteConsumer::Result *Results,
+ CodeCompletionResult *Results,
unsigned NumResults) {
std::stable_sort(Results, Results + NumResults, SortCodeCompleteResult());
@@ -2385,7 +2385,7 @@
void Sema::CodeCompleteOrdinaryName(Scope *S,
ParserCompletionContext CompletionContext) {
- typedef CodeCompleteConsumer::Result Result;
+ typedef CodeCompletionResult Result;
ResultBuilder Results(*this);
// Determine how to filter results, e.g., so that the names of
@@ -2464,7 +2464,7 @@
void Sema::CodeCompleteDeclarator(Scope *S,
bool AllowNonIdentifiers,
bool AllowNestedNameSpecifiers) {
- typedef CodeCompleteConsumer::Result Result;
+ typedef CodeCompletionResult Result;
ResultBuilder Results(*this);
Results.EnterNewScope();
@@ -2517,7 +2517,7 @@
/// expressions.
void Sema::CodeCompleteExpression(Scope *S,
const CodeCompleteExpressionData &Data) {
- typedef CodeCompleteConsumer::Result Result;
+ typedef CodeCompletionResult Result;
ResultBuilder Results(*this);
if (Data.ObjCCollection)
@@ -2568,7 +2568,7 @@
bool AllowCategories,
DeclContext *CurContext,
ResultBuilder &Results) {
- typedef CodeCompleteConsumer::Result Result;
+ typedef CodeCompletionResult Result;
// Add properties in this container.
for (ObjCContainerDecl::prop_iterator P = Container->prop_begin(),
@@ -2617,7 +2617,7 @@
if (!BaseE || !CodeCompleter)
return;
- typedef CodeCompleteConsumer::Result Result;
+ typedef CodeCompletionResult Result;
Expr *Base = static_cast<Expr *>(BaseE);
QualType BaseType = Base->getType();
@@ -2706,7 +2706,7 @@
if (!CodeCompleter)
return;
- typedef CodeCompleteConsumer::Result Result;
+ typedef CodeCompletionResult Result;
ResultBuilder::LookupFilter Filter = 0;
enum CodeCompletionContext::Kind ContextKind
= CodeCompletionContext::CCC_Other;
@@ -2824,7 +2824,7 @@
if (EnumeratorsSeen.count(*E))
continue;
- Results.AddResult(CodeCompleteConsumer::Result(*E, Qualifier),
+ Results.AddResult(CodeCompletionResult(*E, Qualifier),
CurContext, 0, false);
}
Results.ExitScope();
@@ -3043,7 +3043,7 @@
// If we aren't in class scope, we could see the "namespace" keyword.
if (!S->isClassScope())
- Results.AddResult(CodeCompleteConsumer::Result("namespace"));
+ Results.AddResult(CodeCompletionResult("namespace"));
// After "using", we can see anything that would start a
// nested-name-specifier.
@@ -3100,7 +3100,7 @@
for (std::map<NamespaceDecl *, NamespaceDecl *>::iterator
NS = OrigToLatest.begin(), NSEnd = OrigToLatest.end();
NS != NSEnd; ++NS)
- Results.AddResult(CodeCompleteConsumer::Result(NS->second, 0),
+ Results.AddResult(CodeCompletionResult(NS->second, 0),
CurContext, 0, false);
Results.ExitScope();
}
@@ -3128,7 +3128,7 @@
if (!CodeCompleter)
return;
- typedef CodeCompleteConsumer::Result Result;
+ typedef CodeCompletionResult Result;
ResultBuilder Results(*this, &ResultBuilder::IsType);
Results.EnterNewScope();
@@ -3159,7 +3159,7 @@
static void AddObjCImplementationResults(const LangOptions &LangOpts,
ResultBuilder &Results,
bool NeedAt) {
- typedef CodeCompleteConsumer::Result Result;
+ typedef CodeCompletionResult Result;
// Since we have an implementation, we can end it.
Results.AddResult(Result(OBJC_AT_KEYWORD_NAME(NeedAt,end)));
@@ -3184,7 +3184,7 @@
static void AddObjCInterfaceResults(const LangOptions &LangOpts,
ResultBuilder &Results,
bool NeedAt) {
- typedef CodeCompleteConsumer::Result Result;
+ typedef CodeCompletionResult Result;
// Since we have an interface or protocol, we can end it.
Results.AddResult(Result(OBJC_AT_KEYWORD_NAME(NeedAt,end)));
@@ -3202,7 +3202,7 @@
}
static void AddObjCTopLevelResults(ResultBuilder &Results, bool NeedAt) {
- typedef CodeCompleteConsumer::Result Result;
+ typedef CodeCompletionResult Result;
CodeCompletionString *Pattern = 0;
// @class name ;
@@ -3249,7 +3249,7 @@
void Sema::CodeCompleteObjCAtDirective(Scope *S, Decl *ObjCImpDecl,
bool InInterface) {
- typedef CodeCompleteConsumer::Result Result;
+ typedef CodeCompletionResult Result;
ResultBuilder Results(*this);
Results.EnterNewScope();
if (ObjCImpDecl)
@@ -3265,7 +3265,7 @@
}
static void AddObjCExpressionResults(ResultBuilder &Results, bool NeedAt) {
- typedef CodeCompleteConsumer::Result Result;
+ typedef CodeCompletionResult Result;
CodeCompletionString *Pattern = 0;
// @encode ( type-name )
@@ -3294,7 +3294,7 @@
}
static void AddObjCStatementResults(ResultBuilder &Results, bool NeedAt) {
- typedef CodeCompleteConsumer::Result Result;
+ typedef CodeCompletionResult Result;
CodeCompletionString *Pattern = 0;
if (Results.includeCodePatterns()) {
@@ -3344,7 +3344,7 @@
static void AddObjCVisibilityResults(const LangOptions &LangOpts,
ResultBuilder &Results,
bool NeedAt) {
- typedef CodeCompleteConsumer::Result Result;
+ typedef CodeCompletionResult Result;
Results.AddResult(Result(OBJC_AT_KEYWORD_NAME(NeedAt,private)));
Results.AddResult(Result(OBJC_AT_KEYWORD_NAME(NeedAt,protected)));
Results.AddResult(Result(OBJC_AT_KEYWORD_NAME(NeedAt,public)));
@@ -3419,34 +3419,34 @@
unsigned Attributes = ODS.getPropertyAttributes();
- typedef CodeCompleteConsumer::Result Result;
+ typedef CodeCompletionResult Result;
ResultBuilder Results(*this);
Results.EnterNewScope();
if (!ObjCPropertyFlagConflicts(Attributes, ObjCDeclSpec::DQ_PR_readonly))
- Results.AddResult(CodeCompleteConsumer::Result("readonly"));
+ Results.AddResult(CodeCompletionResult("readonly"));
if (!ObjCPropertyFlagConflicts(Attributes, ObjCDeclSpec::DQ_PR_assign))
- Results.AddResult(CodeCompleteConsumer::Result("assign"));
+ Results.AddResult(CodeCompletionResult("assign"));
if (!ObjCPropertyFlagConflicts(Attributes, ObjCDeclSpec::DQ_PR_readwrite))
- Results.AddResult(CodeCompleteConsumer::Result("readwrite"));
+ Results.AddResult(CodeCompletionResult("readwrite"));
if (!ObjCPropertyFlagConflicts(Attributes, ObjCDeclSpec::DQ_PR_retain))
- Results.AddResult(CodeCompleteConsumer::Result("retain"));
+ Results.AddResult(CodeCompletionResult("retain"));
if (!ObjCPropertyFlagConflicts(Attributes, ObjCDeclSpec::DQ_PR_copy))
- Results.AddResult(CodeCompleteConsumer::Result("copy"));
+ Results.AddResult(CodeCompletionResult("copy"));
if (!ObjCPropertyFlagConflicts(Attributes, ObjCDeclSpec::DQ_PR_nonatomic))
- Results.AddResult(CodeCompleteConsumer::Result("nonatomic"));
+ Results.AddResult(CodeCompletionResult("nonatomic"));
if (!ObjCPropertyFlagConflicts(Attributes, ObjCDeclSpec::DQ_PR_setter)) {
CodeCompletionString *Setter = new CodeCompletionString;
Setter->AddTypedTextChunk("setter");
Setter->AddTextChunk(" = ");
Setter->AddPlaceholderChunk("method");
- Results.AddResult(CodeCompleteConsumer::Result(Setter));
+ Results.AddResult(CodeCompletionResult(Setter));
}
if (!ObjCPropertyFlagConflicts(Attributes, ObjCDeclSpec::DQ_PR_getter)) {
CodeCompletionString *Getter = new CodeCompletionString;
Getter->AddTypedTextChunk("getter");
Getter->AddTextChunk(" = ");
Getter->AddPlaceholderChunk("method");
- Results.AddResult(CodeCompleteConsumer::Result(Getter));
+ Results.AddResult(CodeCompletionResult(Getter));
}
Results.ExitScope();
HandleCodeCompleteResults(this, CodeCompleter,
@@ -3508,7 +3508,7 @@
DeclContext *CurContext,
ResultBuilder &Results,
bool InOriginalClass = true) {
- typedef CodeCompleteConsumer::Result Result;
+ typedef CodeCompletionResult Result;
for (ObjCContainerDecl::method_iterator M = Container->meth_begin(),
MEnd = Container->meth_end();
M != MEnd; ++M) {
@@ -3575,7 +3575,7 @@
void Sema::CodeCompleteObjCPropertyGetter(Scope *S, Decl *ClassDecl,
Decl **Methods,
unsigned NumMethods) {
- typedef CodeCompleteConsumer::Result Result;
+ typedef CodeCompletionResult Result;
// Try to find the interface where getters might live.
ObjCInterfaceDecl *Class = dyn_cast_or_null<ObjCInterfaceDecl>(ClassDecl);
@@ -3615,7 +3615,7 @@
void Sema::CodeCompleteObjCPropertySetter(Scope *S, Decl *ObjCImplDecl,
Decl **Methods,
unsigned NumMethods) {
- typedef CodeCompleteConsumer::Result Result;
+ typedef CodeCompletionResult Result;
// Try to find the interface where setters might live.
ObjCInterfaceDecl *Class
@@ -3655,7 +3655,7 @@
}
void Sema::CodeCompleteObjCPassingType(Scope *S, ObjCDeclSpec &DS) {
- typedef CodeCompleteConsumer::Result Result;
+ typedef CodeCompletionResult Result;
ResultBuilder Results(*this);
Results.EnterNewScope();
@@ -3770,7 +3770,7 @@
}
void Sema::CodeCompleteObjCMessageReceiver(Scope *S) {
- typedef CodeCompleteConsumer::Result Result;
+ typedef CodeCompletionResult Result;
ResultBuilder Results(*this);
// Find anything that looks like it could be a message receiver.
@@ -3863,7 +3863,7 @@
void Sema::CodeCompleteObjCClassMessage(Scope *S, ParsedType Receiver,
IdentifierInfo **SelIdents,
unsigned NumSelIdents) {
- typedef CodeCompleteConsumer::Result Result;
+ typedef CodeCompletionResult Result;
ObjCInterfaceDecl *CDecl = 0;
// If the given name refers to an interface type, retrieve the
@@ -3926,7 +3926,7 @@
void Sema::CodeCompleteObjCInstanceMessage(Scope *S, ExprTy *Receiver,
IdentifierInfo **SelIdents,
unsigned NumSelIdents) {
- typedef CodeCompleteConsumer::Result Result;
+ typedef CodeCompletionResult Result;
Expr *RecExpr = static_cast<Expr *>(Receiver);
@@ -4045,7 +4045,7 @@
static void AddProtocolResults(DeclContext *Ctx, DeclContext *CurContext,
bool OnlyForwardDeclarations,
ResultBuilder &Results) {
- typedef CodeCompleteConsumer::Result Result;
+ typedef CodeCompletionResult Result;
for (DeclContext::decl_iterator D = Ctx->decls_begin(),
DEnd = Ctx->decls_end();
@@ -4110,7 +4110,7 @@
bool OnlyForwardDeclarations,
bool OnlyUnimplemented,
ResultBuilder &Results) {
- typedef CodeCompleteConsumer::Result Result;
+ typedef CodeCompletionResult Result;
for (DeclContext::decl_iterator D = Ctx->decls_begin(),
DEnd = Ctx->decls_end();
@@ -4185,7 +4185,7 @@
void Sema::CodeCompleteObjCInterfaceCategory(Scope *S,
IdentifierInfo *ClassName,
SourceLocation ClassNameLoc) {
- typedef CodeCompleteConsumer::Result Result;
+ typedef CodeCompletionResult Result;
ResultBuilder Results(*this);
@@ -4218,7 +4218,7 @@
void Sema::CodeCompleteObjCImplementationCategory(Scope *S,
IdentifierInfo *ClassName,
SourceLocation ClassNameLoc) {
- typedef CodeCompleteConsumer::Result Result;
+ typedef CodeCompletionResult Result;
// Find the corresponding interface. If we couldn't find the interface, the
// program itself is ill-formed. However, we'll try to be helpful still by
@@ -4255,7 +4255,7 @@
}
void Sema::CodeCompleteObjCPropertyDefinition(Scope *S, Decl *ObjCImpDecl) {
- typedef CodeCompleteConsumer::Result Result;
+ typedef CodeCompletionResult Result;
ResultBuilder Results(*this);
// Figure out where this @synthesize lives.
@@ -4292,7 +4292,7 @@
void Sema::CodeCompleteObjCPropertySynthesizeIvar(Scope *S,
IdentifierInfo *PropertyName,
Decl *ObjCImpDecl) {
- typedef CodeCompleteConsumer::Result Result;
+ typedef CodeCompletionResult Result;
ResultBuilder Results(*this);
// Figure out where this @synthesize lives.
@@ -4473,7 +4473,7 @@
}
// Add declarations or definitions for each of the known methods.
- typedef CodeCompleteConsumer::Result Result;
+ typedef CodeCompletionResult Result;
ResultBuilder Results(*this);
Results.EnterNewScope();
PrintingPolicy Policy(Context.PrintingPolicy);
@@ -4586,7 +4586,7 @@
}
// Build the set of methods we can see.
- typedef CodeCompleteConsumer::Result Result;
+ typedef CodeCompletionResult Result;
ResultBuilder Results(*this);
if (ReturnTy)
@@ -4872,7 +4872,7 @@
}
void Sema::GatherGlobalCodeCompletions(
- llvm::SmallVectorImpl<CodeCompleteConsumer::Result> &Results) {
+ llvm::SmallVectorImpl<CodeCompletionResult> &Results) {
ResultBuilder Builder(*this);
if (!CodeCompleter || CodeCompleter->includeGlobals()) {
Modified: cfe/trunk/tools/libclang/CIndexCodeCompletion.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/libclang/CIndexCodeCompletion.cpp?rev=112028&r1=112027&r2=112028&view=diff
==============================================================================
--- cfe/trunk/tools/libclang/CIndexCodeCompletion.cpp (original)
+++ cfe/trunk/tools/libclang/CIndexCodeCompletion.cpp Wed Aug 25 01:19:51 2010
@@ -569,7 +569,7 @@
virtual void ProcessCodeCompleteResults(Sema &S,
CodeCompletionContext Context,
- Result *Results,
+ CodeCompletionResult *Results,
unsigned NumResults) {
AllocatedResults.Results = new CXCompletionResult [NumResults];
AllocatedResults.NumResults = NumResults;
More information about the cfe-commits
mailing list