aboutsummaryrefslogtreecommitdiffstats
path: root/lib/AsmParser/LLParser.cpp
diff options
context:
space:
mode:
authorJustin Holewinski <jholewinski@nvidia.com>2012-11-16 21:03:47 +0000
committerJustin Holewinski <jholewinski@nvidia.com>2012-11-16 21:03:47 +0000
commiteaff2d55a988aa107ca6fe19e2220d8672770da5 (patch)
tree8f59a509b9bdaa2e6b84ad978ab0012af73d6d23 /lib/AsmParser/LLParser.cpp
parent4f0dfbb454ea8110459e2d1ee5f92e74cb3e8a5c (diff)
downloadexternal_llvm-eaff2d55a988aa107ca6fe19e2220d8672770da5.zip
external_llvm-eaff2d55a988aa107ca6fe19e2220d8672770da5.tar.gz
external_llvm-eaff2d55a988aa107ca6fe19e2220d8672770da5.tar.bz2
Preserve address space of forward-referenced global variables in the LL parser
Before, the parser would assert on the following code: @a2 = global i8 addrspace(1)* @a @a = addrspace(1) global i8 0 because the type of @a was "i8*" instead of "i8 addrspace(1)*" when parsing the initializer for @a2. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168197 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AsmParser/LLParser.cpp')
-rw-r--r--lib/AsmParser/LLParser.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/AsmParser/LLParser.cpp b/lib/AsmParser/LLParser.cpp
index 06b2603..327ce75 100644
--- a/lib/AsmParser/LLParser.cpp
+++ b/lib/AsmParser/LLParser.cpp
@@ -779,7 +779,9 @@ GlobalValue *LLParser::GetGlobalVal(const std::string &Name, Type *Ty,
FwdVal = Function::Create(FT, GlobalValue::ExternalWeakLinkage, Name, M);
else
FwdVal = new GlobalVariable(*M, PTy->getElementType(), false,
- GlobalValue::ExternalWeakLinkage, 0, Name);
+ GlobalValue::ExternalWeakLinkage, 0, Name,
+ 0, GlobalVariable::NotThreadLocal,
+ PTy->getAddressSpace());
ForwardRefVals[Name] = std::make_pair(FwdVal, Loc);
return FwdVal;