clangir icon indicating copy to clipboard operation
clangir copied to clipboard

Support for `Decl::PragmaComment`

Open j2kun opened this issue 1 year ago • 1 comments

Is support for pragmas in scope for ClangIR? I was wondering if the content of a pragma could be exposed as a ClangIR attribute, maybe analogously to ASTFunctionDeclAttr by wrapping PragmaCommentDecl?

I'd be happy to add this if it's a good first issue.

j2kun avatar May 15 '23 16:05 j2kun

Hi @j2kun, there are two bits of PragmaCommentDecl that'd be interesting to implement in ClangIR:

Screenshot 2023-05-15 at 8 38 42 PM

Basically PCK_Linker and PCK_Lib. LLVM Codegen ignores the rest, like you can see in CodeGenModule.cpp:6464. I'm not sure how much worth would be to implement these since they both related with ELF or metadata stuff in LLVM, but I'm happy to review any work. I guess part of the answer here is that we don't have a need yet (or usecases) for injecting the other comment kinds as something needed in CIR, do you see any other use?

Note that there are other types of pragmas which are super important: openmp's pragma omp, clang fp contract, etc. It'd be nice to have those working too, specially openmp. Getting all of it done is probably a larger project, but you can add incremental bits as you find time to work on stuff (and others in the community can pick up later where you stopped, etc).

bcardosolopes avatar May 16 '23 03:05 bcardosolopes