diff options
author | Aaron Puchert <aaronpuchert@alice-dsl.net> | 2020-10-25 19:31:53 +0100 |
---|---|---|
committer | Aaron Puchert <aaronpuchert@alice-dsl.net> | 2020-10-25 19:32:26 +0100 |
commit | 5250a03a9959c2701a8338fe1a1ffa8bd93d6173 (patch) | |
tree | 69fe3e88cf3bb24642d7026004b802f834722b89 /clang/lib/CodeGen/CodeGenFunction.cpp | |
parent | 1ff313f0989009f8a080418e93fe510ec66e8999 (diff) | |
download | llvm-5250a03a9959c2701a8338fe1a1ffa8bd93d6173.zip llvm-5250a03a9959c2701a8338fe1a1ffa8bd93d6173.tar.gz llvm-5250a03a9959c2701a8338fe1a1ffa8bd93d6173.tar.bz2 |
Thread safety analysis: Consider global variables in scope
Instead of just mutex members we also consider mutex globals.
Unsurprisingly they are always in scope. Now the paper [1] says that
> The scope of a class member is assumed to be its enclosing class,
> while the scope of a global variable is the translation unit in
> which it is defined.
But I don't think we should limit this to TUs where a definition is
available - a declaration is enough to acquire the mutex, and if a mutex
is really limited in scope to a translation unit, it should probably be
only declared there.
The previous attempt in 9dcc82f34ea was causing false positives because
I wrongly assumed that LiteralPtrs were always globals, which they are
not. This should be fixed now.
[1] https://static.googleusercontent.com/media/research.google.com/en/us/pubs/archive/42958.pdf
Fixes PR46354.
Reviewed By: aaron.ballman
Differential Revision: https://reviews.llvm.org/D84604
Diffstat (limited to 'clang/lib/CodeGen/CodeGenFunction.cpp')
0 files changed, 0 insertions, 0 deletions