llvm.org GIT mirror llvm / 1d871c5
fix PR5295 where the .ll parser didn't reject a function after a global or global after a function with conflicting names. Update some testcases that were accidentally depending on this behavior. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85081 91177308-0d34-0410-b5e6-96231b3b80d8 Chris Lattner 10 years ago
3 changed file(s) with 10 addition(s) and 7 deletion(s). Raw diff Collapse all Expand all
602602
603603 // See if this value already exists in the symbol table. If so, it is either
604604 // a redefinition or a definition of a forward reference.
605 if (GlobalValue *Val =
606 cast_or_null(M->getValueSymbolTable().lookup(Name))) {
605 if (GlobalValue *Val = M->getNamedValue(Name)) {
607606 // See if this was a redefinition. If so, there is no entry in
608607 // ForwardRefVals.
609608 std::map >::iterator
670669
671670 // See if the global was forward referenced, if so, use the global.
672671 if (!Name.empty()) {
673 if ((GV = M->getGlobalVariable(Name, true)) &&
674 !ForwardRefVals.erase(Name))
675 return Error(NameLoc, "redefinition of global '@" + Name + "'");
672 if (GlobalValue *GVal = M->getNamedValue(Name)) {
673 if (!ForwardRefVals.erase(Name) || !isa(GVal))
674 return Error(NameLoc, "redefinition of global '@" + Name + "'");
675 GV = cast(GVal);
676 }
676677 } else {
677678 std::map >::iterator
678679 I = ForwardRefValIDs.find(NumberedVals.size());
25622563 AI != AE; ++AI)
25632564 AI->setName("");
25642565 }
2566 } else if (M->getNamedValue(FunctionName)) {
2567 return Error(NameLoc, "redefinition of function '@" + FunctionName + "'");
25652568 }
25662569
25672570 } else {
272272 @A = global i32* @B ; [#uses=0]
273273 @B = global i32 7 ; [#uses=1]
274274
275 define void @X() {
275 define void @test12312() {
276276 ret void
277277 }
278278 ; ModuleID = 'global_section.ll'
22
33 @g = alias weak i32 ()* @f
44
5 define void @g() {
5 define void @h() {
66 entry:
77 %tmp31 = call i32 @g()
88 ret void