[llvm] r208993 - Small dyn_cast and auto cleanup.

Rafael Espindola rafael.espindola at gmail.com
Fri May 16 07:22:33 PDT 2014


Author: rafael
Date: Fri May 16 09:22:33 2014
New Revision: 208993

URL: http://llvm.org/viewvc/llvm-project?rev=208993&view=rev
Log:
Small dyn_cast and auto cleanup.

Modified:
    llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp

Modified: llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp?rev=208993&r1=208992&r2=208993&view=diff
==============================================================================
--- llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp (original)
+++ llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp Fri May 16 09:22:33 2014
@@ -1963,11 +1963,11 @@ error_code BitcodeReader::ParseModule(bo
       Type *Ty = getTypeByID(Record[0]);
       if (!Ty)
         return Error(InvalidRecord);
-      if (!Ty->isPointerTy())
+      auto *PTy = dyn_cast<PointerType>(Ty);
+      if (!PTy)
         return Error(InvalidTypeForValue);
 
-      auto *PTy = cast<PointerType>(Ty);
-      GlobalAlias *NewGA =
+      auto *NewGA =
           new GlobalAlias(PTy->getElementType(), GetDecodedLinkage(Record[2]),
                           "", nullptr, TheModule, PTy->getAddressSpace());
       // Old bitcode files didn't have visibility field.





More information about the llvm-commits mailing list