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.
llvm-svn: 116757
diff --git a/clang/lib/Sema/SemaCodeComplete.cpp b/clang/lib/Sema/SemaCodeComplete.cpp
index 5b340d2..b07ae39 100644
--- a/clang/lib/Sema/SemaCodeComplete.cpp
+++ b/clang/lib/Sema/SemaCodeComplete.cpp
@@ -2589,9 +2589,15 @@
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;