File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1735,17 +1735,16 @@ bool Converter::VisitImplicitCastExpr(clang::ImplicitCastExpr *expr) {
17351735 break ;
17361736 }
17371737 Convert (sub_expr);
1738- switch (GetConstCastType (
1739- expr->getType ()->getPointeeType (),
1740- sub_expr->getType ()->getAsArrayTypeUnsafe ()->getElementType ())) {
1741- case ConstCastType::MutableToConst:
1742- StrCat (" .cast_const()" );
1743- break ;
1744- case ConstCastType::ConstToMutable:
1745- StrCat (" .cast_mut()" );
1746- break ;
1747- default :
1748- break ;
1738+ bool dest_pointee_const =
1739+ expr->getType ()->getPointeeType ().isConstQualified ();
1740+ if (clang::isa<clang::StringLiteral>(sub_expr) ||
1741+ clang::isa<clang::PredefinedExpr>(sub_expr)) {
1742+ StrCat (" .as_ptr()" );
1743+ if (!dest_pointee_const) {
1744+ StrCat (" .cast_mut()" );
1745+ }
1746+ } else {
1747+ StrCat (dest_pointee_const ? " .as_ptr()" : " .as_mut_ptr()" );
17491748 }
17501749 break ;
17511750 }
You can’t perform that action at this time.
0 commit comments