Extend the unsupported error to include break and continue, and fix a
warning by using an unsigned index.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61292 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/CodeGen/CGStmt.cpp b/lib/CodeGen/CGStmt.cpp
index 60e8bd6..f84f6a6 100644
--- a/lib/CodeGen/CGStmt.cpp
+++ b/lib/CodeGen/CGStmt.cpp
@@ -220,7 +220,7 @@
return;
}
- for (int i = 0; i < StackSaveValues.size(); i++) {
+ for (unsigned i = 0; i < StackSaveValues.size(); i++) {
if (StackSaveValues[i]) {
CGM.ErrorUnsupported(&S, "goto inside scope with VLA");
return;
@@ -478,7 +478,7 @@
/// if the function returns void, or may be missing one if the function returns
/// non-void. Fun stuff :).
void CodeGenFunction::EmitReturnStmt(const ReturnStmt &S) {
- for (int i = 0; i < StackSaveValues.size(); i++) {
+ for (unsigned i = 0; i < StackSaveValues.size(); i++) {
if (StackSaveValues[i]) {
CGM.ErrorUnsupported(&S, "return inside scope with VLA");
return;
@@ -532,9 +532,11 @@
return;
}
- if (StackSaveValues.back()) {
- CGM.ErrorUnsupported(&S, "break inside scope with VLA");
- return;
+ for (unsigned i = 0; i < StackSaveValues.size(); i++) {
+ if (StackSaveValues[i]) {
+ CGM.ErrorUnsupported(&S, "break inside scope with VLA");
+ return;
+ }
}
// If this code is reachable then emit a stop point (if generating
@@ -555,9 +557,11 @@
return;
}
- if (StackSaveValues.back()) {
- CGM.ErrorUnsupported(&S, "continue inside scope with VLA");
- return;
+ for (unsigned i = 0; i < StackSaveValues.size(); i++) {
+ if (StackSaveValues[i]) {
+ CGM.ErrorUnsupported(&S, "continue inside scope with VLA");
+ return;
+ }
}
// If this code is reachable then emit a stop point (if generating