[clang] nolock/noalloc attributes (PR #84983)

2024-03-12 Thread via cfe-commits
@@ -1402,6 +1402,29 @@ def CXX11NoReturn : InheritableAttr { let Documentation = [CXX11NoReturnDocs]; } +def NoLock : DeclOrTypeAttr { + let Spellings = [CXX11<"clang", "nolock">, + C23<"clang", "nolock">, + GNU<"clang_nolock">]; + + //

[clang] nolock/noalloc attributes (PR #84983)

2024-03-12 Thread via cfe-commits
@@ -11100,6 +11136,48 @@ Attr *Sema::getImplicitCodeSegOrSectionAttrForFunction(const FunctionDecl *FD, return nullptr; } +// Should only be called when getFunctionEffects() returns a non-empty set. +// Decl should be a FunctionDecl or BlockDecl. +void Sema::CheckAddCallabl

[clang] nolock/noalloc attributes (PR #84983)

2024-03-12 Thread via cfe-commits
@@ -7754,6 +7906,145 @@ QualType DecayedType::getPointeeType() const { void FixedPointValueToString(SmallVectorImpl &Str, llvm::APSInt Val, unsigned Scale); +// -- + +// T

[clang] nolock/noalloc attributes (PR #84983)

2024-03-12 Thread via cfe-commits
@@ -7754,6 +7905,145 @@ QualType DecayedType::getPointeeType() const { void FixedPointValueToString(SmallVectorImpl &Str, llvm::APSInt Val, unsigned Scale); +// -- + +// T

[clang] nolock/noalloc attributes (PR #84983)

2024-03-12 Thread via cfe-commits
@@ -2380,6 +2382,1239 @@ class UnsafeBufferUsageReporter : public UnsafeBufferUsageHandler { }; } // namespace +// = + +// Temporary debugging option +#define FX_ANALYZER_VERIFY_DECL_LIST 1 + +namesp

[clang] nolock/noalloc attributes (PR #84983)

2024-03-12 Thread via cfe-commits
@@ -10778,6 +10778,101 @@ def warn_imp_cast_drops_unaligned : Warning< "implicit cast from type %0 to type %1 drops __unaligned qualifier">, InGroup>; +def warn_func_effect_allocates : Warning< + "'%0' function '%1' must not allocate or deallocate memory">, + InGroup; +

[clang] nolock/noalloc attributes (PR #84983)

2024-03-12 Thread via cfe-commits
@@ -3922,6 +3922,42 @@ bool Sema::MergeFunctionDecl(FunctionDecl *New, NamedDecl *&OldD, Scope *S, return true; } + const auto OldFX = Old->getFunctionEffects(); + const auto NewFX = New->getFunctionEffects(); + if (OldFX != NewFX) { +const auto Diffs = FunctionE

[clang] nolock/noalloc attributes (PR #84983)

2024-03-12 Thread via cfe-commits
@@ -4912,3 +4922,279 @@ void AutoType::Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Context) { Profile(ID, Context, getDeducedType(), getKeyword(), isDependentType(), getTypeConstraintConcept(), getTypeConstraintArguments()); } + +FunctionEffect::~Function

[clang] nolock/noalloc attributes (PR #84983)

2024-03-12 Thread via cfe-commits
@@ -2380,6 +2382,1239 @@ class UnsafeBufferUsageReporter : public UnsafeBufferUsageHandler { }; } // namespace +// = + +// Temporary debugging option +#define FX_ANALYZER_VERIFY_DECL_LIST 1 + +namesp

[clang] nolock/noalloc attributes (PR #84983)

2024-03-12 Thread via cfe-commits
@@ -10778,6 +10778,101 @@ def warn_imp_cast_drops_unaligned : Warning< "implicit cast from type %0 to type %1 drops __unaligned qualifier">, InGroup>; +def warn_func_effect_allocates : Warning< + "'%0' function '%1' must not allocate or deallocate memory">, + InGroup; +

[clang] nolock/noalloc attributes (PR #84983)

2024-03-12 Thread via cfe-commits
@@ -7973,3 +7973,20 @@ requirement: } }]; } + +def NoLockNoAllocDocs : Documentation { + let Category = DocCatType; + let Content = [{ +The ``nolock`` and ``noalloc`` attributes can be attached to functions, blocks, +function pointers, lambdas, and member functions. The

[clang] nolock/noalloc attributes (PR #84983)

2024-03-12 Thread via cfe-commits
https://github.com/Sirraide edited https://github.com/llvm/llvm-project/pull/84983 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] nolock/noalloc attributes (PR #84983)

2024-03-12 Thread via cfe-commits
@@ -1402,6 +1402,29 @@ def CXX11NoReturn : InheritableAttr { let Documentation = [CXX11NoReturnDocs]; } +def NoLock : DeclOrTypeAttr { + let Spellings = [CXX11<"clang", "nolock">, + C23<"clang", "nolock">, + GNU<"clang_nolock">]; + + //

[clang] nolock/noalloc attributes (PR #84983)

2024-03-12 Thread via cfe-commits
https://github.com/Sirraide requested changes to this pull request. I was following this on Discourse, so I thought I’d take a look; overall, this seems like a very interesting addition to Clang to me. This is by no means a complete review; this pr is pretty big, so looking at everything in de

[clang] nolock/noalloc attributes (PR #84983)

2024-03-12 Thread Vlad Serebrennikov via cfe-commits
Endilll wrote: > This is an early PR to solicit comments on the overall approach and a number > of outstanding questions. You should advertise this elsewhere (e.g. in RFC thread), or remove the draft status so that reviewers can see this as something they should provide feedback on. https://

[clang] nolock/noalloc attributes (PR #84983)

2024-03-12 Thread Vlad Serebrennikov via cfe-commits
https://github.com/Endilll commented: `Sema.h` changes look good to me. Thank you for putting new functions in all the right places! https://github.com/llvm/llvm-project/pull/84983 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.

[clang] nolock/noalloc attributes (PR #84983)

2024-03-12 Thread Doug Wyatt via cfe-commits
https://github.com/dougsonos converted_to_draft https://github.com/llvm/llvm-project/pull/84983 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] nolock/noalloc attributes (PR #84983)

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

[clang] nolock/noalloc attributes (PR #84983)

2024-03-12 Thread via cfe-commits
github-actions[bot] wrote: :warning: C/C++ code formatter, clang-format found issues in your code. :warning: You can test this locally with the following command: ``bash git-clang-format --diff ad23127222fe23e28ac3deaa16f3ae64d13b7b6f 2a1b0d2d99c9bc4595dfc98f250bf43d23a28093 --

[clang] nolock/noalloc attributes (PR #84983)

2024-03-12 Thread via cfe-commits
llvmbot wrote: @llvm/pr-subscribers-clang-modules Author: Doug Wyatt (dougsonos) Changes Rough first draft. This is an early PR to solicit comments on the overall approach and a number of outstanding questions. Some of the larger ones, "earlier" in the flow (from parse -> Sema): - Does

[clang] nolock/noalloc attributes (PR #84983)

2024-03-12 Thread via cfe-commits
llvmbot wrote: @llvm/pr-subscribers-clang Author: Doug Wyatt (dougsonos) Changes Rough first draft. This is an early PR to solicit comments on the overall approach and a number of outstanding questions. Some of the larger ones, "earlier" in the flow (from parse -> Sema): - Does the Func

[clang] nolock/noalloc attributes (PR #84983)

2024-03-12 Thread via cfe-commits
github-actions[bot] wrote: Thank you for submitting a Pull Request (PR) to the LLVM Project! This PR will be automatically labeled and the relevant teams will be notified. If you wish to, you can add reviewers by using the "Reviewers" section on this page. If this is not working for you, it

<    1   2