Prevent codegen crash on sizeof(<function type>), a gcc extension.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@53899 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/CodeGen/CGExprScalar.cpp b/lib/CodeGen/CGExprScalar.cpp
index 5a4236a..0925136 100644
--- a/lib/CodeGen/CGExprScalar.cpp
+++ b/lib/CodeGen/CGExprScalar.cpp
@@ -660,8 +660,9 @@
   uint32_t ResultWidth = 
     static_cast<uint32_t>(CGF.getContext().getTypeSize(RetType));
 
-  // sizeof(void) and __alignof__(void) = 1 as a gcc extension.
-  if (TypeToSize->isVoidType())
+  // sizeof(void) and __alignof__(void) = 1 as a gcc extension. Also
+  // for function types.
+  if (TypeToSize->isVoidType() || TypeToSize->isFunctionType())
     return llvm::ConstantInt::get(llvm::APInt(ResultWidth, 1));
   
   /// FIXME: This doesn't handle VLAs yet!