aboutsummaryrefslogtreecommitdiff
path: root/CodeGen/CodeGenFunction.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2007-11-27 06:46:51 +0000
committerChris Lattner <sabre@nondot.org>2007-11-27 06:46:51 +0000
commit5c6a42aeccd5134216e12408634577ce5a517505 (patch)
treee724e1089d5417da73f7a5c36828470f5579668c /CodeGen/CodeGenFunction.cpp
parenta64db8fa2a7b4e24d0aeef7c22046fa37d8f1f3b (diff)
take an initial stab at setting function linkage right. Handle
static and inline at least. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44355 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'CodeGen/CodeGenFunction.cpp')
-rw-r--r--CodeGen/CodeGenFunction.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/CodeGen/CodeGenFunction.cpp b/CodeGen/CodeGenFunction.cpp
index e0d55b59cb..3602d60029 100644
--- a/CodeGen/CodeGenFunction.cpp
+++ b/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);