[PATCH] D92720: [HIP] unbundle bundled preprocessor output

Yaxun Liu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Dec 14 20:26:52 PST 2020


yaxunl marked an inline comment as done.
yaxunl added a comment.

In D92720#2453277 <https://reviews.llvm.org/D92720#2453277>, @tra wrote:

> In D92720#2448890 <https://reviews.llvm.org/D92720#2448890>, @yaxunl wrote:
>
>> Output of `-E` for HIP combined host/device compilation is a plain text. It has C++ comments inserted between preprocessor outputs for host and different GPU arch's. The C++ comments follow the format of clang-offload-bundler bundled text files therefore clang-offload-bundler is able to unbundle it.
>
> OK.
>
> This actually exposed a minor issue. Using something that may legitemately occur in the user source as a separator is rather easy to break.
> E.g. there's nothing wrong with the following code, but the bundler will not handle it well if it's used with `hip-cpp-output`:
>
>   const char* s1 = R"foo(
>   // __CLANG_OFFLOAD_BUNDLE____END__ hip-amdgcn-amd-amdhsa-gfx803
>   )foo";
>
> It's not a showstopper, but it would be great if the separator would be something that can't be encountered in the preprocessed output.

That's a good point. Need to think about a better way even though the chances of encountering such issue are low.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D92720/new/

https://reviews.llvm.org/D92720



More information about the cfe-commits mailing list