ilya-biryukov added inline comments.
================ Comment at: lib/Sema/SemaDecl.cpp:12184 Decl *Sema::ActOnSkippedFunctionBody(Decl *Decl) { - if (FunctionDecl *FD = dyn_cast_or_null<FunctionDecl>(Decl)) + if (FunctionDecl *FD = Decl->getAsFunction()) FD->setHasSkippedBody(); ---------------- ilya-biryukov wrote: > sepavloff wrote: > > In the case of `Decl == nullptr` this code would crash. Probably it makes > > sense to check for this condition at the beginning of the function and use > > `dyn_cast` instead of `dyn_cast_or_null` in the next check. > > > Do we have callsites that pass null to this function? I don't see a > meaningful semantics for this function if we pass null here. > I thought that `Decl`s are always passed via pointers by convention, but I > may be wrong. After looking at the callsites, they actually suggest that nulls can be passed. Tried adding an assert and it didn't fire when running `check-all`, though. But it's better to be on the safe side. Added a check for null, updated the patch accordingly. Repository: rC Clang https://reviews.llvm.org/D41237 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits