[PATCH] D84364: [CUDA][HIP] Defer all diagnostics for host device functions

Yaxun Liu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jul 22 14:26:15 PDT 2020


yaxunl created this revision.
yaxunl added a reviewer: tra.
Herald added subscribers: sstefan1, kristof.beyls.
Herald added a reviewer: jdoerfert.

In CUDA/HIP a function may become implicit host device function by
pragma or constexpr. A host device function is checked in both
host and device compilation. However it may be emitted only
on host or device side, therefore the diagnostics should be
deferred until it is known to be emitted.

Currently clang is only able to defer certain diagnostics. This causes
false alarms and limits the usefulness of host device functions.

This patch lets clang defer all diagnostics for host device functions.

It is NFC for other languages.


https://reviews.llvm.org/D84364

Files:
  clang/include/clang/Sema/Sema.h
  clang/lib/Sema/AnalysisBasedWarnings.cpp
  clang/lib/Sema/Sema.cpp
  clang/lib/Sema/SemaAttr.cpp
  clang/lib/Sema/SemaCUDA.cpp
  clang/lib/Sema/SemaDecl.cpp
  clang/lib/Sema/SemaExprObjC.cpp
  clang/lib/Sema/SemaOpenMP.cpp
  clang/lib/Sema/SemaSYCL.cpp
  clang/lib/Sema/SemaStmt.cpp
  clang/lib/Sema/SemaStmtAsm.cpp
  clang/lib/Sema/SemaTemplateInstantiate.cpp
  clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
  clang/lib/Sema/SemaTemplateVariadic.cpp
  clang/lib/Sema/SemaType.cpp
  clang/test/SemaCUDA/asm-constraints-mixed.cu
  clang/test/SemaCUDA/constexpr-variables.cu
  clang/test/SemaCUDA/cxx11-kernel-call.cu
  clang/test/SemaCUDA/exceptions.cu
  clang/test/SemaCUDA/implicit-member-target-inherited.cu
  clang/test/SemaCUDA/lambda.cu
  clang/test/SemaCUDA/no-call-stack-for-immediate-errs.cu
  clang/test/SemaCUDA/union-init.cu
  clang/test/SemaCUDA/usual-deallocators.cu

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D84364.279941.patch
Type: text/x-patch
Size: 53989 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200722/9f8354f0/attachment-0001.bin>


More information about the cfe-commits mailing list