diff options
author | Chris Lattner <sabre@nondot.org> | 2004-03-08 06:09:57 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2004-03-08 06:09:57 +0000 |
commit | bc2075977cb9555fd2d3b3c3f8a2d957599a964a (patch) | |
tree | a626e6ced862a4f7cf88a4e3169f19335e64da6e /lib/AsmParser/llvmAsmParser.y | |
parent | 4cfeac8f572e93d2cc8f7a6bf74ae959116b9d77 (diff) | |
download | external_llvm-bc2075977cb9555fd2d3b3c3f8a2d957599a964a.zip external_llvm-bc2075977cb9555fd2d3b3c3f8a2d957599a964a.tar.gz external_llvm-bc2075977cb9555fd2d3b3c3f8a2d957599a964a.tar.bz2 |
Eliminate a REALLY HORRIBLE API: mutateReferences, which is gross gross gross.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12212 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AsmParser/llvmAsmParser.y')
-rw-r--r-- | lib/AsmParser/llvmAsmParser.y | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/lib/AsmParser/llvmAsmParser.y b/lib/AsmParser/llvmAsmParser.y index 08be9f4..5e2b9f7 100644 --- a/lib/AsmParser/llvmAsmParser.y +++ b/lib/AsmParser/llvmAsmParser.y @@ -73,7 +73,7 @@ static struct PerModuleInfo { // here. This is used for forward references of ConstantPointerRefs. // typedef std::map<std::pair<const PointerType *, - ValID>, GlobalVariable*> GlobalRefsType; + ValID>, GlobalValue*> GlobalRefsType; GlobalRefsType GlobalRefs; void ModuleDone() { @@ -114,7 +114,7 @@ static struct PerModuleInfo { GlobalRefs.find(std::make_pair(GV->getType(), D)); if (I != GlobalRefs.end()) { - GlobalVariable *OldGV = I->second; // Get the placeholder... + GlobalValue *OldGV = I->second; // Get the placeholder... I->first.second.destroy(); // Free string memory if necessary // Loop over all of the uses of the GlobalValue. The only thing they are @@ -125,12 +125,14 @@ static struct PerModuleInfo { // Change the const pool reference to point to the real global variable // now. This should drop a use from the OldGV. - CPR->mutateReferences(OldGV, GV); + CPR->replaceUsesOfWithOnConstant(OldGV, GV); assert(OldGV->use_empty() && "All uses should be gone now!"); // Remove OldGV from the module... - CurrentModule->getGlobalList().remove(OldGV); - delete OldGV; // Delete the old placeholder + if (GlobalVariable *GVar = dyn_cast<GlobalVariable>(OldGV)) + CurrentModule->getGlobalList().erase(GVar); + else + CurrentModule->getFunctionList().erase(cast<Function>(OldGV)); // Remove the map entry for the global now that it has been created... GlobalRefs.erase(I); |