aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/CGDecl.cpp
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2008-08-29 17:28:43 +0000
committerDaniel Dunbar <daniel@zuster.org>2008-08-29 17:28:43 +0000
commit662174c82ef46b19a2329c7d37208e1d12dfb7b3 (patch)
tree97f388c9ca90a895ac73c9137689829a28295792 /lib/CodeGen/CGDecl.cpp
parent91c027e2021366396696977af7fdc0e070bdd614 (diff)
Downgrade a number of FIXME asserts to ErrorUnsupported.
- Notably VLAs git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55544 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGDecl.cpp')
-rw-r--r--lib/CodeGen/CGDecl.cpp27
1 files changed, 14 insertions, 13 deletions
diff --git a/lib/CodeGen/CGDecl.cpp b/lib/CodeGen/CGDecl.cpp
index c0ad1079be..4d90cbc84a 100644
--- a/lib/CodeGen/CGDecl.cpp
+++ b/lib/CodeGen/CGDecl.cpp
@@ -37,24 +37,20 @@ void CodeGenFunction::EmitDecl(const Decl &D) {
case Decl::Union: // union X;
case Decl::Class: // class X;
case Decl::Enum: // enum X;
+ case Decl::EnumConstant: // enum ? { X = ? }
case Decl::CXXStruct: // struct X; [C++]
case Decl::CXXUnion: // union X; [C++]
case Decl::CXXClass: // class X; [C++]
// None of these decls require codegen support.
return;
- case Decl::Var:
- if (cast<VarDecl>(D).isBlockVarDecl())
- return EmitBlockVarDecl(cast<VarDecl>(D));
- assert(0 && "Should not see file-scope variables inside a function!");
-
- case Decl::EnumConstant:
- return EmitEnumConstantDecl(cast<EnumConstantDecl>(D));
+ case Decl::Var: {
+ const VarDecl &VD = cast<VarDecl>(D);
+ assert(VD.isBlockVarDecl() &&
+ "Should not see file-scope variables inside a function!");
+ return EmitBlockVarDecl(VD);
+ }
}
-}
-
-void CodeGenFunction::EmitEnumConstantDecl(const EnumConstantDecl &D) {
- assert(0 && "FIXME: Enum constant decls not implemented yet!");
}
/// EmitBlockVarDecl - This method handles emission of any variable declaration
@@ -169,8 +165,13 @@ void CodeGenFunction::EmitLocalBlockVarDecl(const VarDecl &D) {
DeclPtr = GenerateStaticBlockVarDecl(D, true, Class);
}
} else {
- // TODO: Create a dynamic alloca.
- assert(0 && "FIXME: Local VLAs not implemented yet");
+ CGM.ErrorUnsupported(&D, "variable-length array");
+
+ // FIXME: VLA: Add VLA support. For now just make up enough to let
+ // the compile go through.
+ const llvm::Type *LTy = ConvertType(Ty);
+ llvm::AllocaInst * Alloc = CreateTempAlloca(LTy, D.getName());
+ DeclPtr = Alloc;
}
llvm::Value *&DMEntry = LocalDeclMap[&D];