take an initial stab at setting function linkage right. Handle

static and inline at least.

llvm-svn: 44355
This commit is contained in:
Chris Lattner 2007-11-27 06:46:51 +00:00
parent 34ffaeeeed
commit f04b69b26c
1 changed files with 7 additions and 1 deletions

View File

@ -60,9 +60,15 @@ void CodeGenFunction::GenerateCode(const FunctionDecl *FD) {
CurFn = cast<llvm::Function>(CGM.GetAddrOfGlobalDecl(FD));
CurFuncDecl = FD;
// TODO: Set up linkage and many other things.
assert(CurFn->isDeclaration() && "Function already has body?");
// TODO: Set up linkage and many other things. Note, this is a simple
// approximation of what we really want.
if (FD->getStorageClass() == FunctionDecl::Static)
CurFn->setLinkage(llvm::Function::InternalLinkage);
else if (FD->isInline())
CurFn->setLinkage(llvm::Function::WeakLinkage);
llvm::BasicBlock *EntryBB = new llvm::BasicBlock("entry", CurFn);
Builder.SetInsertPoint(EntryBB);