]> granicus.if.org Git - clang/commitdiff
[NFC] minor revision of r354929 [CUDA][HIP] Check calling convention based on functio...
authorYaxun Liu <Yaxun.Liu@amd.com>
Wed, 27 Feb 2019 15:46:29 +0000 (15:46 +0000)
committerYaxun Liu <Yaxun.Liu@amd.com>
Wed, 27 Feb 2019 15:46:29 +0000 (15:46 +0000)
Add comments and move a variable to if block.

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@354990 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/SemaDeclAttr.cpp

index 157c18a9e49492886ae83dc4d46771f106125095..4a8006ab1a80d31eb1f4feb4ecac8fe240c67328 100644 (file)
@@ -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) {