This is an archive of the discontinued LLVM Phabricator instance.

[libc] Add example programs and their CMake build and instructions.
ClosedPublic

Authored by sivachandra on Oct 31 2022, 10:31 AM.

Details

Summary

These examples are serve as an examples for people wanting to start
using the libc.

Diff Detail

Event Timeline

sivachandra created this revision.Oct 31 2022, 10:31 AM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptOct 31 2022, 10:31 AM
sivachandra requested review of this revision.Oct 31 2022, 10:31 AM

I'm not sure that the repeated description of sysroot is necessary, but I'm not sure that it's not. I always worry about duplicated info.

libc/examples/README.md
3

"a few" means about three.
"few" means very little, and is often used in a negative context.

15

+.. code-block:: sh ? (Here and below)

16

Newline?

16

What does this comment mean?

31

s,this,the documentation on the overlay,

32

Part of me wishes that the library were called liblvmlibc.a so that the command line argument was -llvmlibc, similar to libiberty.

41

I wouldn't do multiple choice here. Pick one path to show it and stick with that, and I'd stick with whatever the default one is for LLVM is possible. If someone doesn't know what generators are supported and how they work, this isn't the place to learn about them.

You might make a note "We test with Makefile and Ninja generators here, but are showing $GENERATOR here for simplicity"

80

s,a ,,

80–81

s,and loading,,

sivachandra marked 4 inline comments as done.

Address comments.

libc/examples/README.md
15

I think the the .. code-block:: syntax is for .rst files? This is a .md file to be rendered like the README.md file here: https://github.com/llvm/llvm-project/tree/main/libc/src/__support/CPP. The idea is that this is a less formal document as opposed to the docs in the docs directory which are of a formal nature. I am calling it "less formal" to imply that this will have much more churn than the docs in the docs directory.

16

Removed it now.

32

Hmm ... the name is now hard coded in a few places upstream and downstream!

41

I have removed all discussion about the two types of generators.

This revision is now accepted and ready to land.Nov 3 2022, 1:20 PM
jeffbailey accepted this revision.Nov 3 2022, 5:26 PM

I'm marking this as accepted - only the language annotation on the code blocks remains, but I think you'll have to just try something and see how the github MD interpreter copes with it. Thanks!

libc/examples/README.md
15

Ah! I hadn't realized that this isn't an rst file.

So, looking at: https://github.github.com/gfm/#info-string and https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet#code it looks like it's possible to do:

,,,bash (where those are backticks rather than commas, but this box is interpreting the MD if I use actual backticks)

However, I have no idea how to test this before committing it =)

I'm also not sure if you have to remove the "$> " as well.

Add bash as the language for code blocks.

This revision was landed with ongoing or failed builds.Nov 4 2022, 1:31 AM
This revision was automatically updated to reflect the committed changes.
sivachandra added inline comments.Nov 4 2022, 1:39 AM
libc/examples/README.md
15

I added bash as you suggested and removed the $>: https://github.com/llvm/llvm-project/tree/main/libc/examples