[PATCH] D131298: [clang-doc] Read docstrings for record members

Brett Wilson via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 11 09:23:48 PDT 2022


brettw added inline comments.


================
Comment at: clang-tools-extra/unittests/clang-doc/SerializeTest.cpp:166
+  ExpectedE.Members.emplace_back("int", "value", AccessSpecifier::AS_public);
+  //ExpectedE.Members.back().Description.push_back(MakeOneLineCommentInfo(" Some docs"));
   CheckRecordInfo(&ExpectedE, E);
----------------
paulkirth wrote:
> brettw wrote:
> > I spent quite some time trying to get this to work and I'm stuck. If I copy the contents of the raw string above into a file and run clang-doc on it, I get a comment in the YAML output. But in this test I never get a comment and I don't know how this parsing environment is different than the "real" one.
> > 
> > I'm very confused by the result of `ExtractInfosFromCode` function in the first place. What are the 1st and 6th item which are never checked? Why does it emit two duplicate records for the `E` struct, one (Infos[2]) with a data member and no function and one (Infos[3]) with no data member and a function in it?
> > 
> > Any suggestions here would be appreciated.
> So I also wanted to understand why. `MakeOneLinecCmmentIInfo()` is not used elsewhere in clang-doc, and I don't think it was ever tested.
> 
> Looking at the body it doesn't use it's input parameter at all. 
> 
> There may also be an issue w/ how it constructs the `CommentInfo`.
> 
> Leaving this as a TODO is fine. I don't think this is something we're going to solve in this patch, but if you can also add a TODO to `MakeOneLine CommentInfo`, it would be appreciated.
The problem isn't with MakeOneLineCommentInfo (I fixed the parameter usage) but rather that the records generated in the test has no comments at all. The current test code (with the line commented out) expects that the comment is completely missing, which is the only way the test will pass now.

Since nobody else uses it, I commented it out and referenced the calling code.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D131298/new/

https://reviews.llvm.org/D131298



More information about the cfe-commits mailing list