This patch adds a %%begin() and %%end() command to allow the
headergen binary to create custom wrappers and preamples around the
standard header. This does nothing in this patch and is purely NFC. A
future patch will use this to implement GPU wrapper headers as in
https://discourse.llvm.org/t/rfc-implementing-gpu-headers-in-the-llvm-c-library/71523.
Details
Details
- Reviewers
sivachandra lntue michaelrj
Diff Detail
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Comment Actions
I'm realizing that a better but more invasive solution would be to have something like the following:
%%begin() #include <__llvm_libc_common.h> %%end() %%public_api()
After trying to base my offloading support off of this I realized that several headers have non-trivial constructions, so what I really need is a hook to wrap around these and insert some GPU headers at the start. So it would look more like
#include <llvm-libc-macros/gpu-macros.h> #ifdef __OFFLOADING #include_next <stdheader.h> #else #include <__llvm_libc_common.h> #endif #ifndef __OFFLOADING extern SomeType; #endif void some_entrypoint.
Comment Actions
I think we should nail down the design before we start making changes. More specifically, what are the begin and end commands going to do?
libc/utils/HdrGen/BeginCommand.cpp | ||
---|---|---|
24 | nit: should be begin |
Comment Actions
Fixing nit.
I'm going to upload a follow-up patch very soon. I simply wanted to separate all the line noise of updating the headers from that patch.
nit: should be begin