summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2011-02-15 20:33:25 +0000
committerDouglas Gregor <dgregor@apple.com>2011-02-15 20:33:25 +0000
commit8003924d10596d34e0f580ea071dec8b45d8960e (patch)
tree1fdccd85f298deb4d2bd9d9f44a6e487347d4adb /clang/lib
parent6f93f63955123d87203427fb011a7f15cc6c0a47 (diff)
downloadbcm5719-llvm-8003924d10596d34e0f580ea071dec8b45d8960e.tar.gz
bcm5719-llvm-8003924d10596d34e0f580ea071dec8b45d8960e.zip
When code-completing within a list of declaration specifiers,
separately handle the case of a local declaration-specifier list, including all types in the set of options. Fixes <rdar://problem/8790735> and <rdar://problem/8662831>. llvm-svn: 125594
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/Parse/ParseDecl.cpp4
-rw-r--r--clang/lib/Sema/SemaCodeComplete.cpp8
2 files changed, 11 insertions, 1 deletions
diff --git a/clang/lib/Parse/ParseDecl.cpp b/clang/lib/Parse/ParseDecl.cpp
index b8150319398..bff4e184c2a 100644
--- a/clang/lib/Parse/ParseDecl.cpp
+++ b/clang/lib/Parse/ParseDecl.cpp
@@ -920,7 +920,9 @@ void Parser::ParseDeclarationSpecifiers(DeclSpec &DS,
return;
}
- if (TemplateInfo.Kind != ParsedTemplateInfo::NonTemplate)
+ if (getCurScope()->getFnParent() || getCurScope()->getBlockParent())
+ CCC = Sema::PCC_LocalDeclarationSpecifiers;
+ else if (TemplateInfo.Kind != ParsedTemplateInfo::NonTemplate)
CCC = DSContext == DSC_class? Sema::PCC_MemberTemplate
: Sema::PCC_Template;
else if (DSContext == DSC_class)
diff --git a/clang/lib/Sema/SemaCodeComplete.cpp b/clang/lib/Sema/SemaCodeComplete.cpp
index cf088007c88..e7a9a8d8386 100644
--- a/clang/lib/Sema/SemaCodeComplete.cpp
+++ b/clang/lib/Sema/SemaCodeComplete.cpp
@@ -1286,6 +1286,7 @@ static void AddFunctionSpecifiers(Sema::ParserCompletionContext CCC,
case Sema::PCC_RecoveryInFunction:
case Sema::PCC_Type:
case Sema::PCC_ParenthesizedExpression:
+ case Sema::PCC_LocalDeclarationSpecifiers:
break;
}
}
@@ -1325,6 +1326,7 @@ static bool WantTypesInContext(Sema::ParserCompletionContext CCC,
case Sema::PCC_RecoveryInFunction:
case Sema::PCC_Type:
case Sema::PCC_ParenthesizedExpression:
+ case Sema::PCC_LocalDeclarationSpecifiers:
return true;
case Sema::PCC_Expression:
@@ -1768,6 +1770,7 @@ static void AddOrdinaryNameResults(Sema::ParserCompletionContext CCC,
}
case Sema::PCC_Type:
+ case Sema::PCC_LocalDeclarationSpecifiers:
break;
}
@@ -2719,6 +2722,9 @@ static enum CodeCompletionContext::Kind mapCodeCompletionContext(Sema &S,
case Sema::PCC_ParenthesizedExpression:
return CodeCompletionContext::CCC_ParenthesizedExpression;
+
+ case Sema::PCC_LocalDeclarationSpecifiers:
+ return CodeCompletionContext::CCC_Type;
}
return CodeCompletionContext::CCC_Other;
@@ -2818,6 +2824,7 @@ void Sema::CodeCompleteOrdinaryName(Scope *S,
case PCC_Template:
case PCC_MemberTemplate:
case PCC_Type:
+ case PCC_LocalDeclarationSpecifiers:
Results.setFilter(&ResultBuilder::IsOrdinaryNonValueName);
break;
@@ -2873,6 +2880,7 @@ void Sema::CodeCompleteOrdinaryName(Scope *S,
case PCC_ForInit:
case PCC_Condition:
case PCC_Type:
+ case PCC_LocalDeclarationSpecifiers:
break;
}
OpenPOWER on IntegriCloud