File tree Expand file tree Collapse file tree 1 file changed +20
-5
lines changed
clang/lib/StaticAnalyzer/Checkers/CHERI Expand file tree Collapse file tree 1 file changed +20
-5
lines changed Original file line number Diff line number Diff line change @@ -52,14 +52,29 @@ bool hasCapability(const QualType OrigTy, ASTContext &Ctx) {
5252 return false ;
5353}
5454
55+ namespace {
56+ void printType (raw_ostream &OS, const QualType &Ty,
57+ const PrintingPolicy &PP) {
58+ OS << " '" ;
59+ Ty.print (OS, PP);
60+ OS << " '" ;
61+ const QualType &CanTy = Ty.getCanonicalType ();
62+ if (CanTy != Ty) {
63+ OS << " (aka '" ;
64+ CanTy.print (OS, PP);
65+ OS << " ')" ;
66+ }
67+ }
68+ } // namespace
69+
5570void describeCast (raw_ostream &OS, const CastExpr *CE,
5671 const LangOptions &LangOpts) {
72+ const PrintingPolicy &PP = PrintingPolicy (LangOpts);
5773 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 << " '" ;
74+ OS << " cast from " ;
75+ printType (OS, CE->getSubExpr ()->getType (), PP);
76+ OS << " to " ;
77+ printType (OS, CE->getType (), PP);
6378}
6479
6580
You can’t perform that action at this time.
0 commit comments