forked from OSchip/llvm-project
Thread safety analysis: move smart pointer checks from -Wthread-safety-beta
to -Wthread-safety. llvm-svn: 203510
This commit is contained in:
parent
ce376c0fcb
commit
d1c9b37db9
|
@ -1857,10 +1857,8 @@ void BuildLockset::checkAccess(const Expr *Exp, AccessKind AK) {
|
|||
}
|
||||
|
||||
if (const ArraySubscriptExpr *AE = dyn_cast<ArraySubscriptExpr>(Exp)) {
|
||||
if (Analyzer->Handler.issueBetaWarnings()) {
|
||||
checkPtAccess(AE->getLHS(), AK);
|
||||
return;
|
||||
}
|
||||
checkPtAccess(AE->getLHS(), AK);
|
||||
return;
|
||||
}
|
||||
|
||||
if (const MemberExpr *ME = dyn_cast<MemberExpr>(Exp)) {
|
||||
|
@ -1884,27 +1882,23 @@ void BuildLockset::checkAccess(const Expr *Exp, AccessKind AK) {
|
|||
|
||||
/// \brief Checks pt_guarded_by and pt_guarded_var attributes.
|
||||
void BuildLockset::checkPtAccess(const Expr *Exp, AccessKind AK) {
|
||||
if (Analyzer->Handler.issueBetaWarnings()) {
|
||||
while (true) {
|
||||
if (const ParenExpr *PE = dyn_cast<ParenExpr>(Exp)) {
|
||||
Exp = PE->getSubExpr();
|
||||
continue;
|
||||
}
|
||||
if (const CastExpr *CE = dyn_cast<CastExpr>(Exp)) {
|
||||
if (CE->getCastKind() == CK_ArrayToPointerDecay) {
|
||||
// If it's an actual array, and not a pointer, then it's elements
|
||||
// are protected by GUARDED_BY, not PT_GUARDED_BY;
|
||||
checkAccess(CE->getSubExpr(), AK);
|
||||
return;
|
||||
}
|
||||
Exp = CE->getSubExpr();
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
while (true) {
|
||||
if (const ParenExpr *PE = dyn_cast<ParenExpr>(Exp)) {
|
||||
Exp = PE->getSubExpr();
|
||||
continue;
|
||||
}
|
||||
if (const CastExpr *CE = dyn_cast<CastExpr>(Exp)) {
|
||||
if (CE->getCastKind() == CK_ArrayToPointerDecay) {
|
||||
// If it's an actual array, and not a pointer, then it's elements
|
||||
// are protected by GUARDED_BY, not PT_GUARDED_BY;
|
||||
checkAccess(CE->getSubExpr(), AK);
|
||||
return;
|
||||
}
|
||||
Exp = CE->getSubExpr();
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
}
|
||||
else
|
||||
Exp = Exp->IgnoreParenCasts();
|
||||
|
||||
const ValueDecl *D = getValueDecl(Exp);
|
||||
if (!D || !D->hasAttrs())
|
||||
|
@ -2134,11 +2128,9 @@ void BuildLockset::VisitCallExpr(CallExpr *Exp) {
|
|||
case OO_Star:
|
||||
case OO_Arrow:
|
||||
case OO_Subscript: {
|
||||
if (Analyzer->Handler.issueBetaWarnings()) {
|
||||
const Expr *Obj = OE->getArg(0);
|
||||
checkAccess(Obj, AK_Read);
|
||||
checkPtAccess(Obj, AK_Read);
|
||||
}
|
||||
const Expr *Obj = OE->getArg(0);
|
||||
checkAccess(Obj, AK_Read);
|
||||
checkPtAccess(Obj, AK_Read);
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
|
|
Loading…
Reference in New Issue