@@ -72,7 +72,7 @@ bool TypeVarVisitor::VisitCastExpr(CastExpr *CE) {
7272 if (CHKCBindTemporaryExpr *TempE = dyn_cast<CHKCBindTemporaryExpr>(SubExpr))
7373 SubExpr = TempE->getSubExpr ();
7474
75- if (auto *Call = dyn_cast<CallExpr>(SubExpr))
75+ if (auto *Call = dyn_cast<CallExpr>(SubExpr)) {
7676 if (auto *FD = dyn_cast_or_null<FunctionDecl>(Call->getCalleeDecl ())) {
7777 FunctionDecl *FDef = getDefinition (FD );
7878 if (FDef == nullptr )
@@ -87,6 +87,7 @@ bool TypeVarVisitor::VisitCastExpr(CastExpr *CE) {
8787 }
8888 }
8989 }
90+ }
9091 return true ;
9192}
9293
@@ -96,11 +97,6 @@ bool TypeVarVisitor::VisitCallExpr(CallExpr *CE) {
9697 if (FDef == nullptr )
9798 FDef = FD ;
9899 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 ()));
104100 // Visit each function argument, and if it use a type variable, insert it
105101 // into the type variable binding map.
106102 unsigned int I = 0 ;
@@ -113,7 +109,7 @@ bool TypeVarVisitor::VisitCallExpr(CallExpr *CE) {
113109 Expr *Uncast = A->IgnoreImpCasts ();
114110 std::set<ConstraintVariable *> CVs =
115111 CR .getExprConstraintVarsSet (Uncast);
116- insertBinding (CE , TyIdx, Uncast->getType (), CVs, ForcedInconsistent );
112+ insertBinding (CE , TyIdx, Uncast->getType (), CVs);
117113 }
118114 ++I;
119115 }
@@ -165,8 +161,13 @@ bool TypeVarVisitor::VisitCallExpr(CallExpr *CE) {
165161// the exact type variable is identified by the call expression where it is
166162// used and the index of the type variable type in the function declaration.
167163void 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+
170171 assert (TyIdx >= 0 &&
171172 " Creating a type variable binding without a type variable." );
172173 auto &CallTypeVarMap = TVMap[CE ];
0 commit comments