[clang] [Clang] FunctionEffects: Correctly navigate through array types in FunctionEffectsRef::get(). (PR #121525)

2025-01-17 Thread Doug Wyatt via cfe-commits
https://github.com/dougsonos closed https://github.com/llvm/llvm-project/pull/121525 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] FunctionEffects: Correctly navigate through array types in FunctionEffectsRef::get(). (PR #121525)

2025-01-16 Thread Doug Wyatt via cfe-commits
https://github.com/dougsonos updated https://github.com/llvm/llvm-project/pull/121525 >From 805b182e1a9ebe5e344943748dce6c86594495eb Mon Sep 17 00:00:00 2001 From: Doug Wyatt Date: Thu, 2 Jan 2025 14:28:48 -0800 Subject: [PATCH 1/5] [Clang] FunctionEffects: Correctly navigate through array typ

[clang] [Clang] FunctionEffects: Correctly navigate through array types in FunctionEffectsRef::get(). (PR #121525)

2025-01-16 Thread Doug Wyatt via cfe-commits
https://github.com/dougsonos updated https://github.com/llvm/llvm-project/pull/121525 >From 805b182e1a9ebe5e344943748dce6c86594495eb Mon Sep 17 00:00:00 2001 From: Doug Wyatt Date: Thu, 2 Jan 2025 14:28:48 -0800 Subject: [PATCH 1/4] [Clang] FunctionEffects: Correctly navigate through array typ

[clang] [Clang] FunctionEffects: Correctly navigate through array types in FunctionEffectsRef::get(). (PR #121525)

2025-01-16 Thread Doug Wyatt via cfe-commits
https://github.com/dougsonos updated https://github.com/llvm/llvm-project/pull/121525 >From 805b182e1a9ebe5e344943748dce6c86594495eb Mon Sep 17 00:00:00 2001 From: Doug Wyatt Date: Thu, 2 Jan 2025 14:28:48 -0800 Subject: [PATCH 1/3] [Clang] FunctionEffects: Correctly navigate through array typ

[clang] [Clang] FunctionEffects: Correctly navigate through array types in FunctionEffectsRef::get(). (PR #121525)

2025-01-13 Thread Doug Wyatt via cfe-commits
@@ -8836,13 +8836,22 @@ void FixedPointValueToString(SmallVectorImpl &Str, llvm::APSInt Val, unsigned Scale); inline FunctionEffectsRef FunctionEffectsRef::get(QualType QT) { + const Type *TypePtr = QT.getTypePtr(); while (true) { -QualTyp

[clang] [Clang] FunctionEffects: Correctly navigate through array types in FunctionEffectsRef::get(). (PR #121525)

2025-01-13 Thread Doug Wyatt via cfe-commits
@@ -8836,13 +8836,22 @@ void FixedPointValueToString(SmallVectorImpl &Str, llvm::APSInt Val, unsigned Scale); inline FunctionEffectsRef FunctionEffectsRef::get(QualType QT) { + const Type *TypePtr = QT.getTypePtr(); while (true) { -QualTyp

[clang] [Clang] FunctionEffects: Correctly navigate through array types in FunctionEffectsRef::get(). (PR #121525)

2025-01-10 Thread Doug Wyatt via cfe-commits
dougsonos wrote: Ping https://github.com/llvm/llvm-project/pull/121525 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] FunctionEffects: Correctly navigate through array types in FunctionEffectsRef::get(). (PR #121525)

2025-01-02 Thread Doug Wyatt via cfe-commits
https://github.com/dougsonos ready_for_review https://github.com/llvm/llvm-project/pull/121525 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] FunctionEffects: Correctly navigate through array types in FunctionEffectsRef::get(). (PR #121525)

2025-01-02 Thread Doug Wyatt via cfe-commits
https://github.com/dougsonos edited https://github.com/llvm/llvm-project/pull/121525 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] FunctionEffects: Correctly navigate through array types in FunctionEffectsRef::get(). (PR #121525)

2025-01-02 Thread Doug Wyatt via cfe-commits
https://github.com/dougsonos updated https://github.com/llvm/llvm-project/pull/121525 >From 805b182e1a9ebe5e344943748dce6c86594495eb Mon Sep 17 00:00:00 2001 From: Doug Wyatt Date: Thu, 2 Jan 2025 14:28:48 -0800 Subject: [PATCH 1/2] [Clang] FunctionEffects: Correctly navigate through array typ

[clang] [Clang] FunctionEffects: Correctly navigate through array types in FunctionEffectsRef::get(). (PR #121525)

2025-01-02 Thread Doug Wyatt via cfe-commits
https://github.com/dougsonos updated https://github.com/llvm/llvm-project/pull/121525 >From 6abcaf1be17d6f8b4412a20347f19972a7b73d91 Mon Sep 17 00:00:00 2001 From: Doug Wyatt Date: Thu, 2 Jan 2025 14:28:48 -0800 Subject: [PATCH 1/2] [Clang] FunctionEffects: Correctly navigate through array typ

[clang] [Clang] FunctionEffects: Correctly navigate through array types in FunctionEffectsRef::get(). (PR #121525)

2025-01-02 Thread Doug Wyatt via cfe-commits
https://github.com/dougsonos created https://github.com/llvm/llvm-project/pull/121525 `FunctionEffectsRef::get()` is supposed to strip off layers of indirection (pointers/references, type sugar) to get to a `FunctionProtoType` (if any) and return its effects (if any). It wasn't correctly deal

[clang] [Clang] Add Doug Wyatt and myself as maintainers for function effect analysis (PR #117324)

2024-11-22 Thread Doug Wyatt via cfe-commits
dougsonos wrote: LGTM thanks @Sirraide! https://github.com/llvm/llvm-project/pull/117324 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] Add Doug Wyatt and myself as maintainers for function effect analysis (PR #117324)

2024-11-22 Thread Doug Wyatt via cfe-commits
https://github.com/dougsonos approved this pull request. https://github.com/llvm/llvm-project/pull/117324 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] Prevent potential null pointer dereferences (PR #117176)

2024-11-21 Thread Doug Wyatt via cfe-commits
@@ -627,7 +627,7 @@ class Analyzer { IsNoexcept = isNoexcept(FD); } else if (auto *BD = dyn_cast(D)) { if (auto *TSI = BD->getSignatureAsWritten()) { -auto *FPT = TSI->getType()->getAs(); +auto *FPT = TSI->getType()->castAs();

[clang] [Clang] SemaFunctionEffects: Fix bug where lambdas produced by template expansion weren't verified. (PR #116505)

2024-11-18 Thread Doug Wyatt via cfe-commits
https://github.com/dougsonos closed https://github.com/llvm/llvm-project/pull/116505 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] SemaFunctionEffects: Fix bug where lambdas produced by template expansion weren't verified. (PR #116505)

2024-11-16 Thread Doug Wyatt via cfe-commits
https://github.com/dougsonos updated https://github.com/llvm/llvm-project/pull/116505 >From d235d3ea8bb3cabfc8db9d87233455a93fa23c05 Mon Sep 17 00:00:00 2001 From: Doug Wyatt Date: Sat, 16 Nov 2024 11:59:03 -0800 Subject: [PATCH 1/2] [Clang] SemaFunctionEffects: Fix bug where lambdas produced

[clang] [Clang] SemaFunctionEffects: Fix bug where lambdas produced by template expansion weren't verified. (PR #116505)

2024-11-16 Thread Doug Wyatt via cfe-commits
dougsonos wrote: Thanks for the quick look. > Ah yeah, I should have noticed that in review: `ActOnX` is generally only > called during parsing, whereas `BuildX` is also called during template > instantiation. I actually do think it might have come up early in one of the giant reviews, but g

[clang] [Clang] SemaFunctionEffects: Fix bug where lambdas produced by template expansion weren't verified. (PR #116505)

2024-11-16 Thread Doug Wyatt via cfe-commits
https://github.com/dougsonos created https://github.com/llvm/llvm-project/pull/116505 Lambdas are added to the list of Decls to verify using `Sema::maybeAddDeclWithEffects()`. Up until now this call was in `ActOnLambdaExpr`, which happens in the context of a template but not in the context o

[clang] [Clang] SemaFunctionEffects: When verifying a function, ignore any conditional noexcept expression. (PR #115342)

2024-11-10 Thread Doug Wyatt via cfe-commits
https://github.com/dougsonos closed https://github.com/llvm/llvm-project/pull/115342 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] SemaFunctionEffects: When verifying a function, ignore any conditional noexcept expression. (PR #115342)

2024-11-08 Thread Doug Wyatt via cfe-commits
https://github.com/dougsonos updated https://github.com/llvm/llvm-project/pull/115342 >From a0b6093fcf24ade7ce9ee0c3d65f679a41751225 Mon Sep 17 00:00:00 2001 From: Doug Wyatt Date: Tue, 5 Nov 2024 13:35:50 -0800 Subject: [PATCH 1/2] [Clang] SemaFunctionEffects: When verifying a function, ignor

[clang] [Clang] SemaFunctionEffects: When verifying a function, ignore any conditional noexcept expression. (PR #115342)

2024-11-08 Thread Doug Wyatt via cfe-commits
dougsonos wrote: > @dougsonos Oh also, I think I may have mentioned this before, but maybe you > might want to email Chris to obtain [commit > access](https://llvm.org/docs/DeveloperPolicy.html#obtaining-commit-access) > since you’re the main person maintaining all of the function effects code

[clang] [Clang] SemaFunctionEffects: When verifying a function, ignore any conditional noexcept expression. (PR #115342)

2024-11-08 Thread Doug Wyatt via cfe-commits
https://github.com/dougsonos updated https://github.com/llvm/llvm-project/pull/115342 >From a0b6093fcf24ade7ce9ee0c3d65f679a41751225 Mon Sep 17 00:00:00 2001 From: Doug Wyatt Date: Tue, 5 Nov 2024 13:35:50 -0800 Subject: [PATCH 1/2] [Clang] SemaFunctionEffects: When verifying a function, ignor

[clang] [Clang] SemaFunctionEffects: When verifying a function, ignore any conditional noexcept expression. (PR #115342)

2024-11-08 Thread Doug Wyatt via cfe-commits
@@ -986,9 +987,22 @@ class Analyzer { if (auto *Dtor = dyn_cast(CurrentCaller.CDecl)) followDestructor(dyn_cast(Dtor->getParent()), Dtor); - if (auto *FD = dyn_cast(CurrentCaller.CDecl)) + if (auto *FD = dyn_cast(CurrentCaller.CDecl)) { Trailin

[clang] [Clang] SemaFunctionEffects: When verifying a function, ignore any conditional noexcept expression. (PR #115342)

2024-11-08 Thread Doug Wyatt via cfe-commits
@@ -986,9 +987,22 @@ class Analyzer { if (auto *Dtor = dyn_cast(CurrentCaller.CDecl)) followDestructor(dyn_cast(Dtor->getParent()), Dtor); - if (auto *FD = dyn_cast(CurrentCaller.CDecl)) + if (auto *FD = dyn_cast(CurrentCaller.CDecl)) { Trailin

[clang] [Clang] SemaFunctionEffects: When verifying a function, ignore any conditional noexcept expression. (PR #115342)

2024-11-07 Thread Doug Wyatt via cfe-commits
https://github.com/dougsonos created https://github.com/llvm/llvm-project/pull/115342 Would have been part of my last PR (#142666) if I'd found it a few hours sooner. >From a0b6093fcf24ade7ce9ee0c3d65f679a41751225 Mon Sep 17 00:00:00 2001 From: Doug Wyatt Date: Tue, 5 Nov 2024 13:35:50 -0800 S

[clang] [clang] SemaFunctionEffects: When verifying a function, ignore any trailing 'requires' clause. (PR #114266)

2024-11-05 Thread Doug Wyatt via cfe-commits
dougsonos wrote: > > is a builtin function `__is_constructible()` > > Technically a type trait not a function—those are different because they take > _types_ as arguments, and there are separate expressions to represent them > (`UnaryExprOrTypeTraitExpr`, `TypeTraitExpr`, and a few more); mayb

[clang] [clang] SemaFunctionEffects: When verifying a function, ignore any trailing 'requires' clause. (PR #114266)

2024-11-04 Thread Doug Wyatt via cfe-commits
https://github.com/dougsonos updated https://github.com/llvm/llvm-project/pull/114266 >From 6a8a3f21eb23b8b7d63bd8b0fb6e2e85ff1951df Mon Sep 17 00:00:00 2001 From: Doug Wyatt Date: Wed, 30 Oct 2024 09:53:58 -0700 Subject: [PATCH 1/3] [clang] SemaFunctionEffects: When verifying a function, igno

[clang] [clang] SemaFunctionEffects: When verifying a function, ignore any trailing 'requires' clause. (PR #114266)

2024-11-04 Thread Doug Wyatt via cfe-commits
https://github.com/dougsonos edited https://github.com/llvm/llvm-project/pull/114266 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] SemaFunctionEffects: When verifying a function, ignore any trailing 'requires' clause. (PR #114266)

2024-11-04 Thread Doug Wyatt via cfe-commits
@@ -985,6 +986,9 @@ class Analyzer { if (auto *Dtor = dyn_cast(CurrentCaller.CDecl)) followDestructor(dyn_cast(Dtor->getParent()), Dtor); + if (auto *FD = dyn_cast(CurrentCaller.CDecl)) +TrailingRequiresClause = FD->getTrailingRequiresClause(); -

[clang] [clang] SemaFunctionEffects: When verifying a function, ignore any trailing 'requires' clause. (PR #114266)

2024-11-04 Thread Doug Wyatt via cfe-commits
https://github.com/dougsonos deleted https://github.com/llvm/llvm-project/pull/114266 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] SemaFunctionEffects: When verifying a function, ignore any trailing 'requires' clause. (PR #114266)

2024-11-04 Thread Doug Wyatt via cfe-commits
@@ -985,6 +986,9 @@ class Analyzer { if (auto *Dtor = dyn_cast(CurrentCaller.CDecl)) followDestructor(dyn_cast(Dtor->getParent()), Dtor); + if (auto *FD = dyn_cast(CurrentCaller.CDecl)) +TrailingRequiresClause = FD->getTrailingRequiresClause(); -

[clang] [clang] SemaFunctionEffects: When verifying a function, ignore any trailing 'requires' clause. (PR #114266)

2024-11-02 Thread Doug Wyatt via cfe-commits
dougsonos wrote: I was able to (manually) extract a reduction from libc++ and write a test that exposed the issue / verified that it's fixed. It's also here: https://godbolt.org/z/9absooo6G https://github.com/llvm/llvm-project/pull/114266 ___ cfe-com

[clang] [clang] SemaFunctionEffects: When verifying a function, ignore any trailing 'requires' clause. (PR #114266)

2024-11-02 Thread Doug Wyatt via cfe-commits
https://github.com/dougsonos updated https://github.com/llvm/llvm-project/pull/114266 >From 6a8a3f21eb23b8b7d63bd8b0fb6e2e85ff1951df Mon Sep 17 00:00:00 2001 From: Doug Wyatt Date: Wed, 30 Oct 2024 09:53:58 -0700 Subject: [PATCH 1/2] [clang] SemaFunctionEffects: When verifying a function, igno

[clang] [clang] SemaFunctionEffects: When verifying a function, ignore any trailing 'requires' clause. (PR #114266)

2024-11-01 Thread Doug Wyatt via cfe-commits
dougsonos wrote: I spent a bit more time trying to extract a reduction from libc++ today but failed. Here are the diagnostics that (fortunately) were enough to devise the fix in this PR: ```c++ ./nonblocking-wip.cpp:54:30: warning: function with 'nonblocking' attribute must not call non-'

[clang] [clang] SemaFunctionEffects: When verifying a function, ignore any trailing 'requires' clause. (PR #114266)

2024-10-31 Thread Doug Wyatt via cfe-commits
dougsonos wrote: > Also, @dougsonos, can you make a godbolt link for this? I’m trying to > reproduce it, but compiling the code you provided doesn’t result in any > diagnostics for me, but I might be missing a flag. Yeah, I can't repro in godbolt either. This shows that all the effect analysis

[clang] [rtsan][NFC] Add documentation link to Function Effects (PR #113979)

2024-10-30 Thread Doug Wyatt via cfe-commits
dougsonos wrote: LGTM https://github.com/llvm/llvm-project/pull/113979 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] SemaFunctionEffects: When verifying a function, ignore any trailing 'requires' clause. (PR #114266)

2024-10-30 Thread Doug Wyatt via cfe-commits
https://github.com/dougsonos created https://github.com/llvm/llvm-project/pull/114266 Clearly there's an omission here, that a trailing `requires` clause in a called function is being subject to effect analysis. But despite many hours of effort I haven't been able to create a self-contained r

[clang] Add clang/docs/FunctionEffectAnalysis.rst. (PR #109855)

2024-10-28 Thread Doug Wyatt via cfe-commits
dougsonos wrote: @cjappl please merge at will. Thank you! https://github.com/llvm/llvm-project/pull/109855 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Add clang/docs/FunctionEffectAnalysis.rst. (PR #109855)

2024-10-28 Thread Doug Wyatt via cfe-commits
https://github.com/dougsonos updated https://github.com/llvm/llvm-project/pull/109855 >From 085965b324efde41168c5d51db3a368578d3458f Mon Sep 17 00:00:00 2001 From: Doug Wyatt Date: Mon, 23 Sep 2024 14:44:32 -0700 Subject: [PATCH 1/7] Add clang/docs/FunctionEffectAnalysis.rst. --- clang/docs/F

[clang] Add clang/docs/FunctionEffectAnalysis.rst. (PR #109855)

2024-10-28 Thread Doug Wyatt via cfe-commits
dougsonos wrote: @Sirraide, thanks for the excellent feedback. I've incorporated all of your suggestions. https://github.com/llvm/llvm-project/pull/109855 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/l

[clang] Add clang/docs/FunctionEffectAnalysis.rst. (PR #109855)

2024-10-28 Thread Doug Wyatt via cfe-commits
https://github.com/dougsonos updated https://github.com/llvm/llvm-project/pull/109855 >From 085965b324efde41168c5d51db3a368578d3458f Mon Sep 17 00:00:00 2001 From: Doug Wyatt Date: Mon, 23 Sep 2024 14:44:32 -0700 Subject: [PATCH 1/6] Add clang/docs/FunctionEffectAnalysis.rst. --- clang/docs/F

[clang] Add clang/docs/FunctionEffectAnalysis.rst. (PR #109855)

2024-10-26 Thread Doug Wyatt via cfe-commits
dougsonos wrote: Ping https://github.com/llvm/llvm-project/pull/109855 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] Diagnose additional ObjC statements as function effect violations (PR #112148)

2024-10-14 Thread Doug Wyatt via cfe-commits
https://github.com/dougsonos updated https://github.com/llvm/llvm-project/pull/112148 >From f34e4ac55d04bcd8e34bef57afec5a39fbf2acb9 Mon Sep 17 00:00:00 2001 From: Doug Wyatt Date: Sun, 13 Oct 2024 11:35:10 -0700 Subject: [PATCH 1/3] [Clang] Diagnose ObjC @autoreleasepool statements as functio

[clang] [Clang] Diagnose additional ObjC statements as function effect violations (PR #112148)

2024-10-13 Thread Doug Wyatt via cfe-commits
https://github.com/dougsonos created https://github.com/llvm/llvm-project/pull/112148 Bug fix: `@autoreleasepool`, `@synchronized`, and `@finally` were not being noticed and treated as function effect violations. >From f34e4ac55d04bcd8e34bef57afec5a39fbf2acb9 Mon Sep 17 00:00:00 2001 From: Dou

[clang] Rough first stab at addressing #85120 (PR #85147)

2024-10-13 Thread Doug Wyatt via cfe-commits
https://github.com/dougsonos closed https://github.com/llvm/llvm-project/pull/85147 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Add clang/docs/FunctionEffectAnalysis.rst. (PR #109855)

2024-10-11 Thread Doug Wyatt via cfe-commits
https://github.com/dougsonos updated https://github.com/llvm/llvm-project/pull/109855 >From 085965b324efde41168c5d51db3a368578d3458f Mon Sep 17 00:00:00 2001 From: Doug Wyatt Date: Mon, 23 Sep 2024 14:44:32 -0700 Subject: [PATCH 1/5] Add clang/docs/FunctionEffectAnalysis.rst. --- clang/docs/F

[clang] Effect analysis: correctly detect `(x ? a : b)` as nonblocking when a and b are (PR #111224)

2024-10-08 Thread Doug Wyatt via cfe-commits
dougsonos wrote: > Oh, also, are there any other places where we should maybe be using > `FunctionEffectsRef::get()`? Good question. I looked for other uses of `QualType` and `getType()` in SemaFunctionEffects, but this is the only spot (`checkIndirectCall`) where we are interested in obtaini

[clang] Effect analysis: correctly detect `(x ? a : b)` as nonblocking when a and b are (PR #111224)

2024-10-07 Thread Doug Wyatt via cfe-commits
dougsonos wrote: @cjappl @Sirraide would appreciate what I hope will be a quick review on a small fix. https://github.com/llvm/llvm-project/pull/111224 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/list

[clang] Effect analysis: correctly detect `(x ? a : b)` as nonblocking when a and b are (PR #111224)

2024-10-05 Thread Doug Wyatt via cfe-commits
https://github.com/dougsonos updated https://github.com/llvm/llvm-project/pull/111224 >From 02398e6398892dac5d151a6e425bf107213e12a8 Mon Sep 17 00:00:00 2001 From: Doug Wyatt Date: Fri, 4 Oct 2024 18:28:37 -0700 Subject: [PATCH 1/3] Effect analysis: correctly detect `(f ? a : b)` as nonblockin

[clang] Effect analysis: correctly detect `(x ? a : b)` as nonblocking when a and b are (PR #111224)

2024-10-04 Thread Doug Wyatt via cfe-commits
https://github.com/dougsonos deleted https://github.com/llvm/llvm-project/pull/111224 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Effect analysis: correctly detect `(x ? a : b)` as nonblocking when a and b are (PR #111224)

2024-10-04 Thread Doug Wyatt via cfe-commits
https://github.com/dougsonos updated https://github.com/llvm/llvm-project/pull/111224 >From 02398e6398892dac5d151a6e425bf107213e12a8 Mon Sep 17 00:00:00 2001 From: Doug Wyatt Date: Fri, 4 Oct 2024 18:28:37 -0700 Subject: [PATCH 1/2] Effect analysis: correctly detect `(f ? a : b)` as nonblockin

[clang] Effect analysis: correctly detect `(x ? a : b)` as nonblocking when a and b are (PR #111224)

2024-10-04 Thread Doug Wyatt via cfe-commits
https://github.com/dougsonos edited https://github.com/llvm/llvm-project/pull/111224 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Effect analysis: correctly detect `(x ? a : b)` as nonblocking when a and b are (PR #111224)

2024-10-04 Thread Doug Wyatt via cfe-commits
https://github.com/dougsonos edited https://github.com/llvm/llvm-project/pull/111224 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Effect analysis: correctly detect `(f ? a : b)` as nonblocking when a and b are (PR #111224)

2024-10-04 Thread Doug Wyatt via cfe-commits
@@ -1048,15 +1048,14 @@ class Analyzer { } void checkIndirectCall(CallExpr *Call, QualType CalleeType) { - auto *FPT = - CalleeType->getAs(); // Null if FunctionType. FunctionEffectKindSet CalleeEffects; - if (FPT) -CalleeEffects.inser

[clang] Effect analysis: correctly detect `(f ? a : b)` as nonblocking when a and b are (PR #111224)

2024-10-04 Thread Doug Wyatt via cfe-commits
@@ -1048,15 +1048,14 @@ class Analyzer { } void checkIndirectCall(CallExpr *Call, QualType CalleeType) { - auto *FPT = - CalleeType->getAs(); // Null if FunctionType. FunctionEffectKindSet CalleeEffects; - if (FPT) -CalleeEffects.inser

[clang] Effect analysis: correctly detect `(f ? a : b)` as nonblocking when a and b are (PR #111224)

2024-10-04 Thread Doug Wyatt via cfe-commits
@@ -156,6 +156,16 @@ void nb10( static_cast(fp1)(); // expected-warning {{function with 'nonblocking' attribute must not call non-'nonblocking' expression}} } +// Expression involving indirection +int nb10a() [[clang::nonblocking]]; +int nb10b() [[clang::nonblocking]];

[clang] Effect analysis: correctly detect `(f ? a : b)` as nonblocking when a and b are (PR #111224)

2024-10-04 Thread Doug Wyatt via cfe-commits
https://github.com/dougsonos created https://github.com/llvm/llvm-project/pull/111224 Fix: Effect analysis: correctly detect `(f ? a : b)` as nonblocking when a and b are >From 02398e6398892dac5d151a6e425bf107213e12a8 Mon Sep 17 00:00:00 2001 From: Doug Wyatt Date: Fri, 4 Oct 2024 18:28:37 -0

[clang] Add clang/docs/FunctionEffectAnalysis.rst. (PR #109855)

2024-10-04 Thread Doug Wyatt via cfe-commits
dougsonos wrote: Ping https://github.com/llvm/llvm-project/pull/109855 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] nonblocking/nonallocating attributes: 2nd pass caller/callee analysis (PR #99656)

2024-10-02 Thread Doug Wyatt via cfe-commits
dougsonos wrote: Thank you @Sirraide @erichkeane and all, for your patient, careful and thorough reviews! https://github.com/llvm/llvm-project/pull/99656 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/li

[clang] Add clang/docs/FunctionEffectAnalysis.rst. (PR #109855)

2024-09-26 Thread Doug Wyatt via cfe-commits
@@ -0,0 +1,503 @@ + +Function Effect Analysis + + +Introduction + + +Clang Function Effect Analysis is a C++ language extension which can warn about "unsafe" +constructs. The feature is currently tailored for the Perform

[clang] Add clang/docs/FunctionEffectAnalysis.rst. (PR #109855)

2024-09-26 Thread Doug Wyatt via cfe-commits
@@ -0,0 +1,503 @@ + +Function Effect Analysis + + +Introduction + + +Clang Function Effect Analysis is a C++ language extension which can warn about "unsafe" +constructs. The feature is currently tailored for the Perform

[clang] nonblocking/nonallocating attributes: 2nd pass caller/callee analysis (PR #99656)

2024-09-26 Thread Doug Wyatt via cfe-commits
@@ -571,6 +571,9 @@ New features if class of allocation and deallocation function mismatches. `Documentation `__. +- Function effects (the ``nonblocking`` and ``nonallocating`` "performance

[clang] nonblocking/nonallocating attributes: 2nd pass caller/callee analysis (PR #99656)

2024-09-26 Thread Doug Wyatt via cfe-commits
@@ -4712,12 +4715,13 @@ class FunctionEffect { public: /// Identifies the particular effect. enum class Kind : uint8_t { -None = 0, -NonBlocking = 1, -NonAllocating = 2, -Blocking = 3, -Allocating = 4 +NonBlocking = 0, +NonAllocating = 1, +Bl

[clang] Add clang/docs/FunctionEffectAnalysis.rst. (PR #109855)

2024-09-26 Thread Doug Wyatt via cfe-commits
@@ -0,0 +1,503 @@ + +Function Effect Analysis + + +Introduction + + +Clang Function Effect Analysis is a C++ language extension which can warn about "unsafe" +constructs. The feature is currently tailored for the Perform

[clang] Add clang/docs/FunctionEffectAnalysis.rst. (PR #109855)

2024-09-26 Thread Doug Wyatt via cfe-commits
https://github.com/dougsonos updated https://github.com/llvm/llvm-project/pull/109855 >From 085965b324efde41168c5d51db3a368578d3458f Mon Sep 17 00:00:00 2001 From: Doug Wyatt Date: Mon, 23 Sep 2024 14:44:32 -0700 Subject: [PATCH 1/3] Add clang/docs/FunctionEffectAnalysis.rst. --- clang/docs/F

[clang] Add clang/docs/FunctionEffectAnalysis.rst. (PR #109855)

2024-09-26 Thread Doug Wyatt via cfe-commits
@@ -0,0 +1,503 @@ + +Function Effect Analysis + + +Introduction + + +Clang Function Effect Analysis is a C++ language extension which can warn about "unsafe" +constructs. The feature is currently tailored for the Perform

[clang] Add clang/docs/FunctionEffectAnalysis.rst. (PR #109855)

2024-09-26 Thread Doug Wyatt via cfe-commits
@@ -0,0 +1,503 @@ + +Function Effect Analysis + + +Introduction + + +Clang Function Effect Analysis is a C++ language extension which can warn about "unsafe" +constructs. The feature is currently tailored for the Perform

[clang] Add clang/docs/FunctionEffectAnalysis.rst. (PR #109855)

2024-09-26 Thread Doug Wyatt via cfe-commits
@@ -0,0 +1,503 @@ + +Function Effect Analysis + + +Introduction + + +Clang Function Effect Analysis is a C++ language extension which can warn about "unsafe" +constructs. The feature is currently tailored for the Perform

[clang] Add clang/docs/FunctionEffectAnalysis.rst. (PR #109855)

2024-09-26 Thread Doug Wyatt via cfe-commits
@@ -0,0 +1,503 @@ + +Function Effect Analysis + + +Introduction + + +Clang Function Effect Analysis is a C++ language extension which can warn about "unsafe" +constructs. The feature is currently tailored for the Perform

[clang] Add clang/docs/FunctionEffectAnalysis.rst. (PR #109855)

2024-09-26 Thread Doug Wyatt via cfe-commits
@@ -0,0 +1,503 @@ + +Function Effect Analysis + + +Introduction + + +Clang Function Effect Analysis is a C++ language extension which can warn about "unsafe" +constructs. The feature is currently tailored for the Perform

[clang] Add clang/docs/FunctionEffectAnalysis.rst. (PR #109855)

2024-09-26 Thread Doug Wyatt via cfe-commits
@@ -0,0 +1,503 @@ + +Function Effect Analysis + + +Introduction + + +Clang Function Effect Analysis is a C++ language extension which can warn about "unsafe" +constructs. The feature is currently tailored for the Perform

[clang] Add clang/docs/FunctionEffectAnalysis.rst. (PR #109855)

2024-09-26 Thread Doug Wyatt via cfe-commits
@@ -0,0 +1,503 @@ + +Function Effect Analysis + + +Introduction + + +Clang Function Effect Analysis is a C++ language extension which can warn about "unsafe" +constructs. The feature is currently tailored for the Perform

[clang] Add clang/docs/FunctionEffectAnalysis.rst. (PR #109855)

2024-09-26 Thread Doug Wyatt via cfe-commits
https://github.com/dougsonos updated https://github.com/llvm/llvm-project/pull/109855 >From 085965b324efde41168c5d51db3a368578d3458f Mon Sep 17 00:00:00 2001 From: Doug Wyatt Date: Mon, 23 Sep 2024 14:44:32 -0700 Subject: [PATCH 1/2] Add clang/docs/FunctionEffectAnalysis.rst. --- clang/docs/F

[clang] nonblocking/nonallocating attributes: 2nd pass caller/callee analysis (PR #99656)

2024-09-26 Thread Doug Wyatt via cfe-commits
https://github.com/dougsonos edited 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

[clang] nonblocking/nonallocating attributes: 2nd pass caller/callee analysis (PR #99656)

2024-09-26 Thread Doug Wyatt via cfe-commits
https://github.com/dougsonos deleted 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

[clang] nonblocking/nonallocating attributes: 2nd pass caller/callee analysis (PR #99656)

2024-09-26 Thread Doug Wyatt via cfe-commits
@@ -4712,12 +4715,13 @@ class FunctionEffect { public: /// Identifies the particular effect. enum class Kind : uint8_t { -None = 0, -NonBlocking = 1, -NonAllocating = 2, -Blocking = 3, -Allocating = 4 +NonBlocking = 0, +NonAllocating = 1, +Bl

[clang] nonblocking/nonallocating attributes: 2nd pass caller/callee analysis (PR #99656)

2024-09-26 Thread Doug Wyatt via cfe-commits
@@ -8413,6 +8418,15 @@ void ASTReader::InitializeSema(Sema &S) { NewOverrides.applyOverrides(SemaObj->getLangOpts()); } + for (GlobalDeclID ID : DeclsWithEffectsToVerify) { +Decl *D = GetDecl(ID); +if (auto *FD = dyn_cast(D)) + SemaObj->addDeclWithEffec

[clang] nonblocking/nonallocating attributes: 2nd pass caller/callee analysis (PR #99656)

2024-09-26 Thread Doug Wyatt via cfe-commits
https://github.com/dougsonos edited 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

[clang] nonblocking/nonallocating attributes: 2nd pass caller/callee analysis (PR #99656)

2024-09-26 Thread Doug Wyatt via cfe-commits
@@ -4712,12 +4715,13 @@ class FunctionEffect { public: /// Identifies the particular effect. enum class Kind : uint8_t { -None = 0, -NonBlocking = 1, -NonAllocating = 2, -Blocking = 3, -Allocating = 4 +NonBlocking = 0, +NonAllocating = 1, +Bl

[clang] nonblocking/nonallocating attributes: 2nd pass caller/callee analysis (PR #99656)

2024-09-25 Thread Doug Wyatt via cfe-commits
https://github.com/dougsonos edited 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

[clang] nonblocking/nonallocating attributes: 2nd pass caller/callee analysis (PR #99656)

2024-09-25 Thread Doug Wyatt via cfe-commits
@@ -0,0 +1,1572 @@ +//=== SemaFunctionEffects.cpp - Sema handling of function effects -===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: A

[clang] nonblocking/nonallocating attributes: 2nd pass caller/callee analysis (PR #99656)

2024-09-25 Thread Doug Wyatt via cfe-commits
@@ -4719,8 +4719,9 @@ class FunctionEffect { NonBlocking = 1, dougsonos wrote: Good idea. I was afraid of a lot of fallout but it was actually quite an easy change to get rid of the sentinel value. https://github.com/llvm/llvm-project/pull/99656 __

[clang] nonblocking/nonallocating attributes: 2nd pass caller/callee analysis (PR #99656)

2024-09-25 Thread Doug Wyatt via cfe-commits
@@ -0,0 +1,1572 @@ +//=== SemaFunctionEffects.cpp - Sema handling of function effects -===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: A

[clang] Add clang/docs/FunctionEffectAnalysis.rst. (PR #109855)

2024-09-24 Thread Doug Wyatt via cfe-commits
https://github.com/dougsonos created https://github.com/llvm/llvm-project/pull/109855 Follow-on from #99656, which introduces 2nd pass caller/callee analysis for function effects. Wrote a new documentation page, derived directly from the RFC posted to LLVM Discourse earlier this year. >From

[clang] nonblocking/nonallocating attributes: 2nd pass caller/callee analysis (PR #99656)

2024-09-24 Thread Doug Wyatt via cfe-commits
@@ -1128,12 +1128,18 @@ def ThreadSafetyBeta : DiagGroup<"thread-safety-beta">; // Uniqueness Analysis warnings def Consumed : DiagGroup<"consumed">; +// Warnings and notes related to the function effects system underlying +// the nonblocking and nonallocating attributes

[clang] nonblocking/nonallocating attributes: 2nd pass caller/callee analysis (PR #99656)

2024-09-24 Thread Doug Wyatt via cfe-commits
@@ -0,0 +1,1572 @@ +//=== SemaFunctionEffects.cpp - Sema handling of function effects -===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: A

[clang] nonblocking/nonallocating attributes: 2nd pass caller/callee analysis (PR #99656)

2024-09-24 Thread Doug Wyatt via cfe-commits
@@ -1,6 +1,8 @@ // RUN: %clang_cc1 -fsyntax-only -fblocks -fcxx-exceptions -verify %s // RUN: %clang_cc1 -fsyntax-only -fblocks -verify -x c -std=c23 %s +#pragma clang diagnostic warning "-Wfunction-effects" dougsonos wrote: Moved https://github.com/llvm/llv

[clang] nonblocking/nonallocating attributes: 2nd pass caller/callee analysis (PR #99656)

2024-09-24 Thread Doug Wyatt via cfe-commits
@@ -0,0 +1,1572 @@ +//=== SemaFunctionEffects.cpp - Sema handling of function effects -===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: A

[clang] nonblocking/nonallocating attributes: 2nd pass caller/callee analysis (PR #99656)

2024-09-24 Thread Doug Wyatt via cfe-commits
@@ -4940,6 +4955,78 @@ class FunctionEffectsRef { void dump(llvm::raw_ostream &OS) const; }; +/// A mutable set of FunctionEffect::Kind. +class FunctionEffectKindSet { + // For now this only needs to be a bitmap. + constexpr static size_t EndBitPos = 8; + using KindBitsT

[clang] nonblocking/nonallocating attributes: 2nd pass caller/callee analysis (PR #99656)

2024-09-23 Thread Doug Wyatt via cfe-commits
@@ -0,0 +1,1572 @@ +//=== SemaFunctionEffects.cpp - Sema handling of function effects -===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: A

[clang] nonblocking/nonallocating attributes: 2nd pass caller/callee analysis (PR #99656)

2024-09-23 Thread Doug Wyatt via cfe-commits
@@ -0,0 +1,1572 @@ +//=== SemaFunctionEffects.cpp - Sema handling of function effects -===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: A

[clang] nonblocking/nonallocating attributes: 2nd pass caller/callee analysis (PR #99656)

2024-09-23 Thread Doug Wyatt via cfe-commits
@@ -4940,6 +4955,78 @@ class FunctionEffectsRef { void dump(llvm::raw_ostream &OS) const; }; +/// A mutable set of FunctionEffect::Kind. +class FunctionEffectKindSet { + // For now this only needs to be a bitmap. + constexpr static size_t EndBitPos = 8; + using KindBitsT

[clang] nonblocking/nonallocating attributes: 2nd pass caller/callee analysis (PR #99656)

2024-09-23 Thread Doug Wyatt via cfe-commits
dougsonos wrote: @Sirraide , glad you're back and better, and thanks for the comments. I think I agree and will remove the new diagnostics from "-Wall". I also agree that documentation is wanting. I will look into expanding this, whether in the general attributes documentation or a new page (I

[clang] nonblocking/nonallocating attributes: 2nd pass caller/callee analysis (PR #99656)

2024-09-08 Thread Doug Wyatt via cfe-commits
dougsonos wrote: > I do agree, it seems reasonable for it to be in `-Wall` or similar! That is > absolutely what I'd expect as a user :) I guess my thinking was colored a bit by the way many of our codebases use `-Wall`. I did come around to thinking that without `-Wall`, it's cleaner for the

[clang] nonblocking/nonallocating attributes: 2nd pass caller/callee analysis (PR #99656)

2024-09-08 Thread Doug Wyatt via cfe-commits
dougsonos wrote: In working with this version of the compiler, I've discovered a pain point with libc++, `std::__libcpp_verbose_abort()`. Many things which one would expect to be nonblocking, e.g. `std::vector::operator[]`, have hardening paths which call `__libcpp_verbose_abort()` on failure.

[clang] nonblocking/nonallocating attributes: 2nd pass caller/callee analysis (PR #99656)

2024-09-06 Thread Doug Wyatt via cfe-commits
dougsonos wrote: > Hi @dougsonos > > We’re experiencing an unforeseen pain point trying to use rtsan without > function effects, and wanted to ask **how you would feel about making > function effect warnings opt-in rather than opt-out.** > > While users can easily opt in to function effects a

[clang] nonblocking/nonallocating attributes: 2nd pass caller/callee analysis (PR #99656)

2024-09-04 Thread Doug Wyatt via cfe-commits
@@ -0,0 +1,1566 @@ +//=== SemaFunctionEffects.cpp - Sema handling of function effects -===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: A

[clang] nonblocking/nonallocating attributes: 2nd pass caller/callee analysis (PR #99656)

2024-09-04 Thread Doug Wyatt via cfe-commits
@@ -8392,6 +8397,20 @@ void ASTReader::InitializeSema(Sema &S) { NewOverrides.applyOverrides(SemaObj->getLangOpts()); } + if (!DeclsWithEffectsToVerify.empty()) { +for (GlobalDeclID ID : DeclsWithEffectsToVerify) { + Decl *D = GetDecl(ID); + FunctionEf

[clang] nonblocking/nonallocating attributes: 2nd pass caller/callee analysis (PR #99656)

2024-09-04 Thread Doug Wyatt via cfe-commits
@@ -0,0 +1,1566 @@ +//=== SemaFunctionEffects.cpp - Sema handling of function effects -===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: A

  1   2   3   4   5   >