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

Serge Pavlov via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Dec 18 23:07:34 PST 2017

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

  rC Clang


More information about the cfe-commits mailing list