aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/SemaCodeComplete.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2010-10-18 22:01:46 +0000
committerDouglas Gregor <dgregor@apple.com>2010-10-18 22:01:46 +0000
commita5450a097e83072c0e545ccd8df8b07e172f1b09 (patch)
tree4785815ba7eeadb7722132fece0598ccd1d759b1 /lib/Sema/SemaCodeComplete.cpp
parent75ab414cac234145b81fa7d2dfcf15271d8db87d (diff)
Fix the translation of the PCC_ForInit code-completion context for
C++/C99/Objective-C, so that we properly include types. This fix affects global caching of code-completion results; without caching, the behavior was already correct. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@116757 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaCodeComplete.cpp')
-rw-r--r--lib/Sema/SemaCodeComplete.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/Sema/SemaCodeComplete.cpp b/lib/Sema/SemaCodeComplete.cpp
index 5b340d2e7b..b07ae391f9 100644
--- a/lib/Sema/SemaCodeComplete.cpp
+++ b/lib/Sema/SemaCodeComplete.cpp
@@ -2589,9 +2589,15 @@ static enum CodeCompletionContext::Kind mapCodeCompletionContext(Sema &S,
case Sema::PCC_RecoveryInFunction:
return CodeCompletionContext::CCC_Recovery;
-
- case Sema::PCC_Expression:
+
case Sema::PCC_ForInit:
+ if (S.getLangOptions().CPlusPlus || S.getLangOptions().C99 ||
+ S.getLangOptions().ObjC1)
+ return CodeCompletionContext::CCC_ParenthesizedExpression;
+ else
+ return CodeCompletionContext::CCC_Expression;
+
+ case Sema::PCC_Expression:
case Sema::PCC_Condition:
return CodeCompletionContext::CCC_Expression;