[cfe-commits] r53899 - /cfe/trunk/lib/CodeGen/CGExprScalar.cpp
Daniel Dunbar
daniel at zuster.org
Mon Jul 21 18:35:47 PDT 2008
Author: ddunbar
Date: Mon Jul 21 20:35:47 2008
New Revision: 53899
URL: http://llvm.org/viewvc/llvm-project?rev=53899&view=rev
Log:
Prevent codegen crash on sizeof(<function type>), a gcc extension.
Modified:
cfe/trunk/lib/CodeGen/CGExprScalar.cpp
Modified: cfe/trunk/lib/CodeGen/CGExprScalar.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExprScalar.cpp?rev=53899&r1=53898&r2=53899&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGExprScalar.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGExprScalar.cpp Mon Jul 21 20:35:47 2008
@@ -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!
More information about the cfe-commits
mailing list