diff options
-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); |