diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2018-07-26 18:41:30 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2018-07-26 18:41:30 +0000 |
commit | 51cfee88b37794cb98ee948c142884044a74e1fb (patch) | |
tree | 3ad03203059aa21cc7eaedca304c01e8cf284b8d /lib/Sema/SemaCodeComplete.cpp | |
parent | 172cbdc41f25ea610a15bb7f071a973751d57b6e (diff) | |
download | clang-51cfee88b37794cb98ee948c142884044a74e1fb.tar.gz |
Refactor checking of switch conditions and case values.
Check each case value in turn while parsing it, performing the
conversion to the switch type within the context of the expression
itself. This will become necessary in order to properly handle cleanups
for temporaries created as part of the case label (in an upcoming
patch). For now it's just good hygiene.
This necessitates moving the checking for the switch condition itself to
earlier, so that the destination type is available when checking the
case labels.
As a nice side-effect, we get slightly improved diagnostic quality and
error recovery by separating the case expression checking from the case
statement checking and from tracking whether there are discarded case
labels.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@338056 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaCodeComplete.cpp')
-rw-r--r-- | lib/Sema/SemaCodeComplete.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/Sema/SemaCodeComplete.cpp b/lib/Sema/SemaCodeComplete.cpp index ae5183408f..4e571eba17 100644 --- a/lib/Sema/SemaCodeComplete.cpp +++ b/lib/Sema/SemaCodeComplete.cpp @@ -4316,7 +4316,7 @@ void Sema::CodeCompleteCase(Scope *S) { if (getCurFunction()->SwitchStack.empty() || !CodeCompleter) return; - SwitchStmt *Switch = getCurFunction()->SwitchStack.back(); + SwitchStmt *Switch = getCurFunction()->SwitchStack.back().getPointer(); QualType type = Switch->getCond()->IgnoreImplicit()->getType(); if (!type->isEnumeralType()) { CodeCompleteExpressionData Data(type); |