From e1f79e868a143ea255c03c79a4d9b210733ac620 Mon Sep 17 00:00:00 2001 From: Douglas Gregor Date: Thu, 22 Apr 2010 16:46:21 +0000 Subject: [PATCH] Expand the one use of TransformPointerLikeType and eliminate this macro. No functionality change llvm-svn: 102073 --- clang/lib/Sema/TreeTransform.h | 41 ++++++++++++++-------------------- 1 file changed, 17 insertions(+), 24 deletions(-) diff --git a/clang/lib/Sema/TreeTransform.h b/clang/lib/Sema/TreeTransform.h index 02f741750067..0463a12f0917 100644 --- a/clang/lib/Sema/TreeTransform.h +++ b/clang/lib/Sema/TreeTransform.h @@ -2259,29 +2259,6 @@ QualType TransformTypeSpecType(TypeLocBuilder &TLB, TyLoc T) { return T.getType(); } -// Ugly metaprogramming macros because I couldn't be bothered to make -// the equivalent template version work. -#define TransformPointerLikeType(TypeClass) do { \ - QualType PointeeType \ - = getDerived().TransformType(TLB, TL.getPointeeLoc()); \ - if (PointeeType.isNull()) \ - return QualType(); \ - \ - QualType Result = TL.getType(); \ - if (getDerived().AlwaysRebuild() || \ - PointeeType != TL.getPointeeLoc().getType()) { \ - Result = getDerived().Rebuild##TypeClass(PointeeType, \ - TL.getSigilLoc()); \ - if (Result.isNull()) \ - return QualType(); \ - } \ - \ - TypeClass##Loc NewT = TLB.push(Result); \ - NewT.setSigilLoc(TL.getSigilLoc()); \ - \ - return Result; \ -} while(0) - template QualType TreeTransform::TransformBuiltinType(TypeLocBuilder &TLB, BuiltinTypeLoc T, @@ -2348,7 +2325,23 @@ QualType TreeTransform::TransformBlockPointerType(TypeLocBuilder &TLB, BlockPointerTypeLoc TL, QualType ObjectType) { - TransformPointerLikeType(BlockPointerType); + QualType PointeeType + = getDerived().TransformType(TLB, TL.getPointeeLoc()); + if (PointeeType.isNull()) + return QualType(); + + QualType Result = TL.getType(); + if (getDerived().AlwaysRebuild() || + PointeeType != TL.getPointeeLoc().getType()) { + Result = getDerived().RebuildBlockPointerType(PointeeType, + TL.getSigilLoc()); + if (Result.isNull()) + return QualType(); + } + + BlockPointerLoc NewT = TLB.push(Result); + NewT.setSigilLoc(TL.getSigilLoc()); + return Result; } /// Transforms a reference type. Note that somewhat paradoxically we