Fix crashes caused by deferencing null pointer when declarations parsing may be delayed.
The body of the declarations may be null.
The crashes were observed on a Windows build.
command-line switches: -fms-compatibility-version=19 -fms-compatibility
To reproduce them, run clang-tidy over the following basic file:
#include <string> int main() {}
Templated functions that aren't used may contains a "null" body even if the decl->hasBody() is returning true.
template <typename T> void f() {} FunctionTemplateDecl 0xd06340 <C:\src\llvm\examples\test.cc:1:1, col:34> col:28 f |-TemplateTypeParmDecl 0xd061e8 <col:11, col:20> col:20 typename T `-FunctionDecl 0xd062d0 <col:23, col:34> col:28 f 'void (void)' `-<<<NULL>>>
Please do not use auto here since the type isn't spelled out in the initializer. (The line directly above it also should not be using auto either.)