This is an archive of the discontinued LLVM Phabricator instance.

[clang-doc] Support default args for functions.
ClosedPublic

Authored by brettw on Sep 12 2022, 3:23 PM.

Details

Summary

Adds support for default arguments in the internal representation and reads these values from the source. Implements writing these values to YAML but does not implement this for the HTML or markdown outputs.

Diff Detail

Event Timeline

brettw created this revision.Sep 12 2022, 3:23 PM
Herald added a project: Restricted Project. · View Herald TranscriptSep 12 2022, 3:23 PM
brettw requested review of this revision.Sep 12 2022, 3:23 PM

Thanks for the patch. This is mostly LGTM modulo a few nits.

My one question is regarding documentation. Do you think this needs to be described in the clang-tools-extra/doc/clang-doc.rst? And are there any changes in workflow or tool usage that we should document? I assume not, since this just changes the YAML format. Is that correct?

clang-tools-extra/clang-doc/Serialize.cpp
300

nit: can we avoid introducing unrelated formatting changes, here and elsewhere in the patch?

324–329

can we combine these conditions somehow, given that they do the same thing?

Maybe this? WDYT?

if(!FieldInfo)
  FieldInfo = &I.Params.emplace_back(P->getOriginalType().getAsString(), ...
452

nit: same here

460

nit: ditto

brettw updated this revision to Diff 460538.Sep 15 2022, 4:24 PM
brettw marked 4 inline comments as done.

There is no usage change for this. It just adds another field to the YAML.

This revision is now accepted and ready to land.Sep 15 2022, 5:34 PM
This revision was automatically updated to reflect the committed changes.