From: Yaxun Liu Date: Wed, 27 Feb 2019 15:46:29 +0000 (+0000) Subject: [NFC] minor revision of r354929 [CUDA][HIP] Check calling convention based on functio... X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=785cbd850b76ce35968f0d85c4e19f1088ba8a37;p=platform%2Fupstream%2Fllvm.git [NFC] minor revision of r354929 [CUDA][HIP] Check calling convention based on function target Add comments and move a variable to if block. Differential Revision: https://reviews.llvm.org/D57716 llvm-svn: 354990 --- diff --git a/clang/lib/Sema/SemaDeclAttr.cpp b/clang/lib/Sema/SemaDeclAttr.cpp index 157c18a..4a8006a 100644 --- a/clang/lib/Sema/SemaDeclAttr.cpp +++ b/clang/lib/Sema/SemaDeclAttr.cpp @@ -4617,8 +4617,12 @@ bool Sema::CheckCallingConvAttr(const ParsedAttr &Attrs, CallingConv &CC, TargetInfo::CallingConvCheckResult A = TargetInfo::CCCR_OK; const TargetInfo &TI = Context.getTargetInfo(); - auto *Aux = Context.getAuxTargetInfo(); + // CUDA functions may have host and/or device attributes which indicate + // their targeted execution environment, therefore the calling convention + // of functions in CUDA should be checked against the target deduced based + // on their host/device attributes. if (LangOpts.CUDA) { + auto *Aux = Context.getAuxTargetInfo(); auto CudaTarget = IdentifyCUDATarget(FD); bool CheckHost = false, CheckDevice = false; switch (CudaTarget) {