зеркало из https://github.com/microsoft/clang-1.git
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
This commit is contained in:
Родитель
0c980d1997
Коммит
9140845f95
|
@ -660,8 +660,9 @@ Value *ScalarExprEmitter::EmitSizeAlignOf(QualType TypeToSize,
|
|||
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!
|
||||
|
|
Загрузка…
Ссылка в новой задаче