[all-commits] [llvm/llvm-project] aa2904: [CUDA] Unbreak CUDA compilation with -std=c++20

Artem Belevich via All-commits all-commits at lists.llvm.org
Wed Dec 9 09:44:21 PST 2020


  Branch: refs/heads/release/11.x
  Home:   https://github.com/llvm/llvm-project
  Commit: aa29049404efdc0134066839bc14d135d69ec225
      https://github.com/llvm/llvm-project/commit/aa29049404efdc0134066839bc14d135d69ec225
  Author: Artem Belevich <tra at google.com>
  Date:   2020-12-09 (Wed, 09 Dec 2020)

  Changed paths:
    M clang/lib/Headers/cuda_wrappers/new

  Log Message:
  -----------
  [CUDA] Unbreak CUDA compilation with -std=c++20

Standard libc++ headers in stdc++ mode include <new> which picks up
cuda_wrappers/new before any of the CUDA macros have been defined.

We can not include CUDA headers that early, so the work-around is to define
__device__ in the wrapper header itself.

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

(cherry picked from commit 9a465057a64dba8a8614424d26136f5c0452bcc3)


  Commit: 59012b685fd69d7350eb55166a8817688e413db8
      https://github.com/llvm/llvm-project/commit/59012b685fd69d7350eb55166a8817688e413db8
  Author: Artem Belevich <tra at google.com>
  Date:   2020-12-09 (Wed, 09 Dec 2020)

  Changed paths:
    M clang/lib/Headers/cuda_wrappers/new

  Log Message:
  -----------
  [CUDA] Another attempt to fix early inclusion of <new> from libstdc++

Previous patch (9a465057a64dba) did not fix the problem.
https://bugs.llvm.org/show_bug.cgi?id=48228

If the <new> is included too early, before CUDA-specific defines are available,
just include-next the standard <new> and undo the include guard.  CUDA-specific
variants of operator new/delete will be declared if/when <new> is used from the
CUDA source itself, when all CUDA-related macros are available.

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

(cherry picked from commit 43267929423bf768bbbcc65e47a07e37af7f4e22)


Compare: https://github.com/llvm/llvm-project/compare/14d60e9a80d4...59012b685fd6


More information about the All-commits mailing list