[clang] [clang] WIP: Warn on mismatched RequiresCapability attributes (PR #67520)

2024-10-08 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr updated https://github.com/llvm/llvm-project/pull/67520 >From 55efd18bb177150a1fd170cb1535e225854967a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Thu, 20 Jun 2024 07:39:20 +0200 Subject: [PATCH] Warn on RequiresCapability attribute mismatch -

[clang] [clang] WIP: Warn on mismatched RequiresCapability attributes (PR #67520)

2024-10-08 Thread Timm Baeder via cfe-commits
Timm =?utf-8?q?Bäder?= , Timm =?utf-8?q?Bäder?= , Timm =?utf-8?q?Bäder?= , Timm =?utf-8?q?Bäder?= , Timm =?utf-8?q?Bäder?= , Timm =?utf-8?q?Bäder?= , Timm =?utf-8?q?Bäder?= Message-ID: In-Reply-To: @@ -2249,7 +2249,7 @@ void fooF1(Foo *f) EXCLUSIVE_LOCKS_REQUIRED(f->mu_) { f

[clang] [clang] WIP: Warn on mismatched RequiresCapability attributes (PR #67520)

2024-10-08 Thread Timm Baeder via cfe-commits
Timm =?utf-8?q?Bäder?= , Timm =?utf-8?q?Bäder?= , Timm =?utf-8?q?Bäder?= , Timm =?utf-8?q?Bäder?= , Timm =?utf-8?q?Bäder?= , Timm =?utf-8?q?Bäder?= , Timm =?utf-8?q?Bäder?= Message-ID: In-Reply-To: @@ -2282,6 +2308,9 @@ void ThreadSafetyAnalyzer::runAnalysis(AnalysisDeclContex

[clang] [clang] WIP: Warn on mismatched RequiresCapability attributes (PR #67520)

2024-10-08 Thread Aaron Puchert via cfe-commits
Timm =?utf-8?q?Bäder?= , Timm =?utf-8?q?Bäder?= , Timm =?utf-8?q?Bäder?= , Timm =?utf-8?q?Bäder?= , Timm =?utf-8?q?Bäder?= , Timm =?utf-8?q?Bäder?= , Timm =?utf-8?q?Bäder?= Message-ID: In-Reply-To: @@ -2249,7 +2249,7 @@ void fooF1(Foo *f) EXCLUSIVE_LOCKS_REQUIRED(f->mu_) { f

[clang] [clang] WIP: Warn on mismatched RequiresCapability attributes (PR #67520)

2024-10-08 Thread Aaron Puchert via cfe-commits
Timm =?utf-8?q?Bäder?= , Timm =?utf-8?q?Bäder?= , Timm =?utf-8?q?Bäder?= , Timm =?utf-8?q?Bäder?= , Timm =?utf-8?q?Bäder?= , Timm =?utf-8?q?Bäder?= , Timm =?utf-8?q?Bäder?= Message-ID: In-Reply-To: @@ -2282,6 +2308,9 @@ void ThreadSafetyAnalyzer::runAnalysis(AnalysisDeclContex

[clang] [clang] WIP: Warn on mismatched RequiresCapability attributes (PR #67520)

2024-10-08 Thread Aaron Puchert via cfe-commits
Timm =?utf-8?q?Bäder?= , Timm =?utf-8?q?Bäder?= , Timm =?utf-8?q?Bäder?= , Timm =?utf-8?q?Bäder?= , Timm =?utf-8?q?Bäder?= , Timm =?utf-8?q?Bäder?= , Timm =?utf-8?q?Bäder?= Message-ID: In-Reply-To: aaronpuchert wrote: We don't deduplicate "requires" attributes but check them directly. The resu

[clang] [clang] WIP: Warn on mismatched RequiresCapability attributes (PR #67520)

2024-10-08 Thread Timm Baeder via cfe-commits
Timm =?utf-8?q?Bäder?= , Timm =?utf-8?q?Bäder?= , Timm =?utf-8?q?Bäder?= , Timm =?utf-8?q?Bäder?= , Timm =?utf-8?q?Bäder?= , Timm =?utf-8?q?Bäder?= , Timm =?utf-8?q?Bäder?= Message-ID: In-Reply-To: tbaederr wrote: Meh, adding the attribute to the definition and declaration of a member functio

[clang] [clang] WIP: Warn on mismatched RequiresCapability attributes (PR #67520)

2024-10-08 Thread Timm Baeder via cfe-commits
Timm =?utf-8?q?Bäder?= , Timm =?utf-8?q?Bäder?= , Timm =?utf-8?q?Bäder?= , Timm =?utf-8?q?Bäder?= , Timm =?utf-8?q?Bäder?= , Timm =?utf-8?q?Bäder?= , Timm =?utf-8?q?Bäder?= Message-ID: In-Reply-To: https://github.com/tbaederr updated https://github.com/llvm/llvm-project/pull/67520 >From 055f7

[clang] [clang] WIP: Warn on mismatched RequiresCapability attributes (PR #67520)

2024-10-08 Thread Timm Baeder via cfe-commits
Timm =?utf-8?q?Bäder?= , Timm =?utf-8?q?Bäder?= , Timm =?utf-8?q?Bäder?= , Timm =?utf-8?q?Bäder?= , Timm =?utf-8?q?Bäder?= , Timm =?utf-8?q?Bäder?= , Timm =?utf-8?q?Bäder?= Message-ID: In-Reply-To: https://github.com/tbaederr updated https://github.com/llvm/llvm-project/pull/67520 >From 055f7

[clang] [clang] WIP: Warn on mismatched RequiresCapability attributes (PR #67520)

2024-10-08 Thread Timm Baeder via cfe-commits
Timm =?utf-8?q?Bäder?= , Timm =?utf-8?q?Bäder?= , Timm =?utf-8?q?Bäder?= , Timm =?utf-8?q?Bäder?= , Timm =?utf-8?q?Bäder?= , Timm =?utf-8?q?Bäder?= , Timm =?utf-8?q?Bäder?= Message-ID: In-Reply-To: https://github.com/tbaederr updated https://github.com/llvm/llvm-project/pull/67520 >From 055f7

[clang] [clang] WIP: Warn on mismatched RequiresCapability attributes (PR #67520)

2024-10-07 Thread Aaron Puchert via cfe-commits
Timm =?utf-8?q?B=C3=A4der?= , Timm =?utf-8?q?B=C3=A4der?= , Timm =?utf-8?q?B=C3=A4der?= , Timm =?utf-8?q?B=C3=A4der?= , Timm =?utf-8?q?B=C3=A4der?= , Timm =?utf-8?q?B=C3=A4der?= Message-ID: In-Reply-To: aaronpuchert wrote: > Is there any sort of facility to deduplicate capabilities? The exist

[clang] [clang] WIP: Warn on mismatched RequiresCapability attributes (PR #67520)

2024-10-04 Thread Timm Baeder via cfe-commits
Timm =?utf-8?q?Bäder?= , Timm =?utf-8?q?Bäder?= , Timm =?utf-8?q?Bäder?= , Timm =?utf-8?q?Bäder?= , Timm =?utf-8?q?Bäder?= , Timm =?utf-8?q?Bäder?= Message-ID: In-Reply-To: https://github.com/tbaederr updated https://github.com/llvm/llvm-project/pull/67520 >From 1c117257921fc1c246fbb9f51e3c95

[clang] [clang] WIP: Warn on mismatched RequiresCapability attributes (PR #67520)

2024-10-04 Thread Timm Baeder via cfe-commits
Timm =?utf-8?q?Bäder?= , Timm =?utf-8?q?Bäder?= , Timm =?utf-8?q?Bäder?= , Timm =?utf-8?q?Bäder?= , Timm =?utf-8?q?Bäder?= Message-ID: In-Reply-To: tbaederr wrote: Hmm, so this is causing problems: ```c++ namespace DoubleLockBug { class Foo { public: Mutex mu_; int a GUARDED_BY(m

[clang] [clang] WIP: Warn on mismatched RequiresCapability attributes (PR #67520)

2024-10-02 Thread Aaron Puchert via cfe-commits
Timm =?utf-8?q?Bäder?= , Timm =?utf-8?q?Bäder?= , Timm =?utf-8?q?Bäder?= , Timm =?utf-8?q?Bäder?= , Timm =?utf-8?q?Bäder?= Message-ID: In-Reply-To: @@ -2263,6 +2265,28 @@ static bool neverReturns(const CFGBlock *B) { return false; } +void ThreadSafetyAnalyzer::checkMismat

[clang] [clang] WIP: Warn on mismatched RequiresCapability attributes (PR #67520)

2024-10-02 Thread Aaron Puchert via cfe-commits
Timm =?utf-8?q?Bäder?= , Timm =?utf-8?q?Bäder?= , Timm =?utf-8?q?Bäder?= , Timm =?utf-8?q?Bäder?= , Timm =?utf-8?q?Bäder?= Message-ID: In-Reply-To: @@ -2263,6 +2265,28 @@ static bool neverReturns(const CFGBlock *B) { return false; } +void ThreadSafetyAnalyzer::checkMismat

[clang] [clang] WIP: Warn on mismatched RequiresCapability attributes (PR #67520)

2024-10-02 Thread Aaron Puchert via cfe-commits
Timm =?utf-8?q?Bäder?= , Timm =?utf-8?q?Bäder?= , Timm =?utf-8?q?Bäder?= , Timm =?utf-8?q?Bäder?= , Timm =?utf-8?q?Bäder?= Message-ID: In-Reply-To: @@ -26,6 +26,7 @@ namespace clang { class AnalysisDeclContext; class FunctionDecl; class NamedDecl; +class Attr; --

[clang] [clang] WIP: Warn on mismatched RequiresCapability attributes (PR #67520)

2024-10-02 Thread Aaron Puchert via cfe-commits
Timm =?utf-8?q?Bäder?= , Timm =?utf-8?q?Bäder?= , Timm =?utf-8?q?Bäder?= , Timm =?utf-8?q?Bäder?= , Timm =?utf-8?q?Bäder?= Message-ID: In-Reply-To: @@ -2282,6 +2306,9 @@ void ThreadSafetyAnalyzer::runAnalysis(AnalysisDeclContext &AC) { const NamedDecl *D = walker.getDecl();

[clang] [clang] WIP: Warn on mismatched RequiresCapability attributes (PR #67520)

2024-10-02 Thread Kevin Wolf via cfe-commits
Timm =?utf-8?q?Bäder?= , Timm =?utf-8?q?Bäder?= , Timm =?utf-8?q?Bäder?= , Timm =?utf-8?q?Bäder?= , Timm =?utf-8?q?Bäder?= Message-ID: In-Reply-To: kevmw wrote: > This example from the failing test should warn I think > [...] > Since the definition of foo2 specifies attributes that aren't pres

[clang] [clang] WIP: Warn on mismatched RequiresCapability attributes (PR #67520)

2024-10-01 Thread Timm Baeder via cfe-commits
Timm =?utf-8?q?Bäder?= , Timm =?utf-8?q?Bäder?= , Timm =?utf-8?q?Bäder?= , Timm =?utf-8?q?Bäder?= , Timm =?utf-8?q?Bäder?= Message-ID: In-Reply-To: tbaederr wrote: This example from the failing test should warn I think: ```c++ class Foo { public: void foo1(); void foo2(); void foo3(Foo

[clang] [clang] WIP: Warn on mismatched RequiresCapability attributes (PR #67520)

2024-10-01 Thread Timm Baeder via cfe-commits
Timm =?utf-8?q?Bäder?= , Timm =?utf-8?q?Bäder?= , Timm =?utf-8?q?Bäder?= , Timm =?utf-8?q?Bäder?= , Timm =?utf-8?q?Bäder?= Message-ID: In-Reply-To: tbaederr wrote: Moved it back into `ThreadAnalysis.cpp`. I'm still only comparing the number of args, but I'd like better diagnostics for this. I

[clang] [clang] WIP: Warn on mismatched RequiresCapability attributes (PR #67520)

2024-10-01 Thread Timm Baeder via cfe-commits
Timm =?utf-8?q?Bäder?= , Timm =?utf-8?q?Bäder?= , Timm =?utf-8?q?Bäder?= , Timm =?utf-8?q?Bäder?= , Timm =?utf-8?q?Bäder?= Message-ID: In-Reply-To: https://github.com/tbaederr updated https://github.com/llvm/llvm-project/pull/67520 >From 1c117257921fc1c246fbb9f51e3c95d6dc6d295e Mon Sep 17 00:

[clang] [clang] WIP: Warn on mismatched RequiresCapability attributes (PR #67520)

2024-10-01 Thread Aaron Puchert via cfe-commits
Timm =?utf-8?q?Bäder?= , Timm =?utf-8?q?Bäder?= Message-ID: In-Reply-To: @@ -5794,6 +5794,30 @@ static void handleRequiresCapabilityAttr(Sema &S, Decl *D, RequiresCapabilityAttr(S.Context, AL, Args.data(), Args.size()); D->addAttr(RCA); + + if (const auto *FD = dy

[clang] [clang] WIP: Warn on mismatched RequiresCapability attributes (PR #67520)

2024-09-30 Thread Timm Baeder via cfe-commits
Timm =?utf-8?q?Bäder?= , Timm =?utf-8?q?Bäder?= Message-ID: In-Reply-To: @@ -5794,6 +5794,30 @@ static void handleRequiresCapabilityAttr(Sema &S, Decl *D, RequiresCapabilityAttr(S.Context, AL, Args.data(), Args.size()); D->addAttr(RCA); + + if (const auto *FD = dy

[clang] [clang] WIP: Warn on mismatched RequiresCapability attributes (PR #67520)

2024-09-30 Thread Timm Baeder via cfe-commits
Timm =?utf-8?q?Bäder?= , Timm =?utf-8?q?Bäder?= Message-ID: In-Reply-To: @@ -5794,6 +5794,30 @@ static void handleRequiresCapabilityAttr(Sema &S, Decl *D, RequiresCapabilityAttr(S.Context, AL, Args.data(), Args.size()); D->addAttr(RCA); + + if (const auto *FD = dy

[clang] [clang] WIP: Warn on mismatched RequiresCapability attributes (PR #67520)

2024-09-30 Thread Timm Baeder via cfe-commits
Timm =?utf-8?q?Bäder?= , Timm =?utf-8?q?Bäder?= Message-ID: In-Reply-To: tbaederr wrote: > So the semantics here are: if there is any `requires_capability` attribute on > a function, it needs to exactly match the set of `requires_capability` > attributes on every previous declaration? Or in

[clang] [clang] WIP: Warn on mismatched RequiresCapability attributes (PR #67520)

2024-09-30 Thread Aaron Puchert via cfe-commits
Timm =?utf-8?q?Bäder?= , Timm =?utf-8?q?Bäder?= Message-ID: In-Reply-To: @@ -5794,6 +5794,30 @@ static void handleRequiresCapabilityAttr(Sema &S, Decl *D, RequiresCapabilityAttr(S.Context, AL, Args.data(), Args.size()); D->addAttr(RCA); + + if (const auto *FD = dy

[clang] [clang] WIP: Warn on mismatched RequiresCapability attributes (PR #67520)

2024-09-30 Thread Aaron Puchert via cfe-commits
Timm =?utf-8?q?Bäder?= , Timm =?utf-8?q?Bäder?= Message-ID: In-Reply-To: https://github.com/aaronpuchert commented: So the semantics here are: if there is any `requires_capability` attribute on a function, it needs to exactly match the set of `requires_capability` attributes on every previou

[clang] [clang] WIP: Warn on mismatched RequiresCapability attributes (PR #67520)

2024-09-30 Thread Aaron Puchert via cfe-commits
Timm =?utf-8?q?Bäder?= , Timm =?utf-8?q?Bäder?= Message-ID: In-Reply-To: @@ -5794,6 +5794,30 @@ static void handleRequiresCapabilityAttr(Sema &S, Decl *D, RequiresCapabilityAttr(S.Context, AL, Args.data(), Args.size()); D->addAttr(RCA); + + if (const auto *FD = dy

[clang] [clang] WIP: Warn on mismatched RequiresCapability attributes (PR #67520)

2024-09-30 Thread Aaron Puchert via cfe-commits
Timm =?utf-8?q?Bäder?= , Timm =?utf-8?q?Bäder?= Message-ID: In-Reply-To: https://github.com/aaronpuchert edited https://github.com/llvm/llvm-project/pull/67520 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mai

[clang] [clang] WIP: Warn on mismatched RequiresCapability attributes (PR #67520)

2024-09-30 Thread via cfe-commits
Timm =?utf-8?q?Bäder?= , Timm =?utf-8?q?Bäder?= Message-ID: In-Reply-To: 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 9f3728d157

[clang] [clang] WIP: Warn on mismatched RequiresCapability attributes (PR #67520)

2024-09-30 Thread Timm Baeder via cfe-commits
Timm =?utf-8?q?Bäder?= , Timm =?utf-8?q?Bäder?= Message-ID: In-Reply-To: tbaederr wrote: Updated the branch. This now warns: ```c++ #define LOCKABLE__attribute__ ((lockable)) #define EXCLUSIVE_LOCKS_REQUIRED(...) __attribute__ ((exclusive_locks_required(__VA_ARGS__))) struct L

[clang] [clang] WIP: Warn on mismatched RequiresCapability attributes (PR #67520)

2024-09-30 Thread Timm Baeder via cfe-commits
Timm =?utf-8?q?Bäder?= , Timm =?utf-8?q?Bäder?= Message-ID: In-Reply-To: https://github.com/tbaederr updated https://github.com/llvm/llvm-project/pull/67520 >From 5f411735a5366499481c09a317aa170af44796f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Thu, 20 Jun 2024 07:3

[clang] [clang] WIP: Warn on mismatched RequiresCapability attributes (PR #67520)

2024-09-05 Thread Aaron Puchert via cfe-commits
aaronpuchert wrote: > > That might not be enough. A function might not be used (or even referenced) > > in the TU that defines it, but only in other TUs. But it would certainly > > catch a number of issues already. > > Right, though catching that ends up being pretty impossible. The most you

[clang] [clang] WIP: Warn on mismatched RequiresCapability attributes (PR #67520)

2024-09-05 Thread Erich Keane via cfe-commits
erichkeane wrote: > That might not be enough. A function might not be used (or even referenced) > in the TU that defines it, but only in other TUs. But it would certainly > catch a number of issues already. Right, though catching that ends up being pretty impossible. The most you could do is

[clang] [clang] WIP: Warn on mismatched RequiresCapability attributes (PR #67520)

2024-09-05 Thread Aaron Puchert via cfe-commits
aaronpuchert wrote: That might not be enough. A function might not be used (or even referenced) in the TU that defines it, but only in other TUs. But it would certainly catch a number of issues already. https://github.com/llvm/llvm-project/pull/67520 ___

[clang] [clang] WIP: Warn on mismatched RequiresCapability attributes (PR #67520)

2024-09-04 Thread Erich Keane via cfe-commits
erichkeane wrote: Rather than this being "not added in the header file", should we just make this one of the attributes that is disallowed after the thing has been 'referenced'? Or is that a dumb suggestion here? https://github.com/llvm/llvm-project/pull/67520

[clang] [clang] WIP: Warn on mismatched RequiresCapability attributes (PR #67520)

2024-08-30 Thread Aaron Puchert via cfe-commits
@@ -3978,7 +3978,9 @@ def warn_acquired_before : Warning< def warn_acquired_before_after_cycle : Warning< "cycle in acquired_before/after dependencies, starting with '%0'">, InGroup, DefaultIgnore; - +def warn_attribute_mismatch : Warning< + "attribute mismatch between fun

[clang] [clang] WIP: Warn on mismatched RequiresCapability attributes (PR #67520)

2024-08-30 Thread Aaron Puchert via cfe-commits
@@ -2260,6 +2260,37 @@ static bool neverReturns(const CFGBlock *B) { return false; } +template +static SmallVector collectAttrArgs(const FunctionDecl *FD) { + SmallVector Args; + for (const AttrT *A : FD->specific_attrs()) { +for (const Expr *E : A->args()) + Arg

[clang] [clang] WIP: Warn on mismatched RequiresCapability attributes (PR #67520)

2024-08-30 Thread Aaron Puchert via cfe-commits
https://github.com/aaronpuchert edited https://github.com/llvm/llvm-project/pull/67520 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] WIP: Warn on mismatched RequiresCapability attributes (PR #67520)

2024-08-30 Thread Aaron Puchert via cfe-commits
https://github.com/aaronpuchert commented: This probably fits better in `Sema/SemaDeclAttr.cpp`. Maybe `checkLockFunAttrCommon` is a good place. Add a test to `clang/test/Sema/attr-capabilities.c{,pp}`. https://github.com/llvm/llvm-project/pull/67520 __

[clang] [clang] WIP: Warn on mismatched RequiresCapability attributes (PR #67520)

2024-08-30 Thread Aaron Puchert via cfe-commits
aaronpuchert wrote: > Maybe I misunderstood the code of this PR, but I thought it only checks > definitions. That's my understanding as well. I was just thinking about the usual requirement of putting the attribute on the first declaration (like the standard mandates it for `[[noreturn]]`). U

[clang] [clang] WIP: Warn on mismatched RequiresCapability attributes (PR #67520)

2024-08-30 Thread Kevin Wolf via cfe-commits
kevmw wrote: > But as a rule of thumb, static analysis attributes always belong on the > publicly visible declaration. Otherwise, the caller can't see them. Yes, the theory is obvious and easy to understand, at least once you think of it. Applying it in practice is where I made the experience

[clang] [clang] WIP: Warn on mismatched RequiresCapability attributes (PR #67520)

2024-08-22 Thread Aaron Puchert via cfe-commits
aaronpuchert wrote: > > Yeah, it's a tricky question. On one hand there have been previous issues > > like #42194 (which this would basically address), and it would definitely > > improve consistency and prevent beginner's mistakes. On the other hand it > > seems useful to allow adding attribu

[clang] [clang] WIP: Warn on mismatched RequiresCapability attributes (PR #67520)

2024-07-26 Thread Kevin Wolf via cfe-commits
kevmw wrote: I'm the person who asked @tbaederr last year if this could be added for the benefit of QEMU, and as I'm looking at it again now, I thought maybe I should leave a comment here. In QEMU, we currently handle the problem with a coding convention (public functions get TSA attributes _

[clang] [clang] WIP: Warn on mismatched RequiresCapability attributes (PR #67520)

2024-06-30 Thread Aaron Puchert via cfe-commits
aaronpuchert wrote: Doesn't this fit better in `Sema/SemaDeclAttr.cpp`? That's where we're checking the attributes themselves and whether they make sense on a declaration. This would seem like a good place to check against previous declarations. Though to be fair, I don't know how late the lat

[clang] [clang] WIP: Warn on mismatched RequiresCapability attributes (PR #67520)

2024-06-20 Thread Timm Baeder via cfe-commits
tbaederr wrote: > I tried out this WIP on our codebase after we ran into a problem where an > annotation was added to a definition rather than a declaration, leading to a > (silently) missed capability check. > > This addition seems to work fine, but it triggers warnings when annotations > ar

[clang] [clang] WIP: Warn on mismatched RequiresCapability attributes (PR #67520)

2024-06-20 Thread Cory Fields via cfe-commits
theuni wrote: I tried out this WIP on our codebase after we ran into a problem where an annotation was added to a definition rather than a declaration, leading to a (silently) missed capability check. This addition seems to work fine, but it triggers warnings when annotations are added to bot

[clang] [clang] WIP: Warn on mismatched RequiresCapability attributes (PR #67520)

2024-06-19 Thread Timm Baeder via cfe-commits
tbaederr wrote: I've resorted to do this in `ThreadSafety.cpp` now, since all other places where we merge function definition and declaration happen before we have the late-parsed attributes available. >From a diagnostic POV, this seems quite complicated since we have N >declarations and need

[clang] [clang] WIP: Warn on mismatched RequiresCapability attributes (PR #67520)

2024-06-19 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr updated https://github.com/llvm/llvm-project/pull/67520 >From 800ce47e967593ec149e0187abf6d2cb3ee1b1b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Thu, 20 Jun 2024 07:39:20 +0200 Subject: [PATCH] Warn on RequiresCapability attribute mismatch -

[clang] [clang] WIP: Warn on mismatched RequiresCapability attributes (PR #67520)

2024-06-07 Thread Aaron Ballman via cfe-commits
AaronBallman wrote: > @AaronBallman Is the prototype of the implementation here at least sound? Or > should this go somewhere completely different? Maybe in one of the TSA source > files? This is a semantic concern rather than a syntactic one, so I would expect this to happen in Sema rather t

[clang] [clang] WIP: Warn on mismatched RequiresCapability attributes (PR #67520)

2024-06-06 Thread Timm Baeder via cfe-commits
tbaederr wrote: @AaronBallman Is the prototype of the implementation here at least sound? Or should this go somewhere completely different? Maybe in one of the TSA source files? https://github.com/llvm/llvm-project/pull/67520 ___ cfe-commits mailing

[clang] [clang] WIP: Warn on mismatched RequiresCapability attributes (PR #67520)

2023-10-07 Thread Aaron Puchert via cfe-commits
aaronpuchert wrote: Yeah, it's a tricky question. On one hand there have been previous issues like #42194 (which this would basically address), and it would definitely improve consistency and prevent beginner's mistakes. On the other hand it seems useful to allow adding attributes e.g. to thir

[clang] [clang] WIP: Warn on mismatched RequiresCapability attributes (PR #67520)

2023-10-05 Thread Aaron Ballman via cfe-commits
AaronBallman wrote: > There's a problem with this attribute where the declaration in a header file > doesn't have the attribute, but the definition in the source file has. As a > result, the attribute doesn't take effect when just the header file is > included. Errr, that's the behavior of ba

[clang] [clang] WIP: Warn on mismatched RequiresCapability attributes (PR #67520)

2023-10-05 Thread Timm Baeder via cfe-commits
tbaederr wrote: Ping https://github.com/llvm/llvm-project/pull/67520 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] WIP: Warn on mismatched RequiresCapability attributes (PR #67520)

2023-09-27 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr converted_to_draft https://github.com/llvm/llvm-project/pull/67520 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] WIP: Warn on mismatched RequiresCapability attributes (PR #67520)

2023-09-27 Thread via cfe-commits
llvmbot wrote: @llvm/pr-subscribers-clang Changes There's a problem with this attribute where the declaration in a header file doesn't have the attribute, but the definition in the source file has. As a result, the attribute doesn't take effect when just the header file is included. This

[clang] [clang] WIP: Warn on mismatched RequiresCapability attributes (PR #67520)

2023-09-27 Thread Timm Baeder via cfe-commits
https://github.com/tbaederr created https://github.com/llvm/llvm-project/pull/67520 There's a problem with this attribute where the declaration in a header file doesn't have the attribute, but the definition in the source file has. As a result, the attribute doesn't take effect when just the h