]> granicus.if.org Git - clang/commitdiff
Add some ErrorUnsupported calls and turn on VLA codegen again.
authorAnders Carlsson <andersca@mac.com>
Sat, 20 Dec 2008 19:33:21 +0000 (19:33 +0000)
committerAnders Carlsson <andersca@mac.com>
Sat, 20 Dec 2008 19:33:21 +0000 (19:33 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61283 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/CGDecl.cpp
lib/CodeGen/CGStmt.cpp
test/CodeGen/unsupported.c

index 1c72ba12280cb0a06c477301cfc6aec2c947bace..62684bae496360b81dfa6721d4d17cf02567fb9a 100644 (file)
@@ -160,15 +160,6 @@ void CodeGenFunction::EmitLocalBlockVarDecl(const VarDecl &D) {
         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);
 
index afce63d41d8f08605b47cfd5d9d2f97ec1da66bf..6d8f5da015c0534fe384267262914acb0df45d09 100644 (file)
@@ -220,6 +220,11 @@ void CodeGenFunction::EmitGotoStmt(const GotoStmt &S) {
     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 @@ 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) {
+  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 @@ void CodeGenFunction::EmitBreakStmt(const BreakStmt &S) {
 
   // 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 @@ void CodeGenFunction::EmitContinueStmt(const ContinueStmt &S) {
     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.
index 2c87163fc0453690ada51290678859355d60b4b6..664119acdd49f797a65167dff1e41da62647e8e3 100644 (file)
@@ -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}}
 }