blob: 1645b6b2b5b6560b29debd863dec437e50bff55e [file] [log] [blame]
Chris Lattner84915fa2007-06-02 04:16:21 +00001//===--- CGDecl.cpp - Emit LLVM Code for declarations ---------------------===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file was developed by Chris Lattner and is distributed under
6// the University of Illinois Open Source License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9//
10// This contains code to emit Decl nodes as LLVM code.
11//
12//===----------------------------------------------------------------------===//
13
14#include "CodeGenFunction.h"
15#include "clang/AST/AST.h"
16//#include "llvm/Constants.h"
17//#include "llvm/DerivedTypes.h"
18//#include "llvm/Function.h"
19using namespace llvm;
20using namespace clang;
21using namespace CodeGen;
22
23
24void CodeGenFunction::EmitDeclStmt(const DeclStmt &S) {
25 const Decl *Decl = S.getDecl();
26
27 switch (Decl->getKind()) {
28 default: assert(0 && "Unknown decl kind!");
29 case Decl::FileVariable:
30 assert(0 && "Should not see file-scope variables inside a function!");
31 case Decl::ParmVariable:
32 assert(0 && "Parmdecls should not be in declstmts!");
33 case Decl::Typedef: // typedef int X;
34 case Decl::Function: // void X();
35 case Decl::Struct: // struct X;
36 case Decl::Union: // union X;
37 case Decl::Class: // class X;
38 case Decl::Enum: // enum X;
39 // None of these decls require codegen support.
40 return;
41
42 case Decl::BlockVariable:
43 return EmitBlockVarDecl(cast<BlockVarDecl>(*Decl));
44 case Decl::EnumConstant:
45 return EmitEnumConstantDecl(cast<EnumConstantDecl>(*Decl));
46 }
47}
48
49void CodeGenFunction::EmitBlockVarDecl(const BlockVarDecl &D) {
50 //assert(0 && "FIXME: Enum constant decls not implemented yet!");
51
52}
53
54void CodeGenFunction::EmitEnumConstantDecl(const EnumConstantDecl &D) {
55 assert(0 && "FIXME: Enum constant decls not implemented yet!");
56}