aboutsummaryrefslogtreecommitdiff
path: root/tools/CIndex/CIndexCodeCompletion.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2010-01-10 23:08:15 +0000
committerDouglas Gregor <dgregor@apple.com>2010-01-10 23:08:15 +0000
commit01dfea02d1da297e8b53db8eea3d3cc652acda8d (patch)
tree9d885cedd56d6e8501b7fa0311eb8fd53ef84819 /tools/CIndex/CIndexCodeCompletion.cpp
parent36fcde0ae10b88494d870dc4d39b4bd6681890e0 (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 'tools/CIndex/CIndexCodeCompletion.cpp')
-rw-r--r--tools/CIndex/CIndexCodeCompletion.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/tools/CIndex/CIndexCodeCompletion.cpp b/tools/CIndex/CIndexCodeCompletion.cpp
index f4ed6cafb0..f70479b5e8 100644
--- a/tools/CIndex/CIndexCodeCompletion.cpp
+++ b/tools/CIndex/CIndexCodeCompletion.cpp
@@ -62,6 +62,16 @@ clang_getCompletionChunkKind(CXCompletionString completion_string,
return CXCompletionChunk_RightAngle;
case CodeCompletionString::CK_Comma:
return CXCompletionChunk_Comma;
+ case CodeCompletionString::CK_Colon:
+ return CXCompletionChunk_Colon;
+ case CodeCompletionString::CK_SemiColon:
+ return CXCompletionChunk_SemiColon;
+ case CodeCompletionString::CK_Equal:
+ return CXCompletionChunk_Equal;
+ case CodeCompletionString::CK_HorizontalSpace:
+ return CXCompletionChunk_HorizontalSpace;
+ case CodeCompletionString::CK_VerticalSpace:
+ return CXCompletionChunk_VerticalSpace;
}
// Should be unreachable, but let's be careful.
@@ -90,6 +100,11 @@ const char *clang_getCompletionChunkText(CXCompletionString completion_string,
case CodeCompletionString::CK_RightAngle:
case CodeCompletionString::CK_Comma:
case CodeCompletionString::CK_ResultType:
+ case CodeCompletionString::CK_Colon:
+ case CodeCompletionString::CK_SemiColon:
+ case CodeCompletionString::CK_Equal:
+ case CodeCompletionString::CK_HorizontalSpace:
+ case CodeCompletionString::CK_VerticalSpace:
return (*CCStr)[chunk_number].Text;
case CodeCompletionString::CK_Optional:
@@ -124,6 +139,11 @@ clang_getCompletionChunkCompletionString(CXCompletionString completion_string,
case CodeCompletionString::CK_RightAngle:
case CodeCompletionString::CK_Comma:
case CodeCompletionString::CK_ResultType:
+ case CodeCompletionString::CK_Colon:
+ case CodeCompletionString::CK_SemiColon:
+ case CodeCompletionString::CK_Equal:
+ case CodeCompletionString::CK_HorizontalSpace:
+ case CodeCompletionString::CK_VerticalSpace:
return 0;
case CodeCompletionString::CK_Optional: