r311065 - Further refactoring of the constant emitter. NFC.
    John McCall via cfe-commits 
    cfe-commits at lists.llvm.org
       
    Mon Mar 18 12:07:27 PDT 2019
    
    
  
On 18 Mar 2019, at 14:39, Don Hinton wrote:
> It looks like this change introduced a small bug;  Specifically, the
> following cast test:
>
> -      if (auto PT = dyn_cast<llvm::PointerType>(DestTy)) {
> ...
> +  // If we're producing a pointer, this is easy.
> +  if (auto destPtrTy = cast<llvm::PointerType>(destTy)) {
>
> Since the cast can fail, shouldn't you prefer dyn_cast<>(), which can
> return nullptr, over cast<>(), which will assert?
Yes, although if it hasn't caused a problem in the last year and a half, 
maybe we should just change the code to be non-conditional.
John.
    
    
More information about the cfe-commits
mailing list