@@ -33,7 +33,6 @@ bool CastPlacementVisitor::VisitCallExpr(CallExpr *CE) {
33
33
ProgramInfo::CallTypeParamBindingsT TypeVars;
34
34
if (Info.hasTypeParamBindings (CE, Context))
35
35
TypeVars = Info.getTypeParamBindings (CE, Context);
36
- auto PInfo = Info.getMF ()[Fname];
37
36
unsigned PIdx = 0 ;
38
37
for (const auto &A : CE->arguments ()) {
39
38
if (PIdx < FD->getNumParams ()) {
@@ -50,11 +49,10 @@ bool CastPlacementVisitor::VisitCallExpr(CallExpr *CE) {
50
49
CVarSet ArgumentConstraints = CR.getExprConstraintVars (ArgExpr);
51
50
ConstraintVariable *ParameterC = FV->getParamVar (PIdx);
52
51
for (auto *ArgumentC : ArgumentConstraints) {
53
- auto Dinfo = PIdx < PInfo.size () ? PInfo[PIdx] : CHECKED;
54
- if (needCasting (ArgumentC, ParameterC, Dinfo)) {
52
+ if (needCasting (ArgumentC, ParameterC)) {
55
53
// We expect the cast string to end with "(".
56
54
std::string CastString =
57
- getCastString (ArgumentC, ParameterC, Dinfo );
55
+ getCastString (ArgumentC, ParameterC);
58
56
surroundByCast (CastString, A);
59
57
break ;
60
58
}
@@ -71,8 +69,7 @@ bool CastPlacementVisitor::VisitCallExpr(CallExpr *CE) {
71
69
// Check whether an explicit casting is needed when the pointer represented
72
70
// by src variable is assigned to dst.
73
71
bool CastPlacementVisitor::needCasting (ConstraintVariable *Src,
74
- ConstraintVariable *Dst,
75
- IsChecked Dinfo) {
72
+ ConstraintVariable *Dst) {
76
73
auto &E = Info.getConstraints ().getVariables ();
77
74
// Check if the src is a checked type.
78
75
if (Src->isChecked (E)) {
@@ -84,17 +81,16 @@ bool CastPlacementVisitor::needCasting(ConstraintVariable *Src,
84
81
// Is Dst Wild?
85
82
// TODO: The Dinfo == WILD comparison seems to be the cause of a cast
86
83
// insertion bug. Can it be removed?
87
- if (!Dst->isChecked (E) || Dinfo == WILD )
84
+ if (!Dst->isChecked (E))
88
85
return true ;
89
86
}
90
87
return false ;
91
88
}
92
89
93
90
// Get the type name to insert for casting.
94
91
std::string CastPlacementVisitor::getCastString (ConstraintVariable *Src,
95
- ConstraintVariable *Dst,
96
- IsChecked Dinfo) {
97
- assert (needCasting (Src, Dst, Dinfo) && " No casting needed." );
92
+ ConstraintVariable *Dst) {
93
+ assert (needCasting (Src, Dst) && " No casting needed." );
98
94
return " (" + Dst->getRewritableOriginalTy () + " )" ;
99
95
}
100
96
0 commit comments