From: Rafael Espindola Date: Fri, 16 May 2014 14:22:33 +0000 (+0000) Subject: Small dyn_cast and auto cleanup. X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=74c8558965cc021a3e320dc778e1edc497bd2491;p=oota-llvm.git Small dyn_cast and auto cleanup. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@208993 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Bitcode/Reader/BitcodeReader.cpp b/lib/Bitcode/Reader/BitcodeReader.cpp index a1ae6baff9f..ea33578502b 100644 --- a/lib/Bitcode/Reader/BitcodeReader.cpp +++ b/lib/Bitcode/Reader/BitcodeReader.cpp @@ -1963,11 +1963,11 @@ error_code BitcodeReader::ParseModule(bool Resume) { Type *Ty = getTypeByID(Record[0]); if (!Ty) return Error(InvalidRecord); - if (!Ty->isPointerTy()) + auto *PTy = dyn_cast(Ty); + if (!PTy) return Error(InvalidTypeForValue); - auto *PTy = cast(Ty); - GlobalAlias *NewGA = + auto *NewGA = new GlobalAlias(PTy->getElementType(), GetDecodedLinkage(Record[2]), "", nullptr, TheModule, PTy->getAddressSpace()); // Old bitcode files didn't have visibility field.