@@ -72,7 +72,7 @@ bool TypeVarVisitor::VisitCastExpr(CastExpr *CE) {
72
72
if (CHKCBindTemporaryExpr *TempE = dyn_cast<CHKCBindTemporaryExpr>(SubExpr))
73
73
SubExpr = TempE->getSubExpr ();
74
74
75
- if (auto *Call = dyn_cast<CallExpr>(SubExpr))
75
+ if (auto *Call = dyn_cast<CallExpr>(SubExpr)) {
76
76
if (auto *FD = dyn_cast_or_null<FunctionDecl>(Call->getCalleeDecl ())) {
77
77
FunctionDecl *FDef = getDefinition (FD);
78
78
if (FDef == nullptr )
@@ -87,6 +87,7 @@ bool TypeVarVisitor::VisitCastExpr(CastExpr *CE) {
87
87
}
88
88
}
89
89
}
90
+ }
90
91
return true ;
91
92
}
92
93
@@ -96,11 +97,6 @@ bool TypeVarVisitor::VisitCallExpr(CallExpr *CE) {
96
97
if (FDef == nullptr )
97
98
FDef = FD;
98
99
if (auto *FVCon = Info.getFuncConstraint (FDef, Context)) {
99
- // if we need to rewrite it but can't (macro, etc), it isn't safe
100
- bool ForcedInconsistent =
101
- !typeArgsProvided (CE) &&
102
- (!Rewriter::isRewritable (CE->getExprLoc ()) ||
103
- !canWrite (PersistentSourceLoc::mkPSL (CE, *Context).getFileName ()));
104
100
// Visit each function argument, and if it use a type variable, insert it
105
101
// into the type variable binding map.
106
102
unsigned int I = 0 ;
@@ -113,7 +109,7 @@ bool TypeVarVisitor::VisitCallExpr(CallExpr *CE) {
113
109
Expr *Uncast = A->IgnoreImpCasts ();
114
110
std::set<ConstraintVariable *> CVs =
115
111
CR.getExprConstraintVarsSet (Uncast);
116
- insertBinding (CE, TyIdx, Uncast->getType (), CVs, ForcedInconsistent );
112
+ insertBinding (CE, TyIdx, Uncast->getType (), CVs);
117
113
}
118
114
++I;
119
115
}
@@ -165,8 +161,13 @@ bool TypeVarVisitor::VisitCallExpr(CallExpr *CE) {
165
161
// the exact type variable is identified by the call expression where it is
166
162
// used and the index of the type variable type in the function declaration.
167
163
void TypeVarVisitor::insertBinding (CallExpr *CE, const int TyIdx,
168
- clang::QualType Ty, CVarSet &CVs,
169
- bool ForceInconsistent) {
164
+ clang::QualType Ty, CVarSet &CVs) {
165
+ // if we need to rewrite it but can't (macro, etc), it isn't safe
166
+ bool ForceInconsistent =
167
+ !typeArgsProvided (CE) &&
168
+ (!Rewriter::isRewritable (CE->getExprLoc ()) ||
169
+ !canWrite (PersistentSourceLoc::mkPSL (CE, *Context).getFileName ()));
170
+
170
171
assert (TyIdx >= 0 &&
171
172
" Creating a type variable binding without a type variable." );
172
173
auto &CallTypeVarMap = TVMap[CE];
0 commit comments