[PATCH] D116342: [clang][AST] Fix crash when printing error

Sam McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat Jan 1 20:18:02 PST 2022


sammccall accepted this revision.
sammccall added inline comments.
This revision is now accepted and ready to land.


================
Comment at: clang/lib/AST/TypePrinter.cpp:242
     case Type::ObjCObjectPointer:
       CanPrefixQualifiers = T->isObjCIdType() || T->isObjCClassType() ||
         T->isObjCQualifiedIdType() || T->isObjCQualifiedClassType();
----------------
ellis wrote:
> Hi @dblaikie, I'm not familiar with this code but I'm wondering if these uses of `T` should actually be `UnderlyingType`. Will this cause a crash similar to what I found?
There's no functional difference - these helpers all start with getAs<SomeTypeClass> so they'll see through the sugar on T.

Potentially UnderlyingType does a bit less work (since there's less sugar to look through) while T is marginally more obvious (to me at least). I wouldn't change it, I doubt this matters at all.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D116342/new/

https://reviews.llvm.org/D116342



More information about the cfe-commits mailing list