[cfe-commits] r61283 - in /cfe/trunk: lib/CodeGen/CGDecl.cpp lib/CodeGen/CGStmt.cpp test/CodeGen/unsupported.c
Anders Carlsson
andersca at mac.com
Sat Dec 20 11:33:22 PST 2008
Author: andersca
Date: Sat Dec 20 13:33:21 2008
New Revision: 61283
URL: http://llvm.org/viewvc/llvm-project?rev=61283&view=rev
Log:
Add some ErrorUnsupported calls and turn on VLA codegen again.
Modified:
cfe/trunk/lib/CodeGen/CGDecl.cpp
cfe/trunk/lib/CodeGen/CGStmt.cpp
cfe/trunk/test/CodeGen/unsupported.c
Modified: cfe/trunk/lib/CodeGen/CGDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDecl.cpp?rev=61283&r1=61282&r2=61283&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGDecl.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGDecl.cpp Sat Dec 20 13:33:21 2008
@@ -160,15 +160,6 @@
D.getStorageClass() == VarDecl::Register ? ".reg." : ".auto.";
DeclPtr = GenerateStaticBlockVarDecl(D, true, Class);
}
- } else if (1) {
- // FIXME: The code below is disabled because is causes a regression in the
- // testsuite.
- CGM.ErrorUnsupported(&D, "variable-length array");
-
- const llvm::Type *LTy = ConvertType(Ty);
- llvm::AllocaInst *Alloc =
- CreateTempAlloca(LTy, D.getIdentifier()->getName());
- DeclPtr = Alloc;
} else {
const VariableArrayType *VAT = getContext().getAsVariableArrayType(Ty);
Modified: cfe/trunk/lib/CodeGen/CGStmt.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGStmt.cpp?rev=61283&r1=61282&r2=61283&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGStmt.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGStmt.cpp Sat Dec 20 13:33:21 2008
@@ -220,6 +220,11 @@
return;
}
+ if (StackSaveValues.back()) {
+ CGM.ErrorUnsupported(&S, "goto inside scope with VLA");
+ return;
+ }
+
// If this code is reachable then emit a stop point (if generating
// debug info). We have to do this ourselves because we are on the
// "simple" statement path.
@@ -471,6 +476,11 @@
/// if the function returns void, or may be missing one if the function returns
/// non-void. Fun stuff :).
void CodeGenFunction::EmitReturnStmt(const ReturnStmt &S) {
+ if (StackSaveValues.back()) {
+ CGM.ErrorUnsupported(&S, "return inside scope with VLA");
+ return;
+ }
+
// Emit the result value, even if unused, to evalute the side effects.
const Expr *RV = S.getRetValue();
@@ -514,10 +524,15 @@
// FIXME: Implement break in @try or @catch blocks.
if (ObjCEHStack.size() != BreakContinueStack.back().EHStackSize) {
- CGM.ErrorUnsupported(&S, "continue inside an Obj-C exception block");
+ CGM.ErrorUnsupported(&S, "break inside an Obj-C exception block");
return;
}
+ if (StackSaveValues.back()) {
+ CGM.ErrorUnsupported(&S, "break inside scope with VLA");
+ return;
+ }
+
// If this code is reachable then emit a stop point (if generating
// debug info). We have to do this ourselves because we are on the
// "simple" statement path.
@@ -536,6 +551,11 @@
return;
}
+ if (StackSaveValues.back()) {
+ CGM.ErrorUnsupported(&S, "continue inside scope with VLA");
+ return;
+ }
+
// If this code is reachable then emit a stop point (if generating
// debug info). We have to do this ourselves because we are on the
// "simple" statement path.
Modified: cfe/trunk/test/CodeGen/unsupported.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/unsupported.c?rev=61283&r1=61282&r2=61283&view=diff
==============================================================================
--- cfe/trunk/test/CodeGen/unsupported.c (original)
+++ cfe/trunk/test/CodeGen/unsupported.c Sat Dec 20 13:33:21 2008
@@ -1,6 +1,6 @@
// RUN: clang -verify -emit-llvm -o %t %s
int f0(int x) {
- int vla[x]; // expected-error {{cannot codegen this variable-length array yet}}
- return vla[x-1];
+ int vla[x];
+ return vla[x-1]; // expected-error {{cannot codegen this return inside scope with VLA yet}}
}
More information about the cfe-commits
mailing list