@@ -990,7 +990,7 @@ namespace {
990
990
PrintWithColorRAII (OS, ParenthesisColor) << ' )' ;
991
991
}
992
992
993
- void printParameterList (const ParameterList *params) {
993
+ void printParameterList (const ParameterList *params, const ASTContext *ctx = nullptr ) {
994
994
OS.indent (Indent);
995
995
PrintWithColorRAII (OS, ParenthesisColor) << ' (' ;
996
996
PrintWithColorRAII (OS, ParameterColor) << " parameter_list" ;
@@ -999,6 +999,19 @@ namespace {
999
999
OS << ' \n ' ;
1000
1000
printParameter (P);
1001
1001
}
1002
+
1003
+ if (!ctx && params->size () != 0 && params->get (0 ))
1004
+ ctx = ¶ms->get (0 )->getASTContext ();
1005
+
1006
+ if (ctx) {
1007
+ auto R = params->getSourceRange ();
1008
+ if (R.isValid ()) {
1009
+ PrintWithColorRAII (OS, RangeColor) << " range=" ;
1010
+ R.print (PrintWithColorRAII (OS, RangeColor).getOS (),
1011
+ ctx->SourceMgr , /* PrintText=*/ false );
1012
+ }
1013
+ }
1014
+
1002
1015
PrintWithColorRAII (OS, ParenthesisColor) << ' )' ;
1003
1016
Indent -= 2 ;
1004
1017
}
@@ -1007,7 +1020,7 @@ namespace {
1007
1020
for (auto pl : D->getParameterLists ()) {
1008
1021
OS << ' \n ' ;
1009
1022
Indent += 2 ;
1010
- printParameterList (pl);
1023
+ printParameterList (pl, &D-> getASTContext () );
1011
1024
Indent -= 2 ;
1012
1025
}
1013
1026
if (auto FD = dyn_cast<FuncDecl>(D)) {
@@ -2280,7 +2293,7 @@ class PrintExpr : public ExprVisitor<PrintExpr> {
2280
2293
2281
2294
if (E->getParameters ()) {
2282
2295
OS << ' \n ' ;
2283
- PrintDecl (OS, Indent+2 ).printParameterList (E->getParameters ());
2296
+ PrintDecl (OS, Indent+2 ).printParameterList (E->getParameters (), &E-> getASTContext () );
2284
2297
}
2285
2298
2286
2299
OS << ' \n ' ;
@@ -2296,7 +2309,7 @@ class PrintExpr : public ExprVisitor<PrintExpr> {
2296
2309
2297
2310
if (E->getParameters ()) {
2298
2311
OS << ' \n ' ;
2299
- PrintDecl (OS, Indent+2 ).printParameterList (E->getParameters ());
2312
+ PrintDecl (OS, Indent+2 ).printParameterList (E->getParameters (), &E-> getASTContext () );
2300
2313
}
2301
2314
2302
2315
OS << ' \n ' ;
0 commit comments