diff options
author | rdivacky <rdivacky@FreeBSD.org> | 2009-11-05 17:17:44 +0000 |
---|---|---|
committer | rdivacky <rdivacky@FreeBSD.org> | 2009-11-05 17:17:44 +0000 |
commit | ded64d5d348ce8d8c5aa42cf63f6de9dd84b7e89 (patch) | |
tree | adc0bc5dc9cb37579ee90d3c0f08c98c0711bebe /lib/AsmParser/LLParser.cpp | |
parent | ee2025263d979561bba11dc526f01d690a2565e7 (diff) | |
download | FreeBSD-src-ded64d5d348ce8d8c5aa42cf63f6de9dd84b7e89.zip FreeBSD-src-ded64d5d348ce8d8c5aa42cf63f6de9dd84b7e89.tar.gz |
Update LLVM to r86140.
Diffstat (limited to 'lib/AsmParser/LLParser.cpp')
-rw-r--r-- | lib/AsmParser/LLParser.cpp | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/lib/AsmParser/LLParser.cpp b/lib/AsmParser/LLParser.cpp index 0da0f4a..63af42d 100644 --- a/lib/AsmParser/LLParser.cpp +++ b/lib/AsmParser/LLParser.cpp @@ -480,17 +480,17 @@ bool LLParser::ParseMDNode(MetadataBase *&Node) { if (ParseUInt32(MID)) return true; // Check existing MDNode. - std::map<unsigned, MetadataBase *>::iterator I = MetadataCache.find(MID); + std::map<unsigned, WeakVH>::iterator I = MetadataCache.find(MID); if (I != MetadataCache.end()) { - Node = I->second; + Node = cast<MetadataBase>(I->second); return false; } // Check known forward references. - std::map<unsigned, std::pair<MetadataBase *, LocTy> >::iterator + std::map<unsigned, std::pair<WeakVH, LocTy> >::iterator FI = ForwardRefMDNodes.find(MID); if (FI != ForwardRefMDNodes.end()) { - Node = FI->second.first; + Node = cast<MetadataBase>(FI->second.first); return false; } @@ -570,7 +570,7 @@ bool LLParser::ParseStandaloneMetadata() { MDNode *Init = MDNode::get(Context, Elts.data(), Elts.size()); MetadataCache[MetadataID] = Init; - std::map<unsigned, std::pair<MetadataBase *, LocTy> >::iterator + std::map<unsigned, std::pair<WeakVH, LocTy> >::iterator FI = ForwardRefMDNodes.find(MetadataID); if (FI != ForwardRefMDNodes.end()) { MDNode *FwdNode = cast<MDNode>(FI->second.first); @@ -3619,12 +3619,14 @@ bool LLParser::ParseAlloc(Instruction *&Inst, PerFunctionState &PFS, // Autoupgrade old malloc instruction to malloc call. // FIXME: Remove in LLVM 3.0. const Type *IntPtrTy = Type::getInt32Ty(Context); + Constant *AllocSize = ConstantExpr::getSizeOf(Ty); + AllocSize = ConstantExpr::getTruncOrBitCast(AllocSize, IntPtrTy); if (!MallocF) // Prototype malloc as "void *(int32)". // This function is renamed as "malloc" in ValidateEndOfModule(). MallocF = cast<Function>( M->getOrInsertFunction("", Type::getInt8PtrTy(Context), IntPtrTy, NULL)); - Inst = CallInst::CreateMalloc(BB, IntPtrTy, Ty, Size, MallocF); + Inst = CallInst::CreateMalloc(BB, IntPtrTy, Ty, AllocSize, Size, MallocF); return false; } |