Sema: Fix a crash when main is redeclared as a function-template.

This boils down to us sending invalid function decls to
CheckFunctionDeclaration becauswe we did not consider that CheckMain
could cause the decl to be invalid.  Instead, interogate the new decl's
main-validity and *then* send it over to get CheckFunctionDeclaration'd
if it was still valid after calling CheckMain.


git-svn-id: http://llvm.org/svn/llvm-project/cfe/trunk@185745 91177308-0d34-0410-b5e6-96231b3b80d8