Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions clang/lib/Analysis/ThreadSafetyCommon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,13 @@ til::SExpr *SExprBuilder::translateDeclRefExpr(const DeclRefExpr *DRE,
if (const auto *VarD = dyn_cast<VarDecl>(VD))
return translateVariable(VarD, Ctx);

if (const auto *FD = dyn_cast<FieldDecl>(VD)) {
if (Ctx && Ctx->SelfArg) {
til::SExpr *E = new (Arena) til::SApply(SelfVar);
return new (Arena) til::Project(E, FD);
}
}

// For non-local variables, treat it as a reference to a named object.
return new (Arena) til::LiteralPtr(VD);
}
Expand Down
4 changes: 0 additions & 4 deletions clang/test/SemaCXX/warn-thread-safety-analysis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3590,14 +3590,10 @@ void requireDecl(RelockableScope &scope) {
struct foo
{
Mutex mu;
// expected-note@+1{{see attribute on parameter here}}
void require(RelockableScope &scope EXCLUSIVE_LOCKS_REQUIRED(mu));
void callRequire(){
RelockableScope scope(&mu);
// TODO: False positive due to incorrect parsing of parameter attribute arguments.
require(scope);
// expected-warning@-1{{calling function 'require' requires holding mutex 'mu' exclusively}}
// expected-warning@-2{{mutex managed by 'scope' is 'mu' instead of 'mu'}}
}
};

Expand Down
Loading