summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaCodeComplete.cpp
diff options
context:
space:
mode:
authorJohn McCall <rjmccall@apple.com>2011-08-06 07:30:58 +0000
committerJohn McCall <rjmccall@apple.com>2011-08-06 07:30:58 +0000
commit5939b16135daffa4b132226b6e4ff596588834c3 (patch)
treefb46a23bfee2973d2318b03617cfb3a0eab4c6ce /clang/lib/Sema/SemaCodeComplete.cpp
parent6d45a01b67df7e4e1b88bec8bc724a46caefb1a5 (diff)
downloadbcm5719-llvm-5939b16135daffa4b132226b6e4ff596588834c3.tar.gz
bcm5719-llvm-5939b16135daffa4b132226b6e4ff596588834c3.zip
Do l-value conversion, etc., on a switch condition expression in
ActOnStartOfSwitchStmt (i.e. before binding up a full-expression) instead of ActOnFinishSwitchStmt. Among other things, this means that property l-values are properly converted inside the full-expression. llvm-svn: 137014
Diffstat (limited to 'clang/lib/Sema/SemaCodeComplete.cpp')
-rw-r--r--clang/lib/Sema/SemaCodeComplete.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/clang/lib/Sema/SemaCodeComplete.cpp b/clang/lib/Sema/SemaCodeComplete.cpp
index 5803a76600b..cff9d6b4a94 100644
--- a/clang/lib/Sema/SemaCodeComplete.cpp
+++ b/clang/lib/Sema/SemaCodeComplete.cpp
@@ -3448,10 +3448,11 @@ void Sema::CodeCompleteTypeQualifiers(DeclSpec &DS) {
void Sema::CodeCompleteCase(Scope *S) {
if (getCurFunction()->SwitchStack.empty() || !CodeCompleter)
return;
-
+
SwitchStmt *Switch = getCurFunction()->SwitchStack.back();
- if (!Switch->getCond()->getType()->isEnumeralType()) {
- CodeCompleteExpressionData Data(Switch->getCond()->getType());
+ QualType type = Switch->getCond()->IgnoreImplicit()->getType();
+ if (!type->isEnumeralType()) {
+ CodeCompleteExpressionData Data(type);
Data.IntegralConstantExpression = true;
CodeCompleteExpression(S, Data);
return;
@@ -3459,7 +3460,7 @@ void Sema::CodeCompleteCase(Scope *S) {
// Code-complete the cases of a switch statement over an enumeration type
// by providing the list of
- EnumDecl *Enum = Switch->getCond()->getType()->getAs<EnumType>()->getDecl();
+ EnumDecl *Enum = type->castAs<EnumType>()->getDecl();
// Determine which enumerators we have already seen in the switch statement.
// FIXME: Ideally, we would also be able to look *past* the code-completion
OpenPOWER on IntegriCloud