Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions clang/lib/Sema/SemaDeclAttr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5205,16 +5205,17 @@ static void handleCallConvAttr(Sema &S, Decl *D, const ParsedAttr &AL) {

static void handleDeviceKernelAttr(Sema &S, Decl *D, const ParsedAttr &AL) {
const auto *FD = dyn_cast_or_null<FunctionDecl>(D);
bool IsFunctionTemplate = FD && FD->getDescribedFunctionTemplate();
if (S.getASTContext().getTargetInfo().getTriple().isNVPTX()) {
handleGlobalAttr(S, D, AL);
} else {
if (DeviceKernelAttr::isOpenCLSpelling(AL) ||
!S.getASTContext().getTargetInfo().getTriple().isNVPTX()) {
bool IsFunctionTemplate = FD && FD->getDescribedFunctionTemplate();
// OpenCL C++ will throw a more specific error.
if (!S.getLangOpts().OpenCLCPlusPlus && (!FD || IsFunctionTemplate)) {
S.Diag(AL.getLoc(), diag::err_attribute_wrong_decl_type_str)
<< AL << AL.isRegularKeywordAttribute() << "functions";
}
handleSimpleAttribute<DeviceKernelAttr>(S, D, AL);
} else {
handleGlobalAttr(S, D, AL);
}
// Make sure we validate the CC with the target
// and warn/error if necessary.
Expand Down