[all-commits] [llvm/llvm-project] f263bd: [Clang] Implicitly include LLVM libc headers for t...

Joseph Huber via All-commits all-commits at lists.llvm.org
Mon Apr 3 10:57:36 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: f263bd8f7d4c82af9672803e6d8d57f25c929d00
      https://github.com/llvm/llvm-project/commit/f263bd8f7d4c82af9672803e6d8d57f25c929d00
  Author: Joseph Huber <jhuber6 at vols.utk.edu>
  Date:   2023-04-03 (Mon, 03 Apr 2023)

  Changed paths:
    M clang/lib/Driver/ToolChains/Clang.cpp
    A clang/test/Driver/gpu-libc-headers.c

  Log Message:
  -----------
  [Clang] Implicitly include LLVM libc headers for the GPU

There is currently work to support basic `libc` functionality on the
GPU. Some basic information about the projects can be found at
https://libc.llvm.org/gpu_mode.html. Typically, including the system
headers on the GPU will result in an error. For this reason the LLVM
`libc` project will generate its own headers that can be used with the
GPU.

The problem is that these headers will use the same name as the system headers.
For that reason, D146970 places it in the `llvm-libc` subfolder. In order to
still pick these files up, this patch adds changes in clang to default to
searching this directory when targeting the GPU. This lets offloading languages
such as OpenMP use the system `string.h` when compiling for the host and then
the LLVM libc `string.h` when targeting the GPU.

Depends on D146970

Reviewed By: tra

Differential Revision: https://reviews.llvm.org/D146973




More information about the All-commits mailing list