[OPENMP]Fix parsing/sema for function templates with declare simd.

Need to return original declaration group with FunctionTemplateDecl, not
the inner FunctionDecl, to correctly handle parsing of directives with
the templates parameters.

llvm-svn: 372011
This commit is contained in:
Alexey Bataev 2019-09-16 17:06:31 +00:00
parent 10151f6618
commit a00630785f
2 changed files with 10 additions and 1 deletions

View File

@ -4889,7 +4889,7 @@ Sema::DeclGroupPtrTy Sema::ActOnOpenMPDeclareSimdDirective(
const_cast<unsigned *>(LinModifiers.data()), LinModifiers.size(),
NewSteps.data(), NewSteps.size(), SR);
ADecl->addAttr(NewAttr);
return ConvertDeclToDeclGroup(ADecl);
return DG;
}
Sema::DeclGroupPtrTy

View File

@ -21,6 +21,15 @@ void add_1(float *d) __attribute__((cold));
// CHECK-NEXT: void add_1(float *d) __attribute__((cold));
//
#pragma omp declare simd aligned(hp, hp2:V)
#pragma omp declare simd aligned(hp, hp2:V)
template <class C, int V> void h(C *hp, C *hp2, C *hq, C *lin) {
}
// CHECK-NEXT: #pragma omp declare simd aligned(hp: V) aligned(hp2: V)
// CHECK-NEXT: #pragma omp declare simd aligned(hp: V) aligned(hp2: V)
// CHECK-NEXT: template <class C, int V> void h(C *hp, C *hp2, C *hq, C *lin) {
// CHECK-NEXT: }
#pragma omp declare simd aligned(hp, hp2)
template <class C> void h(C *hp, C *hp2, C *hq, C *lin) {
}