[PATCH] D41237: [Frontend] Handle skipped bodies in template instantiations

Ilya Biryukov via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Dec 19 01:44:46 PST 2017

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())
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.

  rC Clang


More information about the cfe-commits mailing list