@@ -176,7 +176,8 @@ class DiagnoseUnknownCompileTimeValues : public SILModuleTransform {
176
176
177
177
void verifyLocal (DebugValueInst *DBI) {
178
178
auto Decl = DBI->getDecl ();
179
- if (!Decl || !isa<VarDecl>(Decl) || isa<ParamDecl>(Decl) || !Decl->isConstVal ())
179
+ if (!Decl || !isa<VarDecl>(Decl) || isa<ParamDecl>(Decl) ||
180
+ !Decl->isConstVal ())
180
181
return ;
181
182
182
183
auto Value = ConstExprState.getConstantValue (DBI->getOperand ());
@@ -228,14 +229,16 @@ class DiagnoseUnknownCompileTimeValues : public SILModuleTransform {
228
229
229
230
if (hasConst) {
230
231
for (size_t i = 0 ; i < CalleeParameters->size (); ++i) {
231
- auto CorrespondingArg = ApplyArgRefs[i];
232
- if (CalleeParameters->get (i)->isConstVal ()) {
232
+ const auto &CorrespondingArg = ApplyArgRefs[i];
233
+ const auto &CorrespondingParameter = CalleeParameters->get (i);
234
+ if (CorrespondingParameter->isConstVal ()) {
233
235
LLVM_DEBUG ({
234
- llvm::dbgs () << " Argument of fn{" << CalleeDecl->getNameStr () << " } " ;
235
- llvm::dbgs () << CalleeParameters->get (i)->getNameStr () << " : " ;
236
+ llvm::dbgs () << " Argument of fn{" << CalleeDecl->getNameStr ()
237
+ << " } " ;
238
+ llvm::dbgs () << CorrespondingParameter->getNameStr () << " : " ;
236
239
std::string typeName;
237
240
llvm::raw_string_ostream out (typeName);
238
- CalleeParameters-> get (i) ->getTypeRepr ()->print (out);
241
+ CorrespondingParameter ->getTypeRepr ()->print (out);
239
242
auto Value = ConstExprState.getConstantValue (CorrespondingArg);
240
243
llvm::dbgs () << typeName << " = " ;
241
244
printSymbolicValueValue (Value, Allocator);
@@ -248,6 +251,10 @@ class DiagnoseUnknownCompileTimeValues : public SILModuleTransform {
248
251
ArgLocation = ApplyExprNode->getArgs ()[i].getLoc ();
249
252
getModule ()->getASTContext ().Diags .diagnose (
250
253
ArgLocation, diag::require_const_arg_for_parameter);
254
+ getModule ()->getASTContext ().Diags .diagnose (
255
+ CorrespondingParameter->getLoc (),
256
+ diag::kind_declname_declared_here, DescriptiveDeclKind::Param,
257
+ CorrespondingParameter->getName ());
251
258
}
252
259
}
253
260
}
0 commit comments