зеркало из https://github.com/microsoft/clang.git
fix PR6433, crash on va_arg of typedef.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98264 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Родитель
32c1a2ae8b
Коммит
a14db75641
|
@ -268,9 +268,9 @@ llvm::Value *DefaultABIInfo::EmitVAArg(llvm::Value *VAListAddr, QualType Ty,
|
|||
ABIArgInfo DefaultABIInfo::classifyArgumentType(QualType Ty,
|
||||
ASTContext &Context,
|
||||
llvm::LLVMContext &VMContext) const {
|
||||
if (CodeGenFunction::hasAggregateLLVMType(Ty)) {
|
||||
if (CodeGenFunction::hasAggregateLLVMType(Ty))
|
||||
return ABIArgInfo::getIndirect(0);
|
||||
} else {
|
||||
|
||||
// Treat an enum type as its underlying type.
|
||||
if (const EnumType *EnumTy = Ty->getAs<EnumType>())
|
||||
Ty = EnumTy->getDecl()->getIntegerType();
|
||||
|
@ -278,7 +278,6 @@ ABIArgInfo DefaultABIInfo::classifyArgumentType(QualType Ty,
|
|||
return (Ty->isPromotableIntegerType() ?
|
||||
ABIArgInfo::getExtend() : ABIArgInfo::getDirect());
|
||||
}
|
||||
}
|
||||
|
||||
/// X86_32ABIInfo - The X86-32 ABI information.
|
||||
class X86_32ABIInfo : public ABIInfo {
|
||||
|
@ -1367,6 +1366,8 @@ llvm::Value *X86_64ABIInfo::EmitVAArg(llvm::Value *VAListAddr, QualType Ty,
|
|||
// i8* reg_save_area;
|
||||
// };
|
||||
unsigned neededInt, neededSSE;
|
||||
|
||||
Ty = CGF.getContext().getCanonicalType(Ty);
|
||||
ABIArgInfo AI = classifyArgumentType(Ty, CGF.getContext(), VMContext,
|
||||
neededInt, neededSSE);
|
||||
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
// RUN: %clang_cc1 -emit-llvm -o - %s
|
||||
|
||||
|
||||
// PR6433 - Don't crash on va_arg(typedef).
|
||||
typedef double gdouble;
|
||||
void focus_changed_cb () {
|
||||
__builtin_va_list pa;
|
||||
double mfloat;
|
||||
mfloat = __builtin_va_arg((pa), gdouble);
|
||||
}
|
||||
|
Загрузка…
Ссылка в новой задаче