Skip to content

Commit 158e676

Browse files
committed
swap order
Signed-off-by: Sarnie, Nick <[email protected]>
1 parent d75ca93 commit 158e676

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

clang/lib/Sema/SemaDeclAttr.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5205,17 +5205,17 @@ static void handleCallConvAttr(Sema &S, Decl *D, const ParsedAttr &AL) {
52055205

52065206
static void handleDeviceKernelAttr(Sema &S, Decl *D, const ParsedAttr &AL) {
52075207
const auto *FD = dyn_cast_or_null<FunctionDecl>(D);
5208-
bool IsFunctionTemplate = FD && FD->getDescribedFunctionTemplate();
5209-
if (S.getASTContext().getTargetInfo().getTriple().isNVPTX() &&
5210-
!DeviceKernelAttr::isOpenCLSpelling(AL)) {
5211-
handleGlobalAttr(S, D, AL);
5212-
} else {
5208+
if (DeviceKernelAttr::isOpenCLSpelling(AL) ||
5209+
!S.getASTContext().getTargetInfo().getTriple().isNVPTX()) {
5210+
bool IsFunctionTemplate = FD && FD->getDescribedFunctionTemplate();
52135211
// OpenCL C++ will throw a more specific error.
52145212
if (!S.getLangOpts().OpenCLCPlusPlus && (!FD || IsFunctionTemplate)) {
52155213
S.Diag(AL.getLoc(), diag::err_attribute_wrong_decl_type_str)
52165214
<< AL << AL.isRegularKeywordAttribute() << "functions";
52175215
}
52185216
handleSimpleAttribute<DeviceKernelAttr>(S, D, AL);
5217+
} else {
5218+
handleGlobalAttr(S, D, AL);
52195219
}
52205220
// Make sure we validate the CC with the target
52215221
// and warn/error if necessary.

0 commit comments

Comments
 (0)