File tree Expand file tree Collapse file tree 1 file changed +19
-5
lines changed
clang/lib/StaticAnalyzer/Checkers/CHERI Expand file tree Collapse file tree 1 file changed +19
-5
lines changed Original file line number Diff line number Diff line change @@ -52,14 +52,28 @@ bool hasCapability(const QualType OrigTy, ASTContext &Ctx) {
5252 return false ;
5353}
5454
55+ namespace {
56+ void printType (raw_ostream &OS, const QualType &Ty, const PrintingPolicy &PP) {
57+ OS << " '" ;
58+ Ty.print (OS, PP);
59+ OS << " '" ;
60+ const QualType &CanTy = Ty.getCanonicalType ();
61+ if (CanTy != Ty) {
62+ OS << " (aka '" ;
63+ CanTy.print (OS, PP);
64+ OS << " ')" ;
65+ }
66+ }
67+ } // namespace
68+
5569void describeCast (raw_ostream &OS, const CastExpr *CE,
5670 const LangOptions &LangOpts) {
71+ const PrintingPolicy &PP = PrintingPolicy (LangOpts);
5772 OS << (dyn_cast<ImplicitCastExpr>(CE) ? " implicit" : " explicit" );
58- OS << " cast from '" ;
59- CE->getSubExpr ()->getType ().print (OS, PrintingPolicy (LangOpts));
60- OS << " ' to '" ;
61- CE->getType ().print (OS, PrintingPolicy (LangOpts));
62- OS << " '" ;
73+ OS << " cast from " ;
74+ printType (OS, CE->getSubExpr ()->getType (), PP);
75+ OS << " to " ;
76+ printType (OS, CE->getType (), PP);
6377}
6478
6579} // namespace cheri
You can’t perform that action at this time.
0 commit comments