This is an archive of the discontinued LLVM Phabricator instance.

Add LibClang guide
ClosedPublic

Authored by manuel5975p on Jun 25 2023, 10:28 PM.
Tokens
"Yellow Medal" token, awarded by xgupta.

Details

Summary

Add a libclang .rst file with some code examples, going over the most important types and functions of libclang.

Diff Detail

Event Timeline

manuel5975p created this revision.Jun 25 2023, 10:28 PM
Herald added a project: Restricted Project. · View Herald TranscriptJun 25 2023, 10:28 PM
manuel5975p requested review of this revision.Jun 25 2023, 10:28 PM

Thank you for adding this new documentation! In general, this is looking fantastic. Given how closely tied the C indexing APIs are with the rest of the compiler internals, I think it'd be helpful to add links to https://clang.llvm.org/docs/InternalsManual.html to various parts of this documentation to link the user back to more details. e.g., the section on source locations can link to https://clang.llvm.org/docs/InternalsManual.html#the-sourcelocation-and-sourcemanager-classes, etc. WDYT?

clang/docs/LibClang.rst
5–6

Sphinx will complain if the underlines aren't the same length as what's being underlined.

24–25
34

Should we name this .cpp instead of .hpp? It's pretty weird to compile a header file, so using .cpp makes it clear that the TU is parsed as C++ code rather than as a header.

38–39

Pretty sure Sphinx will want a newline here.

87
115–117

I noticed this in a few places -- you should make sure the punctuation is consistent for list elements.

142–146

I don't think we should document the data field in this way -- that's an implementation detail. Users should assume data is not something they can inspect or modify. Instead, users should use indexing APIs like clang_equalTypes().

151
184
261
manuel5975p accepted this revision.Jul 3 2023, 1:09 AM

Thanks a lot for carefully going through this. I will dispose of the documentation for CXType after accepting.

This revision is now accepted and ready to land.Jul 3 2023, 1:09 AM
manuel5975p marked 9 inline comments as done.

Incorporate Aaron Ballman's corrections

Incorporate Aaron Ballman's corrections

Hmm, something seems to have gone sideways somewhere because it looks like none of the comments were addressed -- did you perhaps re-upload the original patch?

LGTM, thank you! Do you need me to commit this on your behalf? If so, what name and email address would you like me to use for patch attribution? (I'll build the docs locally and correct any remaining formatting mistakes before landing.)

I guess manuel5975p (manuel.winkler@gmx.ch) would be nice

This revision was landed with ongoing or failed builds.Jul 10 2023, 8:16 AM
Closed by commit rG12d72e4fdee9: Add libClang guide (authored by manuel5975p, committed by aaron.ballman). · Explain Why
This revision was automatically updated to reflect the committed changes.

I guess manuel5975p (manuel.winkler@gmx.ch) would be nice

Thank you for the new documentation, it's really appreciated! I've landed this on your behalf in 12d72e4fdee91b3f1e314759d6aa33d25fb38f86