aboutsummaryrefslogtreecommitdiffstats
path: root/lib/AsmParser
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2003-04-25 21:47:33 +0000
committerChris Lattner <sabre@nondot.org>2003-04-25 21:47:33 +0000
commitb8fdd8ba6106783e95b370ec7ace74e10db3f9fa (patch)
tree992aaf2ec6fb4c6ab7c8dee21ded6d9ec7f4e434 /lib/AsmParser
parentb1f92f8f3a4d5f5e6e2005ce996607e50ee17ffd (diff)
downloadexternal_llvm-b8fdd8ba6106783e95b370ec7ace74e10db3f9fa.zip
external_llvm-b8fdd8ba6106783e95b370ec7ace74e10db3f9fa.tar.gz
external_llvm-b8fdd8ba6106783e95b370ec7ace74e10db3f9fa.tar.bz2
Fix bug: Assembler/2003-04-25-UnresolvedGlobalReference.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5948 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AsmParser')
-rw-r--r--lib/AsmParser/llvmAsmParser.y20
1 files changed, 19 insertions, 1 deletions
diff --git a/lib/AsmParser/llvmAsmParser.y b/lib/AsmParser/llvmAsmParser.y
index 19cda68..fa57e91 100644
--- a/lib/AsmParser/llvmAsmParser.y
+++ b/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.