diff options
author | Eli Friedman <eli.friedman@gmail.com> | 2008-12-20 23:18:29 +0000 |
---|---|---|
committer | Eli Friedman <eli.friedman@gmail.com> | 2008-12-20 23:18:29 +0000 |
commit | 5ad3c91b273cf6fe57bf31a06eb31d6317d06aae (patch) | |
tree | b1cd0ef960719382db62b0233d70ffae8727ec75 /clang/lib/CodeGen/CGStmt.cpp | |
parent | f4084708cdd74b79198c42d859fefac4309900b3 (diff) | |
download | bcm5719-llvm-5ad3c91b273cf6fe57bf31a06eb31d6317d06aae.tar.gz bcm5719-llvm-5ad3c91b273cf6fe57bf31a06eb31d6317d06aae.zip |
Extend the unsupported error to include break and continue, and fix a
warning by using an unsigned index.
llvm-svn: 61292
Diffstat (limited to 'clang/lib/CodeGen/CGStmt.cpp')
-rw-r--r-- | clang/lib/CodeGen/CGStmt.cpp | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/clang/lib/CodeGen/CGStmt.cpp b/clang/lib/CodeGen/CGStmt.cpp index 60e8bd6b7fd..f84f6a630f3 100644 --- a/clang/lib/CodeGen/CGStmt.cpp +++ b/clang/lib/CodeGen/CGStmt.cpp @@ -220,7 +220,7 @@ void CodeGenFunction::EmitGotoStmt(const GotoStmt &S) { 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 @@ void CodeGenFunction::EmitReturnOfRValue(RValue RV, QualType Ty) { /// 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 @@ void CodeGenFunction::EmitBreakStmt(const BreakStmt &S) { 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 @@ void CodeGenFunction::EmitContinueStmt(const ContinueStmt &S) { 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 |