diff options
Diffstat (limited to 'clang/lib/Sema/TreeTransform.h')
-rw-r--r-- | clang/lib/Sema/TreeTransform.h | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/clang/lib/Sema/TreeTransform.h b/clang/lib/Sema/TreeTransform.h index d680e6be6d3..98256d66a2a 100644 --- a/clang/lib/Sema/TreeTransform.h +++ b/clang/lib/Sema/TreeTransform.h @@ -6058,6 +6058,11 @@ QualType TreeTransform<Derived>::TransformAttributedType( if (modifiedType.isNull()) return QualType(); + const Attr *oldAttr = TL.getAttr(); + const Attr *newAttr = getDerived().TransformAttr(oldAttr); + if (!newAttr) + return QualType(); + QualType result = TL.getType(); // FIXME: dependent operand expressions? @@ -6074,26 +6079,20 @@ QualType TreeTransform<Derived>::TransformAttributedType( // type sugar, and therefore cannot be diagnosed in any other way. if (auto nullability = oldType->getImmediateNullability()) { if (!modifiedType->canHaveNullability()) { - SemaRef.Diag(TL.getAttrNameLoc(), diag::err_nullability_nonpointer) - << DiagNullabilityKind(*nullability, false) << modifiedType; + SemaRef.Diag(TL.getAttr()->getLocation(), + diag::err_nullability_nonpointer) + << DiagNullabilityKind(*nullability, false) << modifiedType; return QualType(); } } - result = SemaRef.Context.getAttributedType(oldType->getAttrKind(), + result = SemaRef.Context.getAttributedType(newAttr->getKind(), modifiedType, equivalentType); } AttributedTypeLoc newTL = TLB.push<AttributedTypeLoc>(result); - newTL.setAttrNameLoc(TL.getAttrNameLoc()); - if (TL.hasAttrOperand()) - newTL.setAttrOperandParensRange(TL.getAttrOperandParensRange()); - if (TL.hasAttrExprOperand()) - newTL.setAttrExprOperand(TL.getAttrExprOperand()); - else if (TL.hasAttrEnumOperand()) - newTL.setAttrEnumOperandLoc(TL.getAttrEnumOperandLoc()); - + newTL.setAttr(newAttr); return result; } |