diff options
author | Chris Lattner <sabre@nondot.org> | 2003-04-25 21:47:33 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2003-04-25 21:47:33 +0000 |
commit | 1fcfaf5bc08bf958e8e2fadf79b718f322a1f073 (patch) | |
tree | fb55576fa5fb520bc2fc6fb26b24a008ad043464 | |
parent | d2a969dd98b4f9e471ab367cf87e1570d44f281d (diff) | |
download | bcm5719-llvm-1fcfaf5bc08bf958e8e2fadf79b718f322a1f073.tar.gz bcm5719-llvm-1fcfaf5bc08bf958e8e2fadf79b718f322a1f073.zip |
Fix bug: Assembler/2003-04-25-UnresolvedGlobalReference.ll
llvm-svn: 5948
-rw-r--r-- | llvm/lib/AsmParser/llvmAsmParser.y | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/llvm/lib/AsmParser/llvmAsmParser.y b/llvm/lib/AsmParser/llvmAsmParser.y index 19cda682a16..fa57e9187e7 100644 --- a/llvm/lib/AsmParser/llvmAsmParser.y +++ b/llvm/lib/AsmParser/llvmAsmParser.y @@ -156,6 +156,25 @@ static struct PerFunctionInfo { // resolve the branches now... ResolveDefinitions(LateResolveValues, &CurModule.LateResolveValues); + // Make sure to resolve any constant expr references that might exist within + // the function we just declared itself. + ValID FID; + if (CurrentFunction->hasName()) { + FID = ValID::create((char*)CurrentFunction->getName().c_str()); + } else { + unsigned Slot = CurrentFunction->getType()->getUniqueID(); + assert(CurModule.Values.size() > Slot && "Function not inserted?"); + // Figure out which slot number if is... + for (unsigned i = 0; ; ++i) { + assert(i < CurModule.Values[Slot].size() && "Function not found!"); + if (CurModule.Values[Slot][i] == CurrentFunction) { + FID = ValID::create((int)i); + break; + } + } + } + CurModule.DeclareNewGlobalValue(CurrentFunction, FID); + Values.clear(); // Clear out function local definitions Types.clear(); CurrentFunction = 0; @@ -965,7 +984,6 @@ ConstVal: Types '[' ConstVector ']' { // Nonempty unsized arr CurMeth.CurrentFunction = SavedCurFn; - // If this is an initializer for a constant pointer, which is referencing a // (currently) undefined variable, create a stub now that shall be replaced // in the future with the right type of variable. |