diff options
author | Richard Trieu <rtrieu@google.com> | 2011-04-21 21:44:26 +0000 |
---|---|---|
committer | Richard Trieu <rtrieu@google.com> | 2011-04-21 21:44:26 +0000 |
commit | bb9b80c308d7d3f758886243c7145404a50c66cf (patch) | |
tree | a0f409d3a3e384dabdd86880871ca16a2b229b96 /lib/Sema/SemaExpr.cpp | |
parent | 723b1782460bc448d9d865e9b828c09d26a50964 (diff) |
Add a fixit suggest for missing case keywords inside a switch scope. For instance, in the following code, 'case ' will be suggested before the '1:'
switch (x) {
1: return 0;
default: return 1;
}
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@129943 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaExpr.cpp')
-rw-r--r-- | lib/Sema/SemaExpr.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp index 8eb0177046..0e0bf435b2 100644 --- a/lib/Sema/SemaExpr.cpp +++ b/lib/Sema/SemaExpr.cpp @@ -10734,3 +10734,11 @@ ExprResult Sema::CheckPlaceholderExpr(Expr *E) { assert(!type->isPlaceholderType()); return Owned(E); } + +bool Sema::CheckCaseExpression(Expr *expr) { + if (expr->isTypeDependent()) + return true; + if (expr->isValueDependent() || expr->isIntegerConstantExpr(Context)) + return expr->getType()->isIntegralOrEnumerationType(); + return false; +} |