This is an archive of the discontinued LLVM Phabricator instance.

[clang-doc] Fix bitcode writer
ClosedPublic

Authored by DiegoAstiazaran on Aug 13 2019, 10:26 AM.

Details

Summary

Bitcode writer was not emitting the corresponding record for the Access attribute of a FunctionInfo. This has been added.
AS_none was being used as the default value for any AccessSpecifier attribute (in FunctionInfo and MemberTypeInfo), this has been changed to AS_public because this is the enum value that evaluates to 0.
The bitcode writer doesn't write values that are 0 so if an attribute was set to AS_public, this value is not written and after reading the bitcode it would have the default value which is AS_none. This is why the default value is now AS_public.

Diff Detail

Repository
rL LLVM

Event Timeline

DiegoAstiazaran edited the summary of this revision. (Show Details)

Default value of AccessSpecifier attributes is now AS_public.
Multiple tests modified.

juliehockett accepted this revision.Aug 13 2019, 3:23 PM

One comment then LGTM

clang-tools-extra/clang-doc/Serialize.cpp
507 ↗(On Diff #214923)

In a C++ method, it should have an access associated with it, and so AS_none isn't a valid value.

This revision is now accepted and ready to land.Aug 13 2019, 3:23 PM
DiegoAstiazaran marked an inline comment as done.

Use getAccess() instead of getAccessUnsafe() for CXXMethodDecl.
Add comments in YAML generator to specify that AS_none is used as the default here because it's the AS that shouldn't be part of the output. Even though AS_public is the default in the struct, it should be displayed in the YAML output.

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