omtcyfz added a comment. if (auto *RD = Loc.getType()->getAsCXXRecordDecl()) return setResult(RD, TypeBeginLoc, TypeEndLoc); This isn't needed, too... https://reviews.llvm.org/D22881