This is an archive of the discontinued LLVM Phabricator instance.

[clang-doc] Serialize inherited attributes and methods
ClosedPublic

Authored by DiegoAstiazaran on Aug 14 2019, 12:22 PM.

Details

Summary

clang-doc now serializes the inherited attributes and methods, not only the name of the base class.
All inherited are tracked, if B:A and C:B, info of A is included in C.
This data is stored in attribute Bases in a RecordInfo.
Previously tracked inheritance data, stored in Parents and VParents, hasn't been removed to reduce review load.

Diff Detail

Repository
rL LLVM

Event Timeline

juliehockett added inline comments.Aug 14 2019, 4:16 PM
clang-tools-extra/clang-doc/BitcodeWriter.h
33 ↗(On Diff #215200)

I definitely haven't been particularly good about bumping this, but can you bump it? This is a decently large change.

clang-tools-extra/clang-doc/Serialize.cpp
233 ↗(On Diff #215200)

s/documentInfo/shouldSerializeInfo

277 ↗(On Diff #215200)

s/false//*IsInAnonymousNamespace=*/false

436 ↗(On Diff #215200)

Will getDecl() always return a non-null pointer? In the normal case I'd assume so, but the cast_or_null will only catch a null coming out of getDefinition() or the cast, not getDecl, so just want to check.

437–439 ↗(On Diff #215200)

Is there a reason this isn't bool IsVirtual = B.IsVirtual()?

440–446 ↗(On Diff #215200)

Do this in an if/else -- getNameAsString() is a decently expensive operation, so only do it when you need it.

447–450 ↗(On Diff #215200)

It would be better to create the BaseRecordInfo and then move it into the vector, since the constructor will copy all those strings.

454 ↗(On Diff #215200)

s/inherit/serialize

460 ↗(On Diff #215200)

s/populateParentNamespaces/populateFunctionInfo ?

clang-tools-extra/unittests/clang-doc/YAMLGeneratorTest.cpp
91 ↗(On Diff #215200)

For clarity, call this something else? Since it already has an X private member.

DiegoAstiazaran marked 11 inline comments as done.

Increase version number of clang-doc bitcode.
Rename documentInfo function to shouldSerializeInfo.
In new parseBases a BaseRecordInfo object is created and then added to Bases of main RecordInfo.
Fix comments.

clang-tools-extra/clang-doc/Serialize.cpp
436 ↗(On Diff #215200)

I got this logic from https://clang.llvm.org/doxygen/CXXInheritance_8cpp_source.html#l00150 so it should probably work as you said, getDecl() always returns a non-null pointer.

juliehockett accepted this revision.Aug 15 2019, 8:48 AM
This revision is now accepted and ready to land.Aug 15 2019, 8:48 AM

Rebase to master

This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptAug 15 2019, 5:09 PM