forked from OSchip/llvm-project
Prevent cpu-specific/cpu-dispatch from giong on a lambda.
It is non-sensical to use cpu-specific/cpu-dispatch multiversioning on a lambda, so prevent it when trying to add the attribute. llvm-svn: 341833
This commit is contained in:
parent
5faf8a3d84
commit
659c871a1b
|
@ -1842,6 +1842,14 @@ static void handleRestrictAttr(Sema &S, Decl *D, const ParsedAttr &AL) {
|
|||
|
||||
static void handleCPUSpecificAttr(Sema &S, Decl *D, const ParsedAttr &AL) {
|
||||
FunctionDecl *FD = cast<FunctionDecl>(D);
|
||||
|
||||
if (const auto *MD = dyn_cast<CXXMethodDecl>(D)) {
|
||||
if (MD->getParent()->isLambda()) {
|
||||
S.Diag(AL.getLoc(), diag::err_attribute_dll_lambda) << AL;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (!checkAttributeAtLeastNumArgs(S, AL, 1))
|
||||
return;
|
||||
|
||||
|
|
|
@ -109,3 +109,6 @@ int __attribute__((cpu_specific(sandybridge))) BadOutOfLine::foo(int) { return 1
|
|||
|
||||
// Ensure Cpp Spelling works.
|
||||
[[clang::cpu_specific(ivybridge,atom)]] int CppSpelling(){}
|
||||
|
||||
// expected-error@+1 {{lambda cannot be declared 'cpu_dispatch'}}
|
||||
auto x = []() __attribute__((cpu_dispatch(atom))) {};
|
||||
|
|
Loading…
Reference in New Issue