================ @@ -0,0 +1,256 @@ +// RUN: %clang_cc1 -fsyntax-only -fblocks -fcxx-exceptions -std=c++20 -verify %s +// These are in a separate file because errors (e.g. incompatible attributes) currently prevent +// the FXAnalysis pass from running at all. + +// This diagnostic is re-enabled and exercised in isolation later in this file. +#pragma clang diagnostic ignored "-Wperf-constraint-implies-noexcept" + +// --- CONSTRAINTS --- + +void nb1() [[clang::nonblocking]] +{ + int *pInt = new int; // expected-warning {{'nonblocking' function must not allocate or deallocate memory}} + delete pInt; // expected-warning {{'nonblocking' function must not allocate or deallocate memory}} +} + +void nb2() [[clang::nonblocking]] +{ + static int global; // expected-warning {{'nonblocking' function must not have static locals}} +} + +void nb3() [[clang::nonblocking]] +{ + try { + throw 42; // expected-warning {{'nonblocking' function must not throw or catch exceptions}} + } + catch (...) { // expected-warning {{'nonblocking' function must not throw or catch exceptions}} + } +} + ---------------- Sirraide wrote:
Hmm yeah, that makes sense. It’s a bit annoying that the wording is just slightly different each time, otherwise, you could use something like `.Summary` to re-use the text of another diagnostic, but I don’t think that works for parts of it, and also, at that point it does really seem like you just want a separate diagnostic. I think the first two here are fine. We do have a few diagnostics w/ a lot of `%select` cases (e.g. `err_deduced_tst`, `err_expr_not_cce`), but yeah, I’m not sure you can reasonably combine these any further... https://github.com/llvm/llvm-project/pull/99656 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits