diff options
author | Chris Lattner <sabre@nondot.org> | 2007-11-27 06:46:51 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2007-11-27 06:46:51 +0000 |
commit | f04b69b26c6e48f0aa77bed373ddbbf844e3a325 (patch) | |
tree | e7fb19b85c05dd3ec5cf77472be2f076526562c2 | |
parent | 34ffaeeeed73bf6adc53ae591ef13a9392ace1d3 (diff) | |
download | bcm5719-llvm-f04b69b26c6e48f0aa77bed373ddbbf844e3a325.tar.gz bcm5719-llvm-f04b69b26c6e48f0aa77bed373ddbbf844e3a325.zip |
take an initial stab at setting function linkage right. Handle
static and inline at least.
llvm-svn: 44355
-rw-r--r-- | clang/CodeGen/CodeGenFunction.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/clang/CodeGen/CodeGenFunction.cpp b/clang/CodeGen/CodeGenFunction.cpp index e0d55b59cba..3602d60029b 100644 --- a/clang/CodeGen/CodeGenFunction.cpp +++ b/clang/CodeGen/CodeGenFunction.cpp @@ -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); |