@@ -2198,6 +2198,28 @@ class ASTVisitor
2198
2198
D->getExplicitSpecifier ());
2199
2199
}
2200
2200
2201
+ for (const ParmVarDecl* P : D->parameters ())
2202
+ {
2203
+ auto index = P->getFunctionScopeIndex ();
2204
+ Param& param = index < I.Params .size () ?
2205
+ I.Params [index ] : I.Params .emplace_back ();
2206
+ // KRYSTIAN NOTE: it's not clear what the correct thing
2207
+ // to do here is. this will use the longest name seen
2208
+ // in any redeclaration
2209
+ if (std::string_view name = P->getName ();
2210
+ name.size () > param.Name .size ())
2211
+ param.Name = name;
2212
+
2213
+ if (! param.Type )
2214
+ param.Type = buildTypeInfo (P->getOriginalType ());
2215
+
2216
+ const Expr* default_arg = P->hasUninstantiatedDefaultArg () ?
2217
+ P->getUninstantiatedDefaultArg () : P->getInit ();
2218
+ if (param.Default .empty () && default_arg)
2219
+ param.Default = getSourceCode (
2220
+ default_arg->getSourceRange ());
2221
+ }
2222
+
2201
2223
if (! created)
2202
2224
return ;
2203
2225
@@ -2206,14 +2228,6 @@ class ASTVisitor
2206
2228
I.Class = convertToFunctionClass (
2207
2229
D->getDeclKind ());
2208
2230
2209
- for (const ParmVarDecl* P : D->parameters ())
2210
- {
2211
- I.Params .emplace_back (
2212
- buildTypeInfo (P->getOriginalType ()),
2213
- P->getNameAsString (),
2214
- getSourceCode (P->getDefaultArgRange ()));
2215
- }
2216
-
2217
2231
QualType RT = D->getReturnType ();
2218
2232
ExtractMode next_mode = ExtractMode::IndirectDependency;
2219
2233
if (auto * AT = RT->getContainedAutoType ();
0 commit comments