[cfe-dev] ThreadSafetyAnalysis in C code
Marco Elver via cfe-dev
cfe-dev at lists.llvm.org
Tue Jan 11 07:30:27 PST 2022
On Mon, 10 Jan 2022 at 13:41, Aaron Ballman <aaron at aaronballman.com> wrote:
>
> On Mon, Jan 10, 2022 at 6:10 AM Marco Elver <elver at google.com> wrote:
> >
> > Hello,
> >
> > We are interested in applying ThreadSafetyAnalysis to C code
> > (specifically the Linux kernel).
>
> That's fantastic to hear!
>
> > However, the very common usecase of declaring a struct member to be
> > protected by another lockable struct member inside the same struct does
> > not work (see addition to test below). This results in an error:
> >
> > clang/test/Sema/warn-thread-safety-analysis.c:36:24: error: use of undeclared identifier 'mu'
> > int data1 GUARDED_BY(mu);
> > ^
> > clang/test/Sema/warn-thread-safety-analysis.c:38:24: error: use of undeclared identifier 'mu'
> > int data2 GUARDED_BY(mu);
> >
> > AFAIK, this is the main limitation preventing us to use it on the Linux
> > kernel.
> >
> > Does anyone know what's going on here?
>
> This is https://github.com/llvm/llvm-project/issues/20777
>
> The crux of the issue is there are some lookup difficulties because C
> doesn't have the notion of a "this" pointer for the structure object
> itself.
Thanks, I see.
I'll respond to that issue to keep things in one place.
Thanks,
-- Marco
More information about the cfe-dev
mailing list