Guidance in contributing to the project

hello everyone myself suman meena a second-year student having experience in c++ programming language and some basic knowledge of computer architecture. I’m too an Outreachy applicant for May 2023 cohort. I am interested in contributing to this project but do not have any experience in open source so finding it difficult to contribute. I have forked the project and cloned it to my pc and looked at some good issue labelled bugs but I do not know where to change the code and how to see the effects of our code change. are there any resources I should explore first for a better knowledge of the compiler?

I have forked the project and cloned it to my pc and looked at some good issue labelled bugs but I do not know where to change the code and how to see the effects of our code change.

We do have one tutorial to explain the contribution process. You may follow that for any small change.

1 Like

thank you for the help

I have downloaded the code and build it successfully.However,when I run tests using make check-clang command.I am getting this error after multiple attempts. Please help me out

In file included from C:/Users/SAM/Desktop/llvm/llvm-project/clang/include/clang/Sema/Sema.h:39,
                 from C:/Users/SAM/Desktop/llvm/llvm-project/clang/include/clang/Serialization/ASTReader.h:29,
                 from C:/Users/SAM/Desktop/llvm/llvm-project/clang/tools/c-index-test/core_main.cpp:21:
C:/Users/SAM/Desktop/llvm/llvm-project/clang/include/clang/Basic/Builtins.h:53:28: error: expected identifier before ',' token
   53 | #define HEADER(ID, NAME) ID,
      |                            ^
C:/Users/SAM/Desktop/llvm/llvm-project/clang/include/clang/Basic/BuiltinHeaders.def:30:1: note: in expansion of macro 'HEADER'
   30 | HEADER(PTHREAD_H, "pthread.h")
      | ^~~~~~
make[3]: *** [tools/clang/tools/c-index-test/CMakeFiles/c-index-test.dir/build.make:92: tools/clang/tools/c-index-test/CMakeFiles/c-index-test.dir/core_main.cpp.obj] Error 1
make[2]: *** [CMakeFiles/Makefile2:45627: tools/clang/tools/c-index-test/CMakeFiles/c-index-test.dir/all] Error 2
make[1]: *** [CMakeFiles/Makefile2:49902: tools/clang/test/CMakeFiles/check-clang.dir/rule] Error 2
make: *** [Makefile:13891: check-clang] Error 2

Hello everyone, Myself Priyanshi Agarwal, I have been selected for the second round of Outreachy internship program and I eagerly want to contribute to this project since I have a great interest in C++ and I also have a basic knowledge about compilers but I am a bit confused that how to start. Please tell me that do I need to learn Clang and cmake before starting or I can start straightaway?

hii priyanshi look at the tutorial link shivam has provided you will surely get an idea

Hello ma’am,
Thanks for the reference. I am trying to setup the project on my local computer.

Thanks & Regards
Priyanshi Agarwal

On Sat, 11 Mar, 2023, 8:05 pm suman meena via LLVM Discussion Forums, <> wrote:

March 11

hii priyanshi look at the tutorial link shivam has provided you will surely get an idea

Visit Topic or reply to this email to respond.

To unsubscribe from these emails, click here.

Like I said on Discord, this sounds like a system header somewhere is defining PTHREAD_H (to nothing).

Migrated to Ubuntu and everything works fine.

Have you installed it as your main os or running it on a vm?

I have used WSL2(You can google it).I wanted to use windows but vs required a lot of data bundles to download dependencies so I opted to install WSL2.
Were you able to run any artifacts (clang, tests) etc?

hey, I am trying to solve this issue Print name of uninitialized subobject (instead of type) · Issue #58601 · llvm/llvm-project · GitHub, where I searched the string “subobject of type ‘int’ is not initialized” using the git grep command and changed it to desired one. However, it still shows me the same note after compiling the given example can someone give me a direction?

Which files did you change? That’s not the exact string to search for, it’s a template in the source code. I’m going to guess you just went and edited the tests that check for that exact message?

oh, thanks jrtc if possible could you please give me an idea of how to get to the source code then?

clang/include and clang/lib have the source code, clang/test has the tests. Search the former for the diagnostic in question (suitably generalised since the diagnostic is templated and won’t just say int) to find the template, alter the text, find any references to the template and update them to pass any additional template parameters (like the name of the member).

thank you so much jrtc27 for the help I found the relevant code but now the problem is the code is contained in a .td file which I am finding difficult to understand if you can suggest me some good resources to understand TableGen code that will be huge help to me. I searched for the same on google but doesn’t find something relevant.

Understanding TableGen is a big question, because it’s used for many different things. Understanding how TableGen is used for diagnostics is relatively straightforward, however. There might be documentation, but here’s what you’ll need to know even if there isn’t.

Let’s look at the diagnostic definition that I found, hopefully the same one you found:

def note_constexpr_uninitialized : Note<
  "%select{|sub}0object of type %1 is not initialized">;

The name after the “def” becomes a symbolic constant for this diagnostic. If you grep the clang source for that name, you’ll find where the diagnostic is generated. There might be only one place, there might be several.

Next, observe the %1 in the string. This is a placeholder for a parameter passed to the diagnostic engine, in this case the name of the type. The 1 means it is parameter number 1, where the numbers start at 0, so in this case it will be the second parameter.

Finally, observe the %select{|sub}0 part. This is a fancier kind of placeholder, but note that it still starts with % and ends with a digit (in this case, 0). That means the substitution is controlled by parameter 0 passed to the diagnostic. The select operator expects an integer, which it uses to select one of the alternatives inside the braces, which are separated by |. If you pass 0 as parameter 0, it will substitute the 0th alternative, which is the empty string; if you pass 1, it will substitute the 1th alternative, “sub”.

The diagnostics engine is set up to use stream-like operators, so in this case the code to generate the diagnostic will first call some kind of Diag method passing diag::note_constexpr_uninitialized followed by stream operators for the parameters. This will probably look something like

foo.Diag(...) << isSubobject << typeName;

not exactly like that–I haven’t actually looked up the code–but it will have that general form.

To fix the diagnostic, you’ll need to (a) change the text of the message in the .td file, (b) modify each of the places the diagnostic is used to pass the correct name.

hey, thank you so much pogo59 I got your point and now trying to pass the element name to the diagnostic function instead of the element type and will let u know once done.

My system keeps crashing whenever I got to this command line “ninja check-clang” of building llvm project on my linux machine ninja check-clang.

I am running 16gb RAM acer nitro gaming system.

Is there any advice or solution to that?

I have been able to build the project. Thank you.