diff options
author | Chris Lattner <sabre@nondot.org> | 2003-04-16 20:28:45 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2003-04-16 20:28:45 +0000 |
commit | 4ad02e726d9b634372b037d4b352d8b63bb9e849 (patch) | |
tree | 463f4e5e0773c2c8ca3e891556fc0a36c83e3ab5 /lib/Bytecode/Reader/Reader.cpp | |
parent | 2c72b184b86152d4c9e00731d9257240f39ce20b (diff) | |
download | external_llvm-4ad02e726d9b634372b037d4b352d8b63bb9e849.zip external_llvm-4ad02e726d9b634372b037d4b352d8b63bb9e849.tar.gz external_llvm-4ad02e726d9b634372b037d4b352d8b63bb9e849.tar.bz2 |
Add new linkage types to support a real frontend
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5786 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Bytecode/Reader/Reader.cpp')
-rw-r--r-- | lib/Bytecode/Reader/Reader.cpp | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/lib/Bytecode/Reader/Reader.cpp b/lib/Bytecode/Reader/Reader.cpp index 805b7e7..fb561aa 100644 --- a/lib/Bytecode/Reader/Reader.cpp +++ b/lib/Bytecode/Reader/Reader.cpp @@ -307,7 +307,8 @@ bool BytecodeParser::ParseFunction(const uchar *&Buf, const uchar *EndBuf) { Function *F = FunctionSignatureList.back().first; unsigned FunctionSlot = FunctionSignatureList.back().second; FunctionSignatureList.pop_back(); - F->setInternalLinkage(isInternal != 0); + F->setLinkage(isInternal ? GlobalValue::InternalLinkage : + GlobalValue::ExternalLinkage); const FunctionType::ParamTypes &Params =F->getFunctionType()->getParamTypes(); Function::aiterator AI = F->abegin(); @@ -399,8 +400,13 @@ bool BytecodeParser::ParseModuleGlobalInfo(const uchar *&Buf, const uchar *End){ const Type *ElTy = cast<PointerType>(Ty)->getElementType(); + + GlobalValue::LinkageTypes Linkage = + (VarType & 4) ? GlobalValue::InternalLinkage : + GlobalValue::ExternalLinkage; + // Create the global variable... - GlobalVariable *GV = new GlobalVariable(ElTy, VarType & 1, VarType & 4, + GlobalVariable *GV = new GlobalVariable(ElTy, VarType & 1, Linkage, 0, "", TheModule); int DestSlot = insertValue(GV, ModuleValues); if (DestSlot == -1) return true; @@ -435,7 +441,8 @@ bool BytecodeParser::ParseModuleGlobalInfo(const uchar *&Buf, const uchar *End){ // this placeholder is replaced. // Insert the placeholder... - Function *Func = new Function(cast<FunctionType>(Ty), false, "", TheModule); + Function *Func = new Function(cast<FunctionType>(Ty), + GlobalValue::InternalLinkage, "", TheModule); int DestSlot = insertValue(Func, ModuleValues); if (DestSlot == -1) return true; ResolveReferencesToValue(Func, (unsigned)DestSlot); |