From: Victor Leschuk Date: Thu, 20 Oct 2016 00:13:19 +0000 (+0000) Subject: DebugInfo: pass alignment value only if it was forced X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=1a21ba3207012ae792e467a2568a8ff52c2c590c;p=clang DebugInfo: pass alignment value only if it was forced Preparation to implement DW_AT_alignment support: - We pass non-zero align value to DIBuilder only when alignment was forced - Modify tests to match this change Differential Revision: https://reviews.llvm.org/D24426 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@284679 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/CodeGen/CGDebugInfo.cpp b/lib/CodeGen/CGDebugInfo.cpp index 1d80a1bf9d..9b623d7443 100644 --- a/lib/CodeGen/CGDebugInfo.cpp +++ b/lib/CodeGen/CGDebugInfo.cpp @@ -44,6 +44,19 @@ using namespace clang; using namespace clang::CodeGen; +static uint32_t getTypeAlignIfRequired(const Type *Ty, const ASTContext &Ctx) { + auto TI = Ctx.getTypeInfo(Ty); + return TI.AlignIsRequired ? TI.Align : 0; +} + +static uint32_t getTypeAlignIfRequired(QualType Ty, const ASTContext &Ctx) { + return getTypeAlignIfRequired(Ty.getTypePtr(), Ctx); +} + +static uint32_t getDeclAlignIfRequired(const Decl *D, const ASTContext &Ctx) { + return D->hasAttr() ? D->getMaxAlignment() : 0; +} + CGDebugInfo::CGDebugInfo(CodeGenModule &CGM) : CGM(CGM), DebugKind(CGM.getCodeGenOpts().getDebugInfo()), DebugTypeExtRefs(CGM.getCodeGenOpts().DebugTypeExtRefs), @@ -594,21 +607,19 @@ llvm::DIType *CGDebugInfo::CreateType(const BuiltinType *BT) { BTName = BT->getName(CGM.getLangOpts()); break; } - // Bit size, align and offset of the type. + // Bit size and offset of the type. uint64_t Size = CGM.getContext().getTypeSize(BT); - uint32_t Align = CGM.getContext().getTypeAlign(BT); - return DBuilder.createBasicType(BTName, Size, Align, Encoding); + return DBuilder.createBasicType(BTName, Size, Encoding); } llvm::DIType *CGDebugInfo::CreateType(const ComplexType *Ty) { - // Bit size, align and offset of the type. + // Bit size and offset of the type. llvm::dwarf::TypeKind Encoding = llvm::dwarf::DW_ATE_complex_float; if (Ty->isComplexIntegerType()) Encoding = llvm::dwarf::DW_ATE_lo_user; uint64_t Size = CGM.getContext().getTypeSize(Ty); - uint32_t Align = CGM.getContext().getTypeAlign(Ty); - return DBuilder.createBasicType("complex", Size, Align, Encoding); + return DBuilder.createBasicType("complex", Size, Encoding); } llvm::DIType *CGDebugInfo::CreateQualifiedType(QualType Ty, @@ -726,7 +737,7 @@ CGDebugInfo::getOrCreateRecordFwdDecl(const RecordType *Ty, const RecordDecl *D = RD->getDefinition(); if (D && D->isCompleteDefinition()) { Size = CGM.getContext().getTypeSize(Ty); - Align = CGM.getContext().getTypeAlign(Ty); + Align = getDeclAlignIfRequired(D, CGM.getContext()); } // Create the type. @@ -749,7 +760,7 @@ llvm::DIType *CGDebugInfo::CreatePointerLikeType(llvm::dwarf::Tag Tag, // because that does not return the correct value for references. unsigned AS = CGM.getContext().getTargetAddressSpace(PointeeTy); uint64_t Size = CGM.getTarget().getPointerWidth(AS); - uint32_t Align = CGM.getContext().getTypeAlign(Ty); + auto Align = getTypeAlignIfRequired(Ty, CGM.getContext()); if (Tag == llvm::dwarf::DW_TAG_reference_type || Tag == llvm::dwarf::DW_TAG_rvalue_reference_type) @@ -965,21 +976,20 @@ llvm::DIType *CGDebugInfo::createBitFieldType(const FieldDecl *BitFieldDecl, CGM.getTypes().getCGRecordLayout(RD).getBitFieldInfo(BitFieldDecl); uint64_t SizeInBits = BitFieldInfo.Size; assert(SizeInBits > 0 && "found named 0-width bitfield"); - uint32_t AlignInBits = CGM.getContext().getTypeAlign(Ty); uint64_t StorageOffsetInBits = CGM.getContext().toBits(BitFieldInfo.StorageOffset); uint64_t OffsetInBits = StorageOffsetInBits + BitFieldInfo.Offset; llvm::DINode::DIFlags Flags = getAccessFlag(BitFieldDecl->getAccess(), RD); return DBuilder.createBitFieldMemberType( - RecordTy, Name, File, Line, SizeInBits, AlignInBits, OffsetInBits, - StorageOffsetInBits, Flags, DebugType); + RecordTy, Name, File, Line, SizeInBits, OffsetInBits, StorageOffsetInBits, + Flags, DebugType); } llvm::DIType * CGDebugInfo::createFieldType(StringRef name, QualType type, SourceLocation loc, AccessSpecifier AS, uint64_t offsetInBits, - llvm::DIFile *tunit, llvm::DIScope *scope, - const RecordDecl *RD) { + uint32_t AlignInBits, llvm::DIFile *tunit, + llvm::DIScope *scope, const RecordDecl *RD) { llvm::DIType *debugType = getOrCreateType(type, tunit); // Get the location for the field. @@ -987,16 +997,17 @@ CGDebugInfo::createFieldType(StringRef name, QualType type, SourceLocation loc, unsigned line = getLineNumber(loc); uint64_t SizeInBits = 0; - uint32_t AlignInBits = 0; + auto Align = AlignInBits; if (!type->isIncompleteArrayType()) { TypeInfo TI = CGM.getContext().getTypeInfo(type); SizeInBits = TI.Width; - AlignInBits = TI.Align; + if (!Align) + Align = getTypeAlignIfRequired(type, CGM.getContext()); } llvm::DINode::DIFlags flags = getAccessFlag(AS, RD); return DBuilder.createMemberType(scope, name, file, line, SizeInBits, - AlignInBits, offsetInBits, flags, debugType); + Align, offsetInBits, flags, debugType); } void CGDebugInfo::CollectRecordLambdaFields( @@ -1018,9 +1029,10 @@ void CGDebugInfo::CollectRecordLambdaFields( VarDecl *V = C.getCapturedVar(); StringRef VName = V->getName(); llvm::DIFile *VUnit = getOrCreateFile(Loc); + auto Align = getDeclAlignIfRequired(V, CGM.getContext()); llvm::DIType *FieldType = createFieldType( VName, Field->getType(), Loc, Field->getAccess(), - layout.getFieldOffset(fieldno), VUnit, RecordTy, CXXDecl); + layout.getFieldOffset(fieldno), Align, VUnit, RecordTy, CXXDecl); elements.push_back(FieldType); } else if (C.capturesThis()) { // TODO: Need to handle 'this' in some way by probably renaming the @@ -1062,8 +1074,9 @@ CGDebugInfo::CreateRecordStaticField(const VarDecl *Var, llvm::DIType *RecordTy, } llvm::DINode::DIFlags Flags = getAccessFlag(Var->getAccess(), RD); + auto Align = getDeclAlignIfRequired(Var, CGM.getContext()); llvm::DIDerivedType *GV = DBuilder.createStaticMemberType( - RecordTy, VName, VUnit, LineNumber, VTy, Flags, C); + RecordTy, VName, VUnit, LineNumber, VTy, Flags, C, Align); StaticDataMemberCache[Var->getCanonicalDecl()].reset(GV); return GV; } @@ -1083,9 +1096,10 @@ void CGDebugInfo::CollectRecordNormalField( if (field->isBitField()) { FieldType = createBitFieldType(field, RecordTy, RD); } else { + auto Align = getDeclAlignIfRequired(field, CGM.getContext()); FieldType = createFieldType(name, type, field->getLocation(), field->getAccess(), - OffsetInBits, tunit, RecordTy, RD); + OffsetInBits, Align, tunit, RecordTy, RD); } elements.push_back(FieldType); @@ -1181,7 +1195,7 @@ llvm::DISubroutineType *CGDebugInfo::getOrCreateInstanceMethodType( QualType PointeeTy = ThisPtrTy->getPointeeType(); unsigned AS = CGM.getContext().getTargetAddressSpace(PointeeTy); uint64_t Size = CGM.getTarget().getPointerWidth(AS); - uint32_t Align = CGM.getContext().getTypeAlign(ThisPtrTy); + auto Align = getTypeAlignIfRequired(ThisPtrTy, CGM.getContext()); llvm::DIType *PointeeType = getOrCreateType(PointeeTy, Unit); llvm::DIType *ThisPtrType = DBuilder.createPointerType(PointeeType, Size, Align); @@ -1968,7 +1982,7 @@ llvm::DIType *CGDebugInfo::CreateTypeDefinition(const ObjCInterfaceType *Ty, // Bit size, align and offset of the type. uint64_t Size = CGM.getContext().getTypeSize(Ty); - uint32_t Align = CGM.getContext().getTypeAlign(Ty); + auto Align = getTypeAlignIfRequired(Ty, CGM.getContext()); llvm::DINode::DIFlags Flags = llvm::DINode::FlagZero; if (ID->getImplementation()) @@ -2060,7 +2074,7 @@ llvm::DIType *CGDebugInfo::CreateTypeDefinition(const ObjCInterfaceType *Ty, FieldSize = Field->isBitField() ? Field->getBitWidthValue(CGM.getContext()) : CGM.getContext().getTypeSize(FType); - FieldAlign = CGM.getContext().getTypeAlign(FType); + FieldAlign = getTypeAlignIfRequired(FType, CGM.getContext()); } uint64_t FieldOffset; @@ -2134,7 +2148,7 @@ llvm::DIType *CGDebugInfo::CreateType(const VectorType *Ty, llvm::DINodeArray SubscriptArray = DBuilder.getOrCreateArray(Subscript); uint64_t Size = CGM.getContext().getTypeSize(Ty); - uint32_t Align = CGM.getContext().getTypeAlign(Ty); + auto Align = getTypeAlignIfRequired(Ty, CGM.getContext()); return DBuilder.createVectorType(Size, Align, ElementTy, SubscriptArray); } @@ -2146,21 +2160,21 @@ llvm::DIType *CGDebugInfo::CreateType(const ArrayType *Ty, llvm::DIFile *Unit) { // FIXME: make getTypeAlign() aware of VLAs and incomplete array types if (const auto *VAT = dyn_cast(Ty)) { Size = 0; - Align = - CGM.getContext().getTypeAlign(CGM.getContext().getBaseElementType(VAT)); + Align = getTypeAlignIfRequired(CGM.getContext().getBaseElementType(VAT), + CGM.getContext()); } else if (Ty->isIncompleteArrayType()) { Size = 0; if (Ty->getElementType()->isIncompleteType()) Align = 0; else - Align = CGM.getContext().getTypeAlign(Ty->getElementType()); + Align = getTypeAlignIfRequired(Ty->getElementType(), CGM.getContext()); } else if (Ty->isIncompleteType()) { Size = 0; Align = 0; } else { // Size and align of the whole array, not the element type. Size = CGM.getContext().getTypeSize(Ty); - Align = CGM.getContext().getTypeAlign(Ty); + Align = getTypeAlignIfRequired(Ty, CGM.getContext()); } // Add the dimensions of the array. FIXME: This loses CV qualifiers from @@ -2269,7 +2283,7 @@ llvm::DIType *CGDebugInfo::CreateEnumType(const EnumType *Ty) { uint32_t Align = 0; if (!ED->getTypeForDecl()->isIncompleteType()) { Size = CGM.getContext().getTypeSize(ED->getTypeForDecl()); - Align = CGM.getContext().getTypeAlign(ED->getTypeForDecl()); + Align = getDeclAlignIfRequired(ED, CGM.getContext()); } SmallString<256> FullName = getUniqueTagTypeName(Ty, CGM, TheCU); @@ -2312,7 +2326,7 @@ llvm::DIType *CGDebugInfo::CreateTypeDefinition(const EnumType *Ty) { uint32_t Align = 0; if (!ED->getTypeForDecl()->isIncompleteType()) { Size = CGM.getContext().getTypeSize(ED->getTypeForDecl()); - Align = CGM.getContext().getTypeAlign(ED->getTypeForDecl()); + Align = getDeclAlignIfRequired(ED, CGM.getContext()); } SmallString<256> FullName = getUniqueTagTypeName(Ty, CGM, TheCU); @@ -2609,7 +2623,7 @@ llvm::DICompositeType *CGDebugInfo::CreateLimitedType(const RecordType *Ty) { return getOrCreateRecordFwdDecl(Ty, RDContext); uint64_t Size = CGM.getContext().getTypeSize(Ty); - uint32_t Align = CGM.getContext().getTypeAlign(Ty); + auto Align = getDeclAlignIfRequired(D, CGM.getContext()); SmallString<256> FullName = getUniqueTagTypeName(Ty, CGM, TheCU); @@ -2678,7 +2692,7 @@ llvm::DIType *CGDebugInfo::CreateMemberType(llvm::DIFile *Unit, QualType FType, StringRef Name, uint64_t *Offset) { llvm::DIType *FieldTy = CGDebugInfo::getOrCreateType(FType, Unit); uint64_t FieldSize = CGM.getContext().getTypeSize(FType); - uint32_t FieldAlign = CGM.getContext().getTypeAlign(FType); + auto FieldAlign = getTypeAlignIfRequired(FType, CGM.getContext()); llvm::DIType *Ty = DBuilder.createMemberType(Unit, Name, Unit, 0, FieldSize, FieldAlign, *Offset, llvm::DINode::FlagZero, FieldTy); @@ -2812,9 +2826,10 @@ CGDebugInfo::getGlobalVariableForwardDeclaration(const VarDecl *VD) { unsigned Line = getLineNumber(Loc); collectVarDeclProps(VD, Unit, Line, T, Name, LinkageName, DContext); + auto Align = getDeclAlignIfRequired(VD, CGM.getContext()); auto *GV = DBuilder.createTempGlobalVariableFwdDecl( DContext, Name, LinkageName, Unit, Line, getOrCreateType(T, Unit), - !VD->isExternallyVisible(), nullptr, nullptr); + !VD->isExternallyVisible(), nullptr, nullptr, Align); FwdDeclReplaceMap.emplace_back( std::piecewise_construct, std::make_tuple(cast(VD->getCanonicalDecl())), @@ -3243,6 +3258,9 @@ void CGDebugInfo::EmitDeclare(const VarDecl *VD, llvm::Value *Storage, llvm::DINode::DIFlags Flags = llvm::DINode::FlagZero; if (VD->isImplicit()) Flags |= llvm::DINode::FlagArtificial; + + auto Align = getDeclAlignIfRequired(VD, CGM.getContext()); + // If this is the first argument and it is implicit then // give it an object pointer flag. // FIXME: There has to be a better way to do this, but for static @@ -3277,7 +3295,7 @@ void CGDebugInfo::EmitDeclare(const VarDecl *VD, llvm::Value *Storage, ? DBuilder.createParameterVariable(Scope, VD->getName(), *ArgNo, Unit, Line, Ty) : DBuilder.createAutoVariable(Scope, VD->getName(), Unit, - Line, Ty); + Line, Ty, Align); // Insert an llvm.dbg.declare into the current block. DBuilder.insertDeclare(Storage, D, DBuilder.createExpression(Expr), @@ -3307,9 +3325,10 @@ void CGDebugInfo::EmitDeclare(const VarDecl *VD, llvm::Value *Storage, continue; // Use VarDecl's Tag, Scope and Line number. + auto FieldAlign = getDeclAlignIfRequired(Field, CGM.getContext()); auto *D = DBuilder.createAutoVariable( Scope, FieldName, Unit, Line, FieldTy, CGM.getLangOpts().Optimize, - Flags | llvm::DINode::FlagArtificial); + Flags | llvm::DINode::FlagArtificial, FieldAlign); // Insert an llvm.dbg.declare into the current block. DBuilder.insertDeclare(Storage, D, DBuilder.createExpression(Expr), @@ -3320,13 +3339,13 @@ void CGDebugInfo::EmitDeclare(const VarDecl *VD, llvm::Value *Storage, } // Create the descriptor for the variable. - auto *D = - ArgNo - ? DBuilder.createParameterVariable(Scope, Name, *ArgNo, Unit, Line, - Ty, CGM.getLangOpts().Optimize, - Flags) - : DBuilder.createAutoVariable(Scope, Name, Unit, Line, Ty, - CGM.getLangOpts().Optimize, Flags); + auto *D = ArgNo + ? DBuilder.createParameterVariable( + Scope, Name, *ArgNo, Unit, Line, Ty, + CGM.getLangOpts().Optimize, Flags) + : DBuilder.createAutoVariable(Scope, Name, Unit, Line, Ty, + CGM.getLangOpts().Optimize, Flags, + Align); // Insert an llvm.dbg.declare into the current block. DBuilder.insertDeclare(Storage, D, DBuilder.createExpression(Expr), @@ -3405,9 +3424,10 @@ void CGDebugInfo::EmitDeclareOfBlockDeclRefVariable( } // Create the descriptor for the variable. + auto Align = getDeclAlignIfRequired(VD, CGM.getContext()); auto *D = DBuilder.createAutoVariable( cast(LexicalBlockStack.back()), VD->getName(), Unit, - Line, Ty); + Line, Ty, false, llvm::DINode::FlagZero, Align); // Insert an llvm.dbg.declare into the current block. auto DL = llvm::DebugLoc::get(Line, Column, LexicalBlockStack.back()); @@ -3536,17 +3556,19 @@ void CGDebugInfo::EmitDeclareOfBlockLiteralArgVariable(const CGBlockInfo &block, llvm::DIType *fieldType; if (capture->isByRef()) { TypeInfo PtrInfo = C.getTypeInfo(C.VoidPtrTy); + auto Align = PtrInfo.AlignIsRequired ? PtrInfo.Align : 0; // FIXME: this creates a second copy of this type! uint64_t xoffset; fieldType = EmitTypeForVarWithBlocksAttr(variable, &xoffset); fieldType = DBuilder.createPointerType(fieldType, PtrInfo.Width); - fieldType = DBuilder.createMemberType( - tunit, name, tunit, line, PtrInfo.Width, PtrInfo.Align, offsetInBits, - llvm::DINode::FlagZero, fieldType); + fieldType = DBuilder.createMemberType(tunit, name, tunit, line, + PtrInfo.Width, Align, offsetInBits, + llvm::DINode::FlagZero, fieldType); } else { + auto Align = getDeclAlignIfRequired(variable, CGM.getContext()); fieldType = createFieldType(name, variable->getType(), loc, AS_public, - offsetInBits, tunit, tunit); + offsetInBits, Align, tunit, tunit); } fields.push_back(fieldType); } @@ -3559,8 +3581,7 @@ void CGDebugInfo::EmitDeclareOfBlockLiteralArgVariable(const CGBlockInfo &block, llvm::DIType *type = DBuilder.createStructType(tunit, typeName.str(), tunit, line, - CGM.getContext().toBits(block.BlockSize), - CGM.getContext().toBits(block.BlockAlign), + CGM.getContext().toBits(block.BlockSize), 0, llvm::DINode::FlagZero, nullptr, fieldsArray); type = DBuilder.createPointerType(type, CGM.PointerWidthInBits); @@ -3654,10 +3675,11 @@ void CGDebugInfo::EmitGlobalVariable(llvm::GlobalVariable *Var, "unnamed non-anonymous struct or union?"); GV = CollectAnonRecordDecls(RD, Unit, LineNo, LinkageName, Var, DContext); } else { + auto Align = getDeclAlignIfRequired(D, CGM.getContext()); GV = DBuilder.createGlobalVariable( DContext, DeclName, LinkageName, Unit, LineNo, getOrCreateType(T, Unit), Var->hasLocalLinkage(), /*Expr=*/nullptr, - getOrCreateStaticDataMemberDeclarationOrNull(D)); + getOrCreateStaticDataMemberDeclarationOrNull(D), Align); Var->addDebugInfo(GV); } DeclCache[D->getCanonicalDecl()].reset(GV); @@ -3667,6 +3689,7 @@ void CGDebugInfo::EmitGlobalVariable(const ValueDecl *VD, const APValue &Init) { assert(DebugKind >= codegenoptions::LimitedDebugInfo); if (VD->hasAttr()) return; + auto Align = getDeclAlignIfRequired(VD, CGM.getContext()); // Create the descriptor for the variable. llvm::DIFile *Unit = getOrCreateFile(VD->getLocation()); StringRef Name = VD->getName(); @@ -3709,7 +3732,8 @@ void CGDebugInfo::EmitGlobalVariable(const ValueDecl *VD, const APValue &Init) { DBuilder.createConstantValueExpression(Init.getInt().getExtValue()); GV.reset(DBuilder.createGlobalVariable( DContext, Name, StringRef(), Unit, getLineNumber(VD->getLocation()), Ty, - true, InitExpr, getOrCreateStaticDataMemberDeclarationOrNull(VarD))); + true, InitExpr, getOrCreateStaticDataMemberDeclarationOrNull(VarD), + Align)); } llvm::DIScope *CGDebugInfo::getCurrentContextDescriptor(const Decl *D) { diff --git a/lib/CodeGen/CGDebugInfo.h b/lib/CodeGen/CGDebugInfo.h index 17a9463314..d2af9be9b6 100644 --- a/lib/CodeGen/CGDebugInfo.h +++ b/lib/CodeGen/CGDebugInfo.h @@ -233,11 +233,21 @@ class CGDebugInfo { CollectCXXTemplateParams(const ClassTemplateSpecializationDecl *TS, llvm::DIFile *F); + llvm::DIType *createFieldType(StringRef name, QualType type, + SourceLocation loc, AccessSpecifier AS, + uint64_t offsetInBits, + uint32_t AlignInBits, + llvm::DIFile *tunit, llvm::DIScope *scope, + const RecordDecl *RD = nullptr); + llvm::DIType *createFieldType(StringRef name, QualType type, SourceLocation loc, AccessSpecifier AS, uint64_t offsetInBits, llvm::DIFile *tunit, llvm::DIScope *scope, - const RecordDecl *RD = nullptr); + const RecordDecl *RD = nullptr) { + return createFieldType(name, type, loc, AS, offsetInBits, 0, tunit, scope, + RD); + } /// Create new bit field member. llvm::DIType *createBitFieldType(const FieldDecl *BitFieldDecl, diff --git a/test/CodeGen/debug-info-packed-struct.c b/test/CodeGen/debug-info-packed-struct.c index 46f96aac76..6441a740e3 100644 --- a/test/CodeGen/debug-info-packed-struct.c +++ b/test/CodeGen/debug-info-packed-struct.c @@ -19,9 +19,9 @@ struct layout0 { }; // CHECK: l0_ofs0 // CHECK: !DIDerivedType(tag: DW_TAG_member, name: "l0_ofs8", -// CHECK-SAME: {{.*}}size: 64, align: 64, offset: 64) +// CHECK-SAME: {{.*}}size: 64, offset: 64) // CHECK: !DIDerivedType(tag: DW_TAG_member, name: "l0_ofs16", -// CHECK-SAME: {{.*}}size: 1, align: 32, offset: 128, flags: DIFlagBitField, extraData: i64 128) +// CHECK-SAME: {{.*}}size: 1, offset: 128, flags: DIFlagBitField, extraData: i64 128) // --------------------------------------------------------------------- @@ -38,9 +38,9 @@ struct layout1 { }; // CHECK: l1_ofs0 // CHECK: !DIDerivedType(tag: DW_TAG_member, name: "l1_ofs1", -// CHECK-SAME: {{.*}}size: 64, align: 8, offset: 8) +// CHECK-SAME: {{.*}}size: 64, offset: 8) // CHECK: !DIDerivedType(tag: DW_TAG_member, name: "l1_ofs9", -// CHECK-SAME: {{.*}}size: 1, align: 32, offset: 72, flags: DIFlagBitField, extraData: i64 72) +// CHECK-SAME: {{.*}}size: 1, offset: 72, flags: DIFlagBitField, extraData: i64 72) // --------------------------------------------------------------------- @@ -59,9 +59,9 @@ struct layout2 { #pragma pack() // CHECK: l2_ofs0 // CHECK: !DIDerivedType(tag: DW_TAG_member, name: "l2_ofs1", -// CHECK-SAME: {{.*}}size: 64, align: 8, offset: 8) +// CHECK-SAME: {{.*}}size: 64, offset: 8) // CHECK: !DIDerivedType(tag: DW_TAG_member, name: "l2_ofs9", -// CHECK-SAME: {{.*}}size: 1, align: 32, offset: 72, flags: DIFlagBitField, extraData: i64 72) +// CHECK-SAME: {{.*}}size: 1, offset: 72, flags: DIFlagBitField, extraData: i64 72) @@ -81,9 +81,9 @@ struct layout3 { #pragma pack() // CHECK: l3_ofs0 // CHECK: !DIDerivedType(tag: DW_TAG_member, name: "l3_ofs4", -// CHECK-SAME: {{.*}}size: 64, align: 32, offset: 32) +// CHECK-SAME: {{.*}}size: 64, offset: 32) // CHECK: !DIDerivedType(tag: DW_TAG_member, name: "l3_ofs12", -// CHECK-SAME: {{.*}}size: 1, align: 32, offset: 96, flags: DIFlagBitField, extraData: i64 96) +// CHECK-SAME: {{.*}}size: 1, offset: 96, flags: DIFlagBitField, extraData: i64 96) struct layout3 l3; struct layout0 l0; diff --git a/test/CodeGen/debug-info-vector.c b/test/CodeGen/debug-info-vector.c index 6b27573578..93e63926c9 100644 --- a/test/CodeGen/debug-info-vector.c +++ b/test/CodeGen/debug-info-vector.c @@ -6,6 +6,6 @@ v4si a; // Test that we get an array type that's also a vector out of debug. // CHECK: !DICompositeType(tag: DW_TAG_array_type, // CHECK-SAME: baseType: ![[INT:[0-9]+]] -// CHECK-SAME: size: 128, align: 128 +// CHECK-SAME: size: 128 // CHECK-SAME: DIFlagVector // CHECK: ![[INT]] = !DIBasicType(name: "int" diff --git a/test/CodeGenCXX/debug-info-calling-conventions.cpp b/test/CodeGenCXX/debug-info-calling-conventions.cpp index 51d801e35e..db7fbd2340 100644 --- a/test/CodeGenCXX/debug-info-calling-conventions.cpp +++ b/test/CodeGenCXX/debug-info-calling-conventions.cpp @@ -8,7 +8,7 @@ void A::thiscallcc() {} // CHECK: !DISubprogram(name: "thiscallcc", {{.*}} type: ![[thiscallty:[^,]*]], {{.*}}) // CHECK: ![[thiscallty]] = !DISubroutineType(cc: DW_CC_BORLAND_thiscall, types: ![[thisargs:[^,)]*]]) // CHECK: ![[thisargs]] = !{null, ![[thisptrty:[^,}]*]]} -// CHECK: ![[thisptrty]] = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !{{.*}}, size: 32, align: 32, flags: DIFlagArtificial | DIFlagObjectPointer) +// CHECK: ![[thisptrty]] = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !{{.*}}, size: 32, flags: DIFlagArtificial | DIFlagObjectPointer) void cdeclcc() {} void __fastcall fastcallcc() {} diff --git a/test/CodeGenCXX/debug-info-enum-class.cpp b/test/CodeGenCXX/debug-info-enum-class.cpp index 44daf412d3..b615d5b096 100644 --- a/test/CodeGenCXX/debug-info-enum-class.cpp +++ b/test/CodeGenCXX/debug-info-enum-class.cpp @@ -13,7 +13,7 @@ D d; // CHECK: !DICompositeType(tag: DW_TAG_enumeration_type, name: "A" // CHECK-SAME: line: 3 // CHECK-SAME: baseType: ![[INT:[0-9]+]] -// CHECK-SAME: size: 32, align: 32 +// CHECK-SAME: size: 32 // CHECK-NOT: offset: // CHECK-NOT: flags: // CHECK-SAME: ){{$}} @@ -21,7 +21,7 @@ D d; // CHECK: !DICompositeType(tag: DW_TAG_enumeration_type, name: "B" // CHECK-SAME: line: 4 // CHECK-SAME: baseType: ![[ULONG:[0-9]+]] -// CHECK-SAME: size: 64, align: 64 +// CHECK-SAME: size: 64 // CHECK-NOT: offset: // CHECK-NOT: flags: // CHECK-SAME: ){{$}} @@ -29,7 +29,7 @@ D d; // CHECK: !DICompositeType(tag: DW_TAG_enumeration_type, name: "C" // CHECK-SAME: line: 5 // CHECK-NOT: baseType: -// CHECK-SAME: size: 32, align: 32 +// CHECK-SAME: size: 32 // CHECK-NOT: offset: // CHECK-NOT: flags: // CHECK-SAME: ){{$}} @@ -91,7 +91,7 @@ void f2(E) { // CHECK: !DICompositeType(tag: DW_TAG_enumeration_type, name: "D" // CHECK-SAME: line: 6 -// CHECK-SAME: size: 16, align: 16 +// CHECK-SAME: size: 16 // CHECK-NOT: offset: // CHECK-SAME: flags: DIFlagFwdDecl diff --git a/test/CodeGenCXX/debug-info-indirect-field-decl.cpp b/test/CodeGenCXX/debug-info-indirect-field-decl.cpp index 70b233cac4..126e1f6bd1 100644 --- a/test/CodeGenCXX/debug-info-indirect-field-decl.cpp +++ b/test/CodeGenCXX/debug-info-indirect-field-decl.cpp @@ -11,13 +11,13 @@ struct Bar { // CHECK: !DIDerivedType(tag: DW_TAG_member, scope: // CHECK-SAME: line: [[@LINE+4]] // CHECK-SAME: baseType: ![[UNION:[0-9]+]] - // CHECK-SAME: size: 32, align: 32, offset: 32 + // CHECK-SAME: size: 32, offset: 32 // CHECK: ![[UNION]] = distinct !DICompositeType(tag: DW_TAG_union_type,{{.*}} identifier: "_ZTSN3BarUt_E") union { // CHECK: !DIDerivedType(tag: DW_TAG_member, name: "i2", // CHECK-SAME: line: [[@LINE+5]] // CHECK-SAME: baseType: ![[INT]] - // CHECK-SAME: size: 32, align: 32 + // CHECK-SAME: size: 32 // CHECK-NOT: offset: // CHECK-SAME: ){{$}} int i2; diff --git a/test/CodeGenCXX/debug-info-ms-bitfields.cpp b/test/CodeGenCXX/debug-info-ms-bitfields.cpp index 07d4c0c6c7..e42330143b 100644 --- a/test/CodeGenCXX/debug-info-ms-bitfields.cpp +++ b/test/CodeGenCXX/debug-info-ms-bitfields.cpp @@ -7,4 +7,4 @@ struct S { short x : 8; } s; -// CHECK: !DIDerivedType(tag: DW_TAG_member, name: "x", {{.*}}, size: 8, align: 16, offset: 16, flags: DIFlagBitField, extraData: i64 8) +// CHECK: !DIDerivedType(tag: DW_TAG_member, name: "x", {{.*}}, size: 8, offset: 16, flags: DIFlagBitField, extraData: i64 8) diff --git a/test/CodeGenCXX/debug-info-ms-ptr-to-member.cpp b/test/CodeGenCXX/debug-info-ms-ptr-to-member.cpp index ddb22a1620..1f4c90484b 100644 --- a/test/CodeGenCXX/debug-info-ms-ptr-to-member.cpp +++ b/test/CodeGenCXX/debug-info-ms-ptr-to-member.cpp @@ -44,10 +44,10 @@ void (Incomplete::**ppmf)(); // CHECK-SAME: ){{$}} // CHECK: distinct !DIGlobalVariable(name: "ppmd", {{.*}} type: ![[ppmd:[^, ]*]], {{.*}}) -// CHECK: ![[ppmd]] = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: ![[ppmd2:[^ ]*]], size: 64, align: 64) +// CHECK: ![[ppmd]] = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: ![[ppmd2:[^ ]*]], size: 64) // CHECK: ![[ppmd2]] = !DIDerivedType(tag: DW_TAG_ptr_to_member_type, baseType: !{{[0-9]*}}, extraData: !{{[0-9]*}}){{$}} // CHECK: distinct !DIGlobalVariable(name: "ppmf", {{.*}} type: ![[ppmf:[^, ]*]], {{.*}}) -// CHECK: ![[ppmf]] = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: ![[ppmf2:[^ ]*]], size: 64, align: 64) +// CHECK: ![[ppmf]] = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: ![[ppmf2:[^ ]*]], size: 64) // CHECK: ![[ppmf2]] = !DIDerivedType(tag: DW_TAG_ptr_to_member_type, baseType: !{{[0-9]*}}, extraData: !{{[0-9]*}}){{$}} // CHECK: ![[pmd_a]] = !DIDerivedType(tag: DW_TAG_ptr_to_member_type, baseType: !{{.*}}, size: 32, flags: DIFlagSingleInheritance, {{.*}}) diff --git a/test/CodeGenCXX/debug-info-rvalue-ref.cpp b/test/CodeGenCXX/debug-info-rvalue-ref.cpp index edb93ae46c..de0f65ad9a 100644 --- a/test/CodeGenCXX/debug-info-rvalue-ref.cpp +++ b/test/CodeGenCXX/debug-info-rvalue-ref.cpp @@ -8,5 +8,5 @@ void foo (int &&i) printf("%d\n", i); } -// CHECK: !DIDerivedType(tag: DW_TAG_rvalue_reference_type, baseType: ![[INT:[0-9]+]], size: 64, align: 64) +// CHECK: !DIDerivedType(tag: DW_TAG_rvalue_reference_type, baseType: ![[INT:[0-9]+]], size: 64) // CHECK: ![[INT]] = !DIBasicType(name: "int" diff --git a/test/CodeGenCXX/debug-info-template-quals.cpp b/test/CodeGenCXX/debug-info-template-quals.cpp index 7a0d0d4a27..cfee78d974 100644 --- a/test/CodeGenCXX/debug-info-template-quals.cpp +++ b/test/CodeGenCXX/debug-info-template-quals.cpp @@ -17,10 +17,10 @@ void foo (const char *c) { // CHECK: [[P:![0-9]*]] = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: [[CON:![0-9]*]] // CHECK: [[CON]] = !DIDerivedType(tag: DW_TAG_const_type, baseType: [[CH:![0-9]*]] -// CHECK: [[CH]] = !DIBasicType(name: "char", size: 8, align: 8, encoding: DW_ATE_signed_char) +// CHECK: [[CH]] = !DIBasicType(name: "char", size: 8, encoding: DW_ATE_signed_char) // CHECK: [[BS:.*]] = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "basic_string" // CHECK-SAME: line: 4 -// CHECK-SAME: size: 8, align: 8 +// CHECK-SAME: size: 8 // CHECK: [[TYPE:![0-9]*]] = !DISubroutineType(types: [[ARGS:.*]]) // CHECK: [[ARGS]] = !{!{{.*}}, !{{.*}}, [[P]], [[R:.*]]} diff --git a/test/CodeGenCXX/debug-info-template.cpp b/test/CodeGenCXX/debug-info-template.cpp index 7dc24b0e16..d4a7112a58 100644 --- a/test/CodeGenCXX/debug-info-template.cpp +++ b/test/CodeGenCXX/debug-info-template.cpp @@ -62,7 +62,7 @@ TC // CHECK: [[FARG1]] = !DIDerivedType(tag: DW_TAG_pointer_type, // CHECK-SAME: baseType: ![[FOO]] // CHECK-NOT: line: -// CHECK-SAME: size: 64, align: 64 +// CHECK-SAME: size: 64 // CHECK-NOT: offset: 0 // CHECK-SAME: DIFlagArtificial // CHECK: [[FUNTYPE:![0-9]*]] = !DISubroutineType(types: [[FUNARGS:![0-9]*]]) @@ -151,7 +151,7 @@ PaddingAtEnd PaddedObj = {}; // CHECK-SAME: templateParams: [[PTOARGS:![0-9]*]] // CHECK: [[PTOARGS]] = !{[[PTOARG1:![0-9]*]]} // CHECK: [[PTOARG1]] = !DITemplateValueParameter(type: [[CONST_PADDINGATEND_PTR:![0-9]*]], value: %struct.PaddingAtEnd* @PaddedObj) -// CHECK: [[CONST_PADDINGATEND_PTR]] = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: ![[PADDINGATEND]], size: 64, align: 64) +// CHECK: [[CONST_PADDINGATEND_PTR]] = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: ![[PADDINGATEND]], size: 64) template struct PaddingAtEndTemplate { }; diff --git a/test/CodeGenCXX/debug-info-union.cpp b/test/CodeGenCXX/debug-info-union.cpp index 19e67418f9..cffe6e961c 100644 --- a/test/CodeGenCXX/debug-info-union.cpp +++ b/test/CodeGenCXX/debug-info-union.cpp @@ -12,7 +12,7 @@ E e; // CHECK: !DICompositeType(tag: DW_TAG_union_type, name: "E" // CHECK-SAME: line: 3 -// CHECK-SAME: size: 32, align: 32 +// CHECK-SAME: size: 32 // CHECK-NOT: offset: // CHECK-SAME: {{$}} // CHECK: !DISubprogram(name: "bb"{{.*}}, line: 6 diff --git a/test/CodeGenCXX/debug-info-uuid.cpp b/test/CodeGenCXX/debug-info-uuid.cpp index b3b058090f..70b205ad09 100644 --- a/test/CodeGenCXX/debug-info-uuid.cpp +++ b/test/CodeGenCXX/debug-info-uuid.cpp @@ -22,7 +22,6 @@ // CHECK: [[CONST_GUID_PTR]] = !DIDerivedType(tag: DW_TAG_pointer_type // CHECK-SAME: baseType: [[CONST_GUID:![0-9]*]] // CHECK-SAME: size: 64 -// CHECK-SAME: align: 64 // CHECK-ITANIUM: !DICompositeType(tag: DW_TAG_structure_type, name: "tmpl_guid2<__uuidof(uuid)>" // CHECK-ITANIUM-SAME: identifier: "_ZTS10tmpl_guid2IXu8__uuidoft4uuidEE" diff --git a/test/CodeGenCXX/debug-info-vla.cpp b/test/CodeGenCXX/debug-info-vla.cpp index cd9b7f6c45..0feba1b193 100644 --- a/test/CodeGenCXX/debug-info-vla.cpp +++ b/test/CodeGenCXX/debug-info-vla.cpp @@ -9,7 +9,6 @@ int (*fp)(int[][*]) = nullptr; // CHECK: !DICompositeType(tag: DW_TAG_array_type, // CHECK-NOT: size: -// CHECK-SAME: align: 32 // CHECK-SAME: elements: [[ELEM_TYPE:![0-9]+]] // CHECK: [[ELEM_TYPE]] = !{[[NOCOUNT:.*]]} // CHECK: [[NOCOUNT]] = !DISubrange(count: -1) diff --git a/test/CodeGenCXX/debug-info-zero-length-arrays.cpp b/test/CodeGenCXX/debug-info-zero-length-arrays.cpp index dc7558aa39..9f8eab624b 100644 --- a/test/CodeGenCXX/debug-info-zero-length-arrays.cpp +++ b/test/CodeGenCXX/debug-info-zero-length-arrays.cpp @@ -10,7 +10,6 @@ A a; // CHECK-SAME: baseType: [[ARRAY_TYPE:![0-9]+]] // CHECK: [[ARRAY_TYPE]] = !DICompositeType(tag: DW_TAG_array_type, // CHECK-NOT: size: -// CHECK-SAME: align: 32 // CHECK-SAME: elements: [[ELEM_TYPE:![0-9]+]] // CHECK: [[ELEM_TYPE]] = !{[[SUBRANGE:.*]]} // CHECK: [[SUBRANGE]] = !DISubrange(count: -1) diff --git a/test/CodeGenCXX/debug-info.cpp b/test/CodeGenCXX/debug-info.cpp index 8ff7cf9e7a..722b9c08f8 100644 --- a/test/CodeGenCXX/debug-info.cpp +++ b/test/CodeGenCXX/debug-info.cpp @@ -68,8 +68,8 @@ namespace VirtualBase { struct A { int a; }; struct B : virtual A { int b; }; // BOTH: ![[VBASE_B:[0-9]+]] ={{.*}}!DICompositeType(tag: DW_TAG_structure_type, name: "B",{{.*}} line: [[@LINE-1]], -// MSVC-SAME: size: 96, align: 32 -// CHECK-SAME: size: 128, align: 64, +// MSVC-SAME: size: 96 +// CHECK-SAME: size: 128, // BOTH-NOT: offset: // BOTH-NOT: DIFlagFwdDecl // BOTH-SAME: elements: [[VBASE_B_DEF:![0-9]+]] diff --git a/test/CodeGenCXX/debug-lambda-this.cpp b/test/CodeGenCXX/debug-lambda-this.cpp index 4af3d81983..eecbac6520 100644 --- a/test/CodeGenCXX/debug-lambda-this.cpp +++ b/test/CodeGenCXX/debug-lambda-this.cpp @@ -13,10 +13,10 @@ int D::d(int x) { } // CHECK: ![[D:[0-9]+]] = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "D", -// CHECK: ![[POINTER:.*]] = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: ![[D]], size: 64, align: 64) +// CHECK: ![[POINTER:.*]] = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: ![[D]], size: 64) // CHECK: !DIDerivedType(tag: DW_TAG_member, name: "this", // CHECK-SAME: line: 11 // CHECK-SAME: baseType: ![[POINTER]] -// CHECK-SAME: size: 64, align: 64 +// CHECK-SAME: size: 64 // CHECK-NOT: offset: 0 // CHECK-SAME: ){{$}} diff --git a/test/CodeGenObjC/block-byref-debuginfo.m b/test/CodeGenObjC/block-byref-debuginfo.m index f115666342..3ddb376dde 100644 --- a/test/CodeGenObjC/block-byref-debuginfo.m +++ b/test/CodeGenObjC/block-byref-debuginfo.m @@ -5,7 +5,6 @@ // expression (256) that locates it inside of the byref descriptor: // CHECK: !DIDerivedType(tag: DW_TAG_member, name: "foo", // CHECK-NOT: line: -// CHECK-SAME: align: 64 // CHECK-SAME: offset: 256 struct Foo { diff --git a/test/CodeGenObjC/debug-info-block-type.m b/test/CodeGenObjC/debug-info-block-type.m index 565bc86e8b..4bdd18035e 100644 --- a/test/CodeGenObjC/debug-info-block-type.m +++ b/test/CodeGenObjC/debug-info-block-type.m @@ -17,6 +17,6 @@ int main() SomeKindOfPredicate p = ^BOOL(id obj) { return obj != nil; }; // CHECK: !DIDerivedType(tag: DW_TAG_member, name: "__FuncPtr", // CHECK-SAME: line: [[@LINE-2]] - // CHECK-SAME: size: 64, align: 64, offset: 128, + // CHECK-SAME: size: 64, offset: 128, return p(nil); } diff --git a/test/CodeGenObjC/debug-info-ivars-extension.m b/test/CodeGenObjC/debug-info-ivars-extension.m index 0709d2ad24..2091b56b9a 100644 --- a/test/CodeGenObjC/debug-info-ivars-extension.m +++ b/test/CodeGenObjC/debug-info-ivars-extension.m @@ -30,7 +30,7 @@ void gorf (I* pg) { // CHECK: !DIDerivedType(tag: DW_TAG_member, name: "a" // CHECK-SAME: line: 7 // CHECK-SAME: baseType: ![[INT:[0-9]+]] -// CHECK-SAME: size: 32, align: 32 +// CHECK-SAME: size: 32 // CHECK-NOT: offset: // CHECK-SAME: flags: DIFlagPublic // CHECK: ![[INT]] = !DIBasicType(name: "int" @@ -42,6 +42,6 @@ void gorf (I* pg) { // CHECK: !DIDerivedType(tag: DW_TAG_member, name: "b" // CHECK-SAME: line: 18 // CHECK-SAME: baseType: ![[INT]] -// CHECK-SAME: size: 32, align: 32 +// CHECK-SAME: size: 32 // CHECK-NOT: offset: // CHECK-SAME: flags: DIFlagPublic diff --git a/test/CodeGenObjC/debug-info-ivars-private.m b/test/CodeGenObjC/debug-info-ivars-private.m index f533ef3adc..583868e1b1 100644 --- a/test/CodeGenObjC/debug-info-ivars-private.m +++ b/test/CodeGenObjC/debug-info-ivars-private.m @@ -35,13 +35,13 @@ __attribute((objc_root_class)) @interface NSObject { // CHECK: !DIDerivedType(tag: DW_TAG_member, name: "foo" // CHECK-SAME: line: 14 // CHECK-SAME: baseType: ![[INT:[0-9]+]] -// CHECK-SAME: size: 32, align: 32, +// CHECK-SAME: size: 32, // CHECK-NOT: offset: // CHECK-SAME: flags: DIFlagProtected // CHECK: ![[INT]] = !DIBasicType(name: "int" // CHECK: !DIDerivedType(tag: DW_TAG_member, name: "bar" // CHECK-SAME: line: 27 // CHECK-SAME: baseType: ![[INT:[0-9]+]] -// CHECK-SAME: size: 32, align: 32, +// CHECK-SAME: size: 32, // CHECK-NOT: offset: // CHECK-SAME: flags: DIFlagPrivate diff --git a/test/CodeGenObjC/debug-info-ivars.m b/test/CodeGenObjC/debug-info-ivars.m index c6e544ae1c..996562dae2 100644 --- a/test/CodeGenObjC/debug-info-ivars.m +++ b/test/CodeGenObjC/debug-info-ivars.m @@ -21,24 +21,24 @@ __attribute((objc_root_class)) @interface NSObject { // CHECK: !DIDerivedType(tag: DW_TAG_member, name: "i" // CHECK-SAME: line: 10 // CHECK-SAME: baseType: ![[INT:[0-9]+]] -// CHECK-SAME: size: 32, align: 32, +// CHECK-SAME: size: 32, // CHECK-NOT: offset: // CHECK-SAME: flags: DIFlagProtected // CHECK: ![[INT]] = !DIBasicType(name: "int" // CHECK: !DIDerivedType(tag: DW_TAG_member, name: "flag_1" // CHECK-SAME: line: 11 // CHECK-SAME: baseType: ![[UNSIGNED:[0-9]+]] -// CHECK-SAME: size: 9, align: 32, +// CHECK-SAME: size: 9, // CHECK-NOT: offset: // CHECK-SAME: flags: DIFlagProtected // CHECK: ![[UNSIGNED]] = !DIBasicType(name: "unsigned int" // CHECK: !DIDerivedType(tag: DW_TAG_member, name: "flag_2" // CHECK-SAME: line: 12 // CHECK-SAME: baseType: ![[UNSIGNED]] -// CHECK-SAME: size: 9, align: 32, offset: 1, +// CHECK-SAME: size: 9, offset: 1, // CHECK-SAME: flags: DIFlagProtected // CHECK: !DIDerivedType(tag: DW_TAG_member, name: "flag_3" // CHECK-SAME: line: 14 // CHECK-SAME: baseType: ![[UNSIGNED]] -// CHECK-SAME: size: 9, align: 32, offset: 3, +// CHECK-SAME: size: 9, offset: 3, // CHECK-SAME: flags: DIFlagProtected diff --git a/test/CodeGenObjCXX/debug-info-cyclic.mm b/test/CodeGenObjCXX/debug-info-cyclic.mm index 13dd5ab6e1..2fb1611c90 100644 --- a/test/CodeGenObjCXX/debug-info-cyclic.mm +++ b/test/CodeGenObjCXX/debug-info-cyclic.mm @@ -3,7 +3,7 @@ struct B { // CHECK: ![[B:[0-9]+]] ={{.*}}!DICompositeType(tag: DW_TAG_structure_type, name: "B" // CHECK-SAME: line: [[@LINE-2]], -// CHECK-SAME: size: 8, align: 8, +// CHECK-SAME: size: 8, // CHECK-NOT: offset: // CHECK-NOT: DIFlagFwdDecl // CHECK-SAME: elements: ![[BMEMBERS:[0-9]+]]