Skip to content

Commit b688dc7

Browse files
committed
Use Eli's version instead
1 parent c797606 commit b688dc7

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

clang/lib/AST/ASTContext.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1637,10 +1637,12 @@ CharUnits ASTContext::getDeclAlign(const Decl *D, bool ForAlignof) const {
16371637
//
16381638
// It is an error for alignas to decrease alignment, so we can
16391639
// ignore that possibility; Sema should diagnose it.
1640-
bool IsPackedField = isa<FieldDecl>(D) &&
1641-
(D->hasAttr<PackedAttr>() ||
1642-
cast<FieldDecl>(D)->getParent()->hasAttr<PackedAttr>());
1643-
bool UseAlignAttrOnly = isa<FieldDecl>(D) ? IsPackedField : AlignFromAttr;
1640+
bool UseAlignAttrOnly;
1641+
if (FieldDecl *FD = dyn_cast<FieldDecl>(D))
1642+
UseAlignAttrOnly =
1643+
FD->hasAttr<PackedAttr>() || FD->getParent()->hasAttr<PackedAttr>();
1644+
else
1645+
UseAlignAttrOnly = AlignFromAttr != 0;
16441646
// If we're using the align attribute only, just ignore everything
16451647
// else about the declaration and its type.
16461648
if (UseAlignAttrOnly) {

0 commit comments

Comments
 (0)