r373257 - [OPENMP50]Mark declare variant attribute as inheritable.
Alexey Bataev via cfe-commits
cfe-commits at lists.llvm.org
Mon Sep 30 13:39:29 PDT 2019
Author: abataev
Date: Mon Sep 30 13:39:29 2019
New Revision: 373257
URL: http://llvm.org/viewvc/llvm-project?rev=373257&view=rev
Log:
[OPENMP50]Mark declare variant attribute as inheritable.
Attribute must be inherited by the redeclarations.
Modified:
cfe/trunk/include/clang/Basic/Attr.td
cfe/trunk/test/OpenMP/declare_variant_ast_print.cpp
Modified: cfe/trunk/include/clang/Basic/Attr.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/Attr.td?rev=373257&r1=373256&r2=373257&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/Attr.td (original)
+++ cfe/trunk/include/clang/Basic/Attr.td Mon Sep 30 13:39:29 2019
@@ -3281,11 +3281,12 @@ def OMPAllocateDecl : InheritableAttr {
let Documentation = [Undocumented];
}
-def OMPDeclareVariant : Attr {
+def OMPDeclareVariant : InheritableAttr {
let Spellings = [Pragma<"omp", "declare variant">];
let Subjects = SubjectList<[Function]>;
let SemaHandler = 0;
let HasCustomParsing = 1;
+ let InheritEvenIfAlreadyPresent = 1;
let Documentation = [OMPDeclareVariantDocs];
let Args = [
ExprArgument<"VariantFuncRef">,
Modified: cfe/trunk/test/OpenMP/declare_variant_ast_print.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/declare_variant_ast_print.cpp?rev=373257&r1=373256&r2=373257&view=diff
==============================================================================
--- cfe/trunk/test/OpenMP/declare_variant_ast_print.cpp (original)
+++ cfe/trunk/test/OpenMP/declare_variant_ast_print.cpp Mon Sep 30 13:39:29 2019
@@ -148,6 +148,8 @@ auto fn_deduced1() { return 0; }
// CHECK-NEXT: #pragma omp declare variant(SpecialFuncs::bar) match(implementation={vendor(llvm)})
// CHECK-NEXT: void foo1() {
// CHECK-NEXT: }
+// CHECK-NEXT: #pragma omp declare variant(SpecialFuncs::baz) match(implementation={vendor(unknown)})
+// CHECK-NEXT: void xxx();
// CHECK-NEXT: } s;
struct SpecialFuncs {
void vd() {}
@@ -162,8 +164,15 @@ struct SpecialFuncs {
#pragma omp declare variant(SpecialFuncs::bar) match(implementation={vendor(ibm)}, implementation={vendor(llvm)})
#pragma omp declare variant(SpecialFuncs::baz) match(implementation={vendor(unknown)})
void foo1() {}
+#pragma omp declare variant(SpecialFuncs::baz) match(implementation={vendor(unknown)})
+ void xxx();
} s;
+// CHECK: #pragma omp declare variant(SpecialFuncs::baz) match(implementation={vendor(unknown)})
+// CHECK-NEXT: void SpecialFuncs::xxx() {
+// CHECK-NEXT: }
+void SpecialFuncs::xxx() {}
+
// CHECK: static void static_f_variant() {
// CHECK-NEXT: }
static void static_f_variant() {}
More information about the cfe-commits
mailing list