Commit d27a16eb authored by Sam McCall's avatar Sam McCall
Browse files

Revert "[DWARF5]Addition of alignment atrribute in typedef DIE."

This reverts commit 423f541c, which
breaks llvm-c ABI.
parent dea8f3b0
Loading
Loading
Loading
Loading
+5 −8
Original line number Diff line number Diff line
@@ -1127,8 +1127,7 @@ llvm::DIType *CGDebugInfo::CreateType(const TemplateSpecializationType *Ty,
  SourceLocation Loc = AliasDecl->getLocation();
  return DBuilder.createTypedef(Src, OS.str(), getOrCreateFile(Loc),
                                getLineNumber(Loc),
                                getDeclContextDescriptor(AliasDecl),
                                /* Alignment */ None);
                                getDeclContextDescriptor(AliasDecl));
}

llvm::DIType *CGDebugInfo::CreateType(const TypedefType *Ty,
@@ -1144,10 +1143,9 @@ llvm::DIType *CGDebugInfo::CreateType(const TypedefType *Ty,
  SourceLocation Loc = Ty->getDecl()->getLocation();

  // Typedefs are derived from some other type.
  return DBuilder.createTypedef(
      Underlying, Ty->getDecl()->getName(), getOrCreateFile(Loc),
      getLineNumber(Loc), getDeclContextDescriptor(Ty->getDecl()),
      getDeclAlignIfRequired(Ty->getDecl(), CGM.getContext()));
  return DBuilder.createTypedef(Underlying, Ty->getDecl()->getName(),
                                getOrCreateFile(Loc), getLineNumber(Loc),
                                getDeclContextDescriptor(Ty->getDecl()));
}

static unsigned getDwarfCC(CallingConv CC) {
@@ -2326,8 +2324,7 @@ llvm::DIType *CGDebugInfo::CreateType(const ObjCTypeParamType *Ty,
  return DBuilder.createTypedef(
      getOrCreateType(Ty->getDecl()->getUnderlyingType(), Unit),
      Ty->getDecl()->getName(), getOrCreateFile(Loc), getLineNumber(Loc),
      getDeclContextDescriptor(Ty->getDecl()),
      /* Alignment */ None);
      getDeclContextDescriptor(Ty->getDecl()));
}

/// \return true if Getter has the default name for the property PD.
+0 −14
Original line number Diff line number Diff line
//  Test for debug info related to DW_AT_alignment attribute in the typedef operator
// Supported: -O0, standalone DI
// RUN: %clang_cc1 -dwarf-version=5  -emit-llvm -triple x86_64-linux-gnu %s -o - \
// RUN:   -O0 -disable-llvm-passes \
// RUN:   -debug-info-kind=standalone \
// RUN: | FileCheck %s

// CHECK: DIDerivedType(tag: DW_TAG_typedef, {{.*}}, align: 512

typedef char __attribute__((__aligned__(64))) alchar;

int main() {
  alchar newChar;
}
+1 −1
Original line number Diff line number Diff line
@@ -875,7 +875,7 @@ LLVMMetadataRef
LLVMDIBuilderCreateTypedef(LLVMDIBuilderRef Builder, LLVMMetadataRef Type,
                           const char *Name, size_t NameLen,
                           LLVMMetadataRef File, unsigned LineNo,
                           LLVMMetadataRef Scope, uint32_t AlignInBits);
                           LLVMMetadataRef Scope);

/**
 * Create debugging information entry to establish inheritance relationship
+1 −3
Original line number Diff line number Diff line
@@ -237,10 +237,8 @@ namespace llvm {
    /// \param File        File where this type is defined.
    /// \param LineNo      Line number.
    /// \param Context     The surrounding context for the typedef.
    /// \param AlignInBits Alignment. (Optional)
    DIDerivedType *createTypedef(DIType *Ty, StringRef Name, DIFile *File,
                                 unsigned LineNo, DIScope *Context,
                                 Optional<unsigned> AlignInBits = {});
                                 unsigned LineNo, DIScope *Context);

    /// Create debugging information entry for a 'friend'.
    DIDerivedType *createFriend(DIType *Ty, DIType *FriendTy);
+0 −9
Original line number Diff line number Diff line
@@ -800,15 +800,6 @@ void DwarfUnit::constructTypeDIE(DIE &Buffer, const DIDerivedType *DTy) {
  if (!Name.empty())
    addString(Buffer, dwarf::DW_AT_name, Name);

  // If alignment is specified for a typedef , create and insert DW_AT_alignment
  // attribute in DW_TAG_typedef DIE.
  if (Tag == dwarf::DW_TAG_typedef && DD->getDwarfVersion() >= 5) {
    uint32_t AlignInBytes = DTy->getAlignInBytes();
    if (AlignInBytes > 0)
      addUInt(Buffer, dwarf::DW_AT_alignment, dwarf::DW_FORM_udata,
              AlignInBytes);
  }

  // Add size if non-zero (derived types might be zero-sized.)
  if (Size && Tag != dwarf::DW_TAG_pointer_type
           && Tag != dwarf::DW_TAG_ptr_to_member_type
Loading