llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT--> @llvm/pr-subscribers-openmp Author: None (Sirraide) <details> <summary>Changes</summary> @<!-- -->AaronBallman, @<!-- -->erichkeane This is a followup to #<!-- -->81014 and #<!-- -->84582. For anyone not familiar with what this is about: Clang provides `__attribute__((assume))` and `[[clang::assume]]` as nonstandard spellings for the `[[omp::assume]]` attribute; this results in a potentially very confusing name clash with C++23’s `[[assume]]` attribute. This pr is about deciding what to do about this. Just to see how much would be affected by this, I’ve gone ahead and removed every last mention of `__attribute__((assume))` and replaced it with `[[omp::assume]]`. Here are a few things I have observed / changes I’ve implemented: - `[[omp::assume]]` can no longer be spelt `__attribute__((assume))` or `[[clang::assume]]`. - `__attribute__((assume))` and `[[clang::assume]]` are now alternative spellings for C++23’s `[[assume]]`; this shouldn’t cause any problems due to differences in appertainment: the OMP attribute only appertains to functions, and C++23’s only to empty statements, so any code using `__attribute__((assume))` in that position with Clang would not have compiled anyway. This should help improve GCC compatibility. - The OpenMP specification only supports `assume` as an attribute in C++11 and later. However, libclc appears to be using `__attribute__((assume))` internally, specifically, in one header that defines a macro that is then used throughout the codebase. I’m not familiar with libclc or OpenCL, so I’ve added `omp_assume` as an alternative spelling for the OpenMP attribute and replaced the attribute in the header in question with `__attribute__((__omp_assume__))`. If it turns out that using `[[]]`-style attributes in libclc is fine after all, I would suggest using that instead and not providing the `omp_assume` spelling in the first place. It should be noted that, without the `omp_assume` spelling, it would be impossible to use this attribute in C without running into `-pedantic` warnings; we could consider supporting `[[omp::assume]]` in C23, though. - From what I can tell, no-one except libclc is actually using this attribute? At least on github, the only matches I’ve found for `__attribute__((assume("omp` are in LLVM and various forks thereof. Given that it’s not particularly widely used, I don’t think removal *without* deprecation would be that big of a deal in this case, though if you think that that’s a non-option, then I’d instead suggest deprecating it and removing it in a later version of Clang. TODO: - [ ] Discuss whether this is what we want to do, or decide on what to do instead. - [ ] Figure out whether we can use `[[omp::assume]]` in libclc. - [ ] If we decide to support `[[omp::assume]]` in C (or an alternative spelling thereof, in which case we should also update diagnostics that mention `[[omp::assume]]` to display that spelling instead if we’re compiling C, if possible), add some tests for that. - [ ] Update the documentation for `__attribute__((assume))`. --- Patch is 42.81 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/84934.diff 25 Files Affected: - (modified) clang/include/clang/Basic/Attr.td (+3-2) - (modified) clang/include/clang/Basic/AttrDocs.td (+2-2) - (modified) clang/include/clang/Basic/DiagnosticSemaKinds.td (-3) - (modified) clang/lib/Parse/ParseDecl.cpp (+7) - (modified) clang/lib/Sema/SemaStmtAttr.cpp (+2-1) - (removed) clang/test/CodeGen/assume_attr.c (-58) - (modified) clang/test/CodeGenCXX/assume_attr.cpp (+24-24) - (modified) clang/test/OpenMP/assumes_codegen.cpp (+40-40) - (modified) clang/test/OpenMP/assumes_print.cpp (+3-3) - (modified) clang/test/OpenMP/assumes_template_print.cpp (+10-10) - (modified) clang/test/OpenMP/remarks_parallel_in_multiple_target_state_machines.c (+4-4) - (modified) clang/test/OpenMP/remarks_parallel_in_target_state_machine.c (+2-2) - (removed) clang/test/Sema/attr-assume.c (-14) - (modified) clang/test/SemaCXX/cxx23-assume.cpp (+4) - (modified) libclc/generic/include/clc/clcfunc.h (+1-1) - (modified) llvm/lib/Transforms/IPO/OpenMPOpt.cpp (+2-2) - (modified) llvm/test/Transforms/OpenMP/custom_state_machines.ll (+1-1) - (modified) llvm/test/Transforms/OpenMP/custom_state_machines_pre_lto.ll (+1-1) - (modified) llvm/test/Transforms/OpenMP/custom_state_machines_remarks.ll (+5-5) - (modified) llvm/test/Transforms/OpenMP/spmdization.ll (+2-2) - (modified) llvm/test/Transforms/OpenMP/spmdization_guarding.ll (+2-2) - (modified) llvm/test/Transforms/OpenMP/spmdization_remarks.ll (+7-7) - (modified) openmp/docs/remarks/OMP121.rst (+3-3) - (modified) openmp/docs/remarks/OMP133.rst (+3-3) - (modified) openmp/docs/remarks/OptimizationRemarks.rst (+2-2) ``````````diff diff --git a/clang/include/clang/Basic/Attr.td b/clang/include/clang/Basic/Attr.td index 080340669b60a0..39fccc720bc9cd 100644 --- a/clang/include/clang/Basic/Attr.td +++ b/clang/include/clang/Basic/Attr.td @@ -1581,10 +1581,11 @@ def Unlikely : StmtAttr { def : MutualExclusions<[Likely, Unlikely]>; def CXXAssume : StmtAttr { - let Spellings = [CXX11<"", "assume", 202207>]; + let Spellings = [CXX11<"", "assume", 202207>, Clang<"assume">]; let Subjects = SubjectList<[NullStmt], ErrorDiag, "empty statements">; let Args = [ExprArgument<"Assumption">]; let Documentation = [CXXAssumeDocs]; + let HasCustomParsing = 1; } def NoMerge : DeclOrStmtAttr { @@ -4159,7 +4160,7 @@ def OMPDeclareVariant : InheritableAttr { } def OMPAssume : InheritableAttr { - let Spellings = [Clang<"assume">, CXX11<"omp", "assume">]; + let Spellings = [CXX11<"omp", "assume">, Clang<"omp_assume">]; let Subjects = SubjectList<[Function, ObjCMethod]>; let InheritEvenIfAlreadyPresent = 1; let Documentation = [OMPAssumeDocs]; diff --git a/clang/include/clang/Basic/AttrDocs.td b/clang/include/clang/Basic/AttrDocs.td index 2c07cd09b0d5b7..855d57228c56fc 100644 --- a/clang/include/clang/Basic/AttrDocs.td +++ b/clang/include/clang/Basic/AttrDocs.td @@ -4661,7 +4661,7 @@ def OMPAssumeDocs : Documentation { let Category = DocCatFunction; let Heading = "assume"; let Content = [{ -Clang supports the ``__attribute__((assume("assumption")))`` attribute to +Clang supports the ``[[omp::assume("assumption")]]`` attribute to provide additional information to the optimizer. The string-literal, here "assumption", will be attached to the function declaration such that later analysis and optimization passes can assume the "assumption" to hold. @@ -4673,7 +4673,7 @@ A function can have multiple assume attributes and they propagate from prior declarations to later definitions. Multiple assumptions are aggregated into a single comma separated string. Thus, one can provide multiple assumptions via a comma separated string, i.a., -``__attribute__((assume("assumption1,assumption2")))``. +``[[omp::assume("assumption1,assumption2")]]``. While LLVM plugins might provide more assumption strings, the default LLVM optimization passes are aware of the following assumptions: diff --git a/clang/include/clang/Basic/DiagnosticSemaKinds.td b/clang/include/clang/Basic/DiagnosticSemaKinds.td index c54105507753eb..5b95b0f11d41cd 100644 --- a/clang/include/clang/Basic/DiagnosticSemaKinds.td +++ b/clang/include/clang/Basic/DiagnosticSemaKinds.td @@ -10171,9 +10171,6 @@ def err_fallthrough_attr_outside_switch : Error< def err_fallthrough_attr_invalid_placement : Error< "fallthrough annotation does not directly precede switch label">; -def err_assume_attr_args : Error< - "attribute '%0' requires a single expression argument">; - def warn_unreachable_default : Warning< "default label in switch which covers all enumeration values">, InGroup<CoveredSwitchDefault>, DefaultIgnore; diff --git a/clang/lib/Parse/ParseDecl.cpp b/clang/lib/Parse/ParseDecl.cpp index dd179414a14191..3423a1d7e22430 100644 --- a/clang/lib/Parse/ParseDecl.cpp +++ b/clang/lib/Parse/ParseDecl.cpp @@ -629,6 +629,9 @@ void Parser::ParseGNUAttributeArgs( ParseAttributeWithTypeArg(*AttrName, AttrNameLoc, Attrs, ScopeName, ScopeLoc, Form); return; + } else if (AttrKind == ParsedAttr::AT_CXXAssume) { + ParseCXXAssumeAttributeArg(Attrs, AttrName, AttrNameLoc, EndLoc); + return; } // These may refer to the function arguments, but need to be parsed early to @@ -683,6 +686,10 @@ unsigned Parser::ParseClangAttributeArgs( ParseTypeTagForDatatypeAttribute(*AttrName, AttrNameLoc, Attrs, EndLoc, ScopeName, ScopeLoc, Form); break; + + case ParsedAttr::AT_CXXAssume: + ParseCXXAssumeAttributeArg(Attrs, AttrName, AttrNameLoc, EndLoc); + break; } return !Attrs.empty() ? Attrs.begin()->getNumArgs() : 0; } diff --git a/clang/lib/Sema/SemaStmtAttr.cpp b/clang/lib/Sema/SemaStmtAttr.cpp index 691857e88beb49..c72af6a24033d2 100644 --- a/clang/lib/Sema/SemaStmtAttr.cpp +++ b/clang/lib/Sema/SemaStmtAttr.cpp @@ -656,7 +656,8 @@ bool Sema::CheckRebuiltStmtAttributes(ArrayRef<const Attr *> Attrs) { ExprResult Sema::ActOnCXXAssumeAttr(Stmt *St, const ParsedAttr &A, SourceRange Range) { if (A.getNumArgs() != 1 || !A.getArgAsExpr(0)) { - Diag(A.getLoc(), diag::err_assume_attr_args) << A.getAttrName() << Range; + Diag(A.getLoc(), diag::err_attribute_wrong_number_arguments) + << A.getAttrName() << 1 << Range; return ExprError(); } diff --git a/clang/test/CodeGen/assume_attr.c b/clang/test/CodeGen/assume_attr.c deleted file mode 100644 index 338a625188af08..00000000000000 --- a/clang/test/CodeGen/assume_attr.c +++ /dev/null @@ -1,58 +0,0 @@ -// RUN: %clang_cc1 -emit-llvm -triple i386-linux-gnu %s -o - | FileCheck %s -// RUN: %clang_cc1 -x c -emit-pch -o %t %s -// RUN: %clang_cc1 -include-pch %t %s -emit-llvm -o - | FileCheck %s - -// TODO: for "foo" and "bar", "after" is not added as it appears "after" the first use or definition respectively. There might be a way to allow that. - -// CHECK: define{{.*}} void @bar() #0 -// CHECK: define{{.*}} void @baz() #1 -// CHECK: declare{{.*}} void @foo() #2 -// CHECK: attributes #0 -// CHECK-SAME: "llvm.assume"="bar:before1,bar:before2,bar:before3,bar:def1,bar:def2" -// CHECK: attributes #1 -// CHECK-SAME: "llvm.assume"="baz:before1,baz:before2,baz:before3,baz:def1,baz:def2,baz:after" -// CHECK: attributes #2 -// CHECK-SAME: "llvm.assume"="foo:before1,foo:before2,foo:before3" - -#ifndef HEADER -#define HEADER - -/// foo: declarations only - -__attribute__((assume("foo:before1"))) void foo(void); - -__attribute__((assume("foo:before2"))) -__attribute__((assume("foo:before3"))) void -foo(void); - -/// baz: static function declarations and a definition - -__attribute__((assume("baz:before1"))) static void baz(void); - -__attribute__((assume("baz:before2"))) -__attribute__((assume("baz:before3"))) static void -baz(void); - -// Definition -__attribute__((assume("baz:def1,baz:def2"))) static void baz(void) { foo(); } - -__attribute__((assume("baz:after"))) static void baz(void); - -/// bar: external function declarations and a definition - -__attribute__((assume("bar:before1"))) void bar(void); - -__attribute__((assume("bar:before2"))) -__attribute__((assume("bar:before3"))) void -bar(void); - -// Definition -__attribute__((assume("bar:def1,bar:def2"))) void bar(void) { baz(); } - -__attribute__((assume("bar:after"))) void bar(void); - -/// back to foo - -__attribute__((assume("foo:after"))) void foo(void); - -#endif diff --git a/clang/test/CodeGenCXX/assume_attr.cpp b/clang/test/CodeGenCXX/assume_attr.cpp index dbe76501377c0a..962dcc470f676a 100644 --- a/clang/test/CodeGenCXX/assume_attr.cpp +++ b/clang/test/CodeGenCXX/assume_attr.cpp @@ -8,77 +8,77 @@ /// foo: declarations only -__attribute__((assume("foo:before1"))) void foo(); +[[omp::assume("foo:before1")]] void foo(); -__attribute__((assume("foo:before2"))) -__attribute__((assume("foo:before3"))) void +[[omp::assume("foo:before2")]] +[[omp::assume("foo:before3")]] void foo(); /// baz: static function declarations and a definition -__attribute__((assume("baz:before1"))) static void baz(); +[[omp::assume("baz:before1")]] static void baz(); -__attribute__((assume("baz:before2"))) -__attribute__((assume("baz:before3"))) static void +[[omp::assume("baz:before2")]] +[[omp::assume("baz:before3")]] static void baz(); // Definition -__attribute__((assume("baz:def1,baz:def2"))) static void baz() { foo(); } +[[omp::assume("baz:def1,baz:def2")]] static void baz() { foo(); } -__attribute__((assume("baz:after"))) static void baz(); +[[omp::assume("baz:after")]] static void baz(); /// bar: external function declarations and a definition -__attribute__((assume("bar:before1"))) void bar(); +[[omp::assume("bar:before1")]] void bar(); -__attribute__((assume("bar:before2"))) -__attribute__((assume("bar:before3"))) void +[[omp::assume("bar:before2")]] +[[omp::assume("bar:before3")]] void bar(); // Definition -__attribute__((assume("bar:def1,bar:def2"))) void bar() { baz(); } +[[omp::assume("bar:def1,bar:def2")]] void bar() { baz(); } -__attribute__((assume("bar:after"))) void bar(); +[[omp::assume("bar:after")]] void bar(); /// back to foo -__attribute__((assume("foo:after"))) void foo(); +[[omp::assume("foo:after")]] void foo(); /// class tests class C { - __attribute__((assume("C:private_method"))) void private_method(); - __attribute__((assume("C:private_static"))) static void private_static(); + [[omp::assume("C:private_method")]] void private_method(); + [[omp::assume("C:private_static")]] static void private_static(); public: - __attribute__((assume("C:public_method1"))) void public_method(); - __attribute__((assume("C:public_static1"))) static void public_static(); + [[omp::assume("C:public_method1")]] void public_method(); + [[omp::assume("C:public_static1")]] static void public_static(); }; -__attribute__((assume("C:public_method2"))) void C::public_method() { +[[omp::assume("C:public_method2")]] void C::public_method() { private_method(); } -__attribute__((assume("C:public_static2"))) void C::public_static() { +[[omp::assume("C:public_static2")]] void C::public_static() { private_static(); } /// template tests template <typename T> -__attribute__((assume("template_func<T>"))) void template_func() {} +[[omp::assume("template_func<T>")]] void template_func() {} template <> -__attribute__((assume("template_func<float>"))) void template_func<float>() {} +[[omp::assume("template_func<float>")]] void template_func<float>() {} template <> void template_func<int>() {} template <typename T> struct S { - __attribute__((assume("S<T>::method"))) void method(); + [[omp::assume("S<T>::method")]] void method(); }; template <> -__attribute__((assume("S<float>::method"))) void S<float>::method() {} +[[omp::assume("S<float>::method")]] void S<float>::method() {} template <> void S<int>::method() {} diff --git a/clang/test/OpenMP/assumes_codegen.cpp b/clang/test/OpenMP/assumes_codegen.cpp index 6a5871c303aade..2682e394d0d324 100644 --- a/clang/test/OpenMP/assumes_codegen.cpp +++ b/clang/test/OpenMP/assumes_codegen.cpp @@ -67,46 +67,46 @@ int lambda_outer() { } #pragma omp end assumes -// AST: __attribute__((assume("omp_no_openmp_routines,ompx_another_warning,ompx_after_invalid_clauses"))) __attribute__((assume("omp_no_openmp"))) void foo() { -// AST-NEXT: } -// AST-NEXT: class BAR { -// AST-NEXT: public: -// AST-NEXT: __attribute__((assume("ompx_range_bar_only"))) __attribute__((assume("ompx_range_bar_only_2"))) __attribute__((assume("omp_no_openmp_routines,ompx_another_warning,ompx_after_invalid_clauses"))) __attribute__((assume("omp_no_openmp"))) BAR() { -// AST-NEXT: } -// AST-NEXT: __attribute__((assume("ompx_range_bar_only"))) __attribute__((assume("ompx_range_bar_only_2"))) __attribute__((assume("omp_no_openmp_routines,ompx_another_warning,ompx_after_invalid_clauses"))) __attribute__((assume("omp_no_openmp"))) void bar1() { -// AST-NEXT: } -// AST-NEXT: __attribute__((assume("ompx_range_bar_only"))) __attribute__((assume("ompx_range_bar_only_2"))) __attribute__((assume("omp_no_openmp_routines,ompx_another_warning,ompx_after_invalid_clauses"))) __attribute__((assume("omp_no_openmp"))) static void bar2() { -// AST-NEXT: } -// AST-NEXT: }; -// AST-NEXT: __attribute__((assume("ompx_range_bar_only"))) __attribute__((assume("ompx_range_bar_only_2"))) __attribute__((assume("omp_no_openmp_routines,ompx_another_warning,ompx_after_invalid_clauses"))) __attribute__((assume("omp_no_openmp"))) void bar() { -// AST-NEXT: BAR b; -// AST-NEXT: } -// AST-NEXT: void baz() __attribute__((assume("ompx_1234"))) __attribute__((assume("omp_no_openmp_routines,ompx_another_warning,ompx_after_invalid_clauses"))) __attribute__((assume("omp_no_openmp"))); -// AST-NEXT: template <typename T> class BAZ { -// AST-NEXT: public: -// AST-NEXT: __attribute__((assume("ompx_1234"))) __attribute__((assume("omp_no_openmp_routines,ompx_another_warning,ompx_after_invalid_clauses"))) __attribute__((assume("omp_no_openmp"))) BAZ<T>() { -// AST-NEXT: } -// AST-NEXT: __attribute__((assume("ompx_1234"))) __attribute__((assume("omp_no_openmp_routines,ompx_another_warning,ompx_after_invalid_clauses"))) __attribute__((assume("omp_no_openmp"))) void baz1() { -// AST-NEXT: } -// AST-NEXT: __attribute__((assume("ompx_1234"))) __attribute__((assume("omp_no_openmp_routines,ompx_another_warning,ompx_after_invalid_clauses"))) __attribute__((assume("omp_no_openmp"))) static void baz2() { -// AST-NEXT: } -// AST-NEXT: }; -// AST-NEXT: template<> class BAZ<float> { -// AST-NEXT: public: -// AST-NEXT: __attribute__((assume("ompx_1234"))) __attribute__((assume("omp_no_openmp_routines,ompx_another_warning,ompx_after_invalid_clauses"))) __attribute__((assume("omp_no_openmp"))) __attribute__((assume("omp_no_openmp_routines,ompx_another_warning,ompx_after_invalid_clauses"))) __attribute__((assume("omp_no_openmp"))) BAZ() { -// AST-NEXT: } -// AST-NEXT: void baz1() __attribute__((assume("ompx_1234"))) __attribute__((assume("omp_no_openmp_routines,ompx_another_warning,ompx_after_invalid_clauses"))) __attribute__((assume("omp_no_openmp"))) __attribute__((assume("omp_no_openmp_routines,ompx_another_warning,ompx_after_invalid_clauses"))) __attribute__((assume("omp_no_openmp"))); -// AST-NEXT: static void baz2() __attribute__((assume("ompx_1234"))) __attribute__((assume("omp_no_openmp_routines,ompx_another_warning,ompx_after_invalid_clauses"))) __attribute__((assume("omp_no_openmp"))) __attribute__((assume("omp_no_openmp_routines,ompx_another_warning,ompx_after_invalid_clauses"))) __attribute__((assume("omp_no_openmp"))); -// AST-NEXT: }; -// AST-NEXT: __attribute__((assume("ompx_1234"))) __attribute__((assume("omp_no_openmp_routines,ompx_another_warning,ompx_after_invalid_clauses"))) __attribute__((assume("omp_no_openmp"))) void baz() { -// AST-NEXT: BAZ<float> b; -// AST-NEXT: } -// AST-NEXT: __attribute__((assume("ompx_lambda_assumption"))) __attribute__((assume("omp_no_openmp_routines,ompx_another_warning,ompx_after_invalid_clauses"))) __attribute__((assume("omp_no_openmp"))) int lambda_outer() { -// AST-NEXT: auto lambda_inner = []() { -// AST-NEXT: return 42; -// AST-NEXT: }; -// AST-NEXT: return lambda_inner(); -// AST-NEXT: } +// AST{LITERAL}: void foo() [[omp::assume("omp_no_openmp_routines,ompx_another_warning,ompx_after_invalid_clauses")]] [[omp::assume("omp_no_openmp")]] { +// AST-NEXT{LITERAL}: } +// AST-NEXT{LITERAL}: class BAR { +// AST-NEXT{LITERAL}: public: +// AST-NEXT{LITERAL}: BAR() [[omp::assume("ompx_range_bar_only")]] [[omp::assume("ompx_range_bar_only_2")]] [[omp::assume("omp_no_openmp_routines,ompx_another_warning,ompx_after_invalid_clauses")]] [[omp::assume("omp_no_openmp")]] { +// AST-NEXT{LITERAL}: } +// AST-NEXT{LITERAL}: void bar1() [[omp::assume("ompx_range_bar_only")]] [[omp::assume("ompx_range_bar_only_2")]] [[omp::assume("omp_no_openmp_routines,ompx_another_warning,ompx_after_invalid_clauses")]] [[omp::assume("omp_no_openmp")]] { +// AST-NEXT{LITERAL}: } +// AST-NEXT{LITERAL}: static void bar2() [[omp::assume("ompx_range_bar_only")]] [[omp::assume("ompx_range_bar_only_2")]] [[omp::assume("omp_no_openmp_routines,ompx_another_warning,ompx_after_invalid_clauses")]] [[omp::assume("omp_no_openmp")]] { +// AST-NEXT{LITERAL}: } +// AST-NEXT{LITERAL}: }; +// AST-NEXT{LITERAL}: void bar() [[omp::assume("ompx_range_bar_only")]] [[omp::assume("ompx_range_bar_only_2")]] [[omp::assume("omp_no_openmp_routines,ompx_another_warning,ompx_after_invalid_clauses")]] [[omp::assume("omp_no_openmp")]] { +// AST-NEXT{LITERAL}: BAR b; +// AST-NEXT{LITERAL}: } +// AST-NEXT{LITERAL}: void baz() [[omp::assume("ompx_1234")]] [[omp::assume("omp_no_openmp_routines,ompx_another_warning,ompx_after_invalid_clauses")]] [[omp::assume("omp_no_openmp")]]; +// AST-NEXT{LITERAL}: template <typename T> class BAZ { +// AST-NEXT{LITERAL}: public: +// AST-NEXT{LITERAL}: BAZ<T>() [[omp::assume("ompx_1234")]] [[omp::assume("omp_no_openmp_routines,ompx_another_warning,ompx_after_invalid_clauses")]] [[omp::assume("omp_no_openmp")]] { +// AST-NEXT{LITERAL}: } +// AST-NEXT{LITERAL}: void baz1() [[omp::assume("ompx_1234")]] [[omp::assume("omp_no_openmp_routines,ompx_another_warning,ompx_after_invalid_clauses")]] [[omp::assume("omp_no_openmp")]] { +// AST-NEXT{LITERAL}: } +// AST-NEXT{LITERAL}: static void baz2() [[omp::assume("ompx_1234")]] [[omp::assume("omp_no_openmp_routines,ompx_another_warning,ompx_after_invalid_clauses")]] [[omp::assume("omp_no_openmp")]] { +// AST-NEXT{LITERAL}: } +// AST-NEXT{LITERAL}: }; +// AST-NEXT{LITERAL}: template<> class BAZ<float> { +// AST-NEXT{LITERAL}: public: +// AST-NEXT{LITERAL}: BAZ() [[omp::assume("ompx_1234")]] [[omp::assume("omp_no_openmp_routines,ompx_another_warning,ompx_after_invalid_clauses")]] [[omp::assume("omp_no_openmp")]] [[omp::assume("omp_no_openmp_routines,ompx_another_warning,ompx_after_invalid_clauses")]] [[omp::assume("omp_no_openmp")]] { +// AST-NEXT{LITERAL}: } +// AST-NEXT{LITERAL}: void baz1() [[omp::assume("ompx_1234")]] [[omp::assume("omp_no_openmp_routines,ompx_another_warning,ompx_after_invalid_clauses")]] [[omp::assume("omp_no_openmp")]] [[omp::assume("omp_no_openmp_routines,ompx_another_warning,ompx_after_invalid_clauses")]] [[omp::assume("omp_no_openmp")]]; +// AST-NEXT{LITERAL}: static void baz2() [[omp::assume("ompx_1234")]] [[omp::assume("omp_no_openmp_routines,ompx_another_warning,ompx_after_invalid_clauses")]] [[omp::assume("omp_no_openmp")]] [[omp::assume("omp_no_openmp_routines,ompx_another_warning,ompx_after_invalid_clauses")]] [[omp::assume("omp_no_openmp")]]; +// AST-NEXT{LITERAL}: }; +// AST-NEXT{LITERAL}: void baz() [[omp::assume("ompx_1234")]] [[omp::assume("omp_no_openmp_routines,ompx_another_warning,ompx_after_invalid_clauses")]] [[omp::assume("omp_no_openmp")]] { +// AST-NEXT{LITERAL}: BAZ<float> b; +// AST-NEXT{LITERAL}: } +// AST-NEXT{LITERAL}: int lambda_outer() [[omp::assume("ompx_lambda_assumption")]] [[omp::assume("omp_no_openmp_routines,ompx_another_warning,ompx_after_invalid_clauses")]] [[omp::assume("omp_no_openmp")]] { +// AST-NEXT{LITERAL}: auto lambda_inner = []() { +// AST-NEXT{LITERAL}: return 42; +// AST-NEXT{LITERAL}: }; +// AST-NEXT{LITERAL}: return lambda_inner(); +// AST-NEXT{LITERAL}: } #endif diff --git a/clang/test/OpenMP/assumes_print.cpp b/clang/test/OpenMP/assumes_print.cpp index a7f04edb3b1af4..6f83912a277d29 100644 --- a/clang/test/OpenMP/assumes_print.cpp +++ b/clang/test/OpenMP/assumes_print.cpp @@ -37,8 +37,8 @@ void baz() { } #pragma omp end assumes -// CHECK: __attribute__((assume("omp_no_openmp_routines"))) __attribute__((assume("omp_no_openmp"))) void foo() -// CHECK: __attribute__((assume("ompx_range_bar_only"))) __attribute__((assume("ompx_range_bar_only_2"))) __attribute__((assume("omp_no_openmp_routines"))) __attribute__((assume("omp_no_openmp"))) void bar() -// CHECK: __attribute__((assume("ompx_1234"))) __attribute__((assume("omp_no_openmp_routines"))) __attribute__((assume("omp_no_openmp"))) void baz() +// CHECK{LITERAL}: void foo() [[omp::assume("omp_no_openmp_routines")]] [[omp::assume("omp_no_openmp")]] +// CHECK{LITERAL}: void bar() [[omp::assume("ompx_range_bar_only")]] [[omp::assume("ompx_range_bar_only_2")]] [[omp::assume("omp_no_openmp_routines")]] [[omp::assume("omp_no_openmp")]] +// CHECK{LITERAL}: void baz() [[omp::assume("ompx_1234")]] [[omp::assume("omp_no_openmp_routines")]] [[omp::assume("omp_no_openmp")]] #endif diff --git a/clang/test/OpenMP/assumes_template_print.cpp b/clang/test/OpenMP/assumes_template_print.cpp index bd1100fbefffc6..b1f3df7cb6fc6a 100644 --- a/clang/test/OpenMP/assumes_template_print.cpp +++ b/clang/test/OpenMP/assumes_template_print.cpp @@ -17,7 +17,7 @@ template <typename T> struct S { int a; // CHECK: template <typename T> struct S { -// CHECK: __attribute__((assume("ompx_global_... [truncated] `````````` </details> https://github.com/llvm/llvm-project/pull/84934 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits