simon_tatham added inline comments.
================ Comment at: clang/utils/TableGen/MveEmitter.cpp:1197 + const Type *Ty = nullptr; + if (auto *DI = dyn_cast<DagInit>(D->getArg(0))->getOperator()) + if (auto *PTy = dyn_cast<PointerType>(getType(DI, Param))) ---------------- dblaikie wrote: > nikic wrote: > > Should be either `cast` or check for nullptr before dereferencing? > Not sure I follow the question - which variable are you pointing to that > needs a null check before its use? Oh yes, good point, I see it. `dyn_cast<DagInit>(D->getArg(0))` might return nullptr, because the point of `dyn_cast` is that the thing you're casting might not have the right type. So you should check the return from `dyn_cast` before you dereference it to call its `getOperator` method. (Alternatively, as @nikic hints, if you think that in this case the cast //cannot// fail, then you can change it to a straight `cast` which doesn't do the runtime check.) Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D122046/new/ https://reviews.llvm.org/D122046 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits