diff options
author | Douglas Gregor <dgregor@apple.com> | 2010-01-10 23:08:15 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2010-01-10 23:08:15 +0000 |
commit | 01dfea02d1da297e8b53db8eea3d3cc652acda8d (patch) | |
tree | 9d885cedd56d6e8501b7fa0311eb8fd53ef84819 /lib/Sema/CodeCompleteConsumer.cpp | |
parent | 36fcde0ae10b88494d870dc4d39b4bd6681890e0 (diff) |
Improve code completion by introducing patterns for the various C and
C++ grammatical constructs that show up in top-level (namespace-level)
declarations, member declarations, template declarations, statements,
expressions, conditions, etc. For example, we now provide a pattern
for
static_cast<type>(expr)
when we can have an expression, or
using namespace identifier;
when we can have a using directive.
Also, improves the results of code completion at the beginning of a
top-level declaration. Previously, we would see value names (function
names, global variables, etc.); now we see types, namespace names,
etc., but no values.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93134 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/CodeCompleteConsumer.cpp')
-rw-r--r-- | lib/Sema/CodeCompleteConsumer.cpp | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/lib/Sema/CodeCompleteConsumer.cpp b/lib/Sema/CodeCompleteConsumer.cpp index b9b85dfb80..0a00b4226d 100644 --- a/lib/Sema/CodeCompleteConsumer.cpp +++ b/lib/Sema/CodeCompleteConsumer.cpp @@ -85,6 +85,26 @@ CodeCompletionString::Chunk::Chunk(ChunkKind Kind, llvm::StringRef Text) case CK_Comma: this->Text = ", "; break; + + case CK_Colon: + this->Text = ": "; + break; + + case CK_SemiColon: + this->Text = ";"; + break; + + case CK_Equal: + this->Text = " = "; + break; + + case CK_HorizontalSpace: + this->Text = " "; + break; + + case CK_VerticalSpace: + this->Text = "\n"; + break; } } @@ -140,6 +160,11 @@ CodeCompletionString::Chunk CodeCompletionString::Chunk::Clone() const { case CK_LeftAngle: case CK_RightAngle: case CK_Comma: + case CK_Colon: + case CK_SemiColon: + case CK_Equal: + case CK_HorizontalSpace: + case CK_VerticalSpace: return Chunk(Kind, Text); case CK_Optional: { @@ -177,6 +202,11 @@ CodeCompletionString::Chunk::Destroy() { case CK_LeftAngle: case CK_RightAngle: case CK_Comma: + case CK_Colon: + case CK_SemiColon: + case CK_Equal: + case CK_HorizontalSpace: + case CK_VerticalSpace: break; } } @@ -271,6 +301,11 @@ void CodeCompletionString::Serialize(llvm::raw_ostream &OS) const { case CK_LeftAngle: case CK_RightAngle: case CK_Comma: + case CK_Colon: + case CK_SemiColon: + case CK_Equal: + case CK_HorizontalSpace: + case CK_VerticalSpace: break; } } @@ -326,6 +361,11 @@ CodeCompletionString *CodeCompletionString::Deserialize(const char *&Str, case CK_LeftAngle: case CK_RightAngle: case CK_Comma: + case CK_Colon: + case CK_SemiColon: + case CK_Equal: + case CK_HorizontalSpace: + case CK_VerticalSpace: Result->AddChunk(Chunk(Kind)); break; } |