On Mon, Apr 23, 2012 at 9:45 AM, DeLesley Hutchins <[email protected]>wrote:
> Author: delesley > Date: Mon Apr 23 11:45:01 2012 > New Revision: 155357 > > URL: http://llvm.org/viewvc/llvm-project?rev=155357&view=rev > Log: > Thread-safety analysis: support new "pointer to member" syntax for > existentially quantified lock expressions. > Come again? ;] Also, should this new syntax also get new documentation? > > Modified: > cfe/trunk/lib/Sema/SemaDeclAttr.cpp > cfe/trunk/test/SemaCXX/warn-thread-safety-parsing.cpp > > Modified: cfe/trunk/lib/Sema/SemaDeclAttr.cpp > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclAttr.cpp?rev=155357&r1=155356&r2=155357&view=diff > > ============================================================================== > --- cfe/trunk/lib/Sema/SemaDeclAttr.cpp (original) > +++ cfe/trunk/lib/Sema/SemaDeclAttr.cpp Mon Apr 23 11:45:01 2012 > @@ -313,7 +313,11 @@ > continue; > } > > - if (isa<StringLiteral>(ArgExp)) { > + if (StringLiteral *StrLit = dyn_cast<StringLiteral>(ArgExp)) { > + // Ignore empty strings without warnings > This seems an unrelated change, was it intentional? Test case? > + if (StrLit->getLength() == 0) > + continue; > + > // We allow constant strings to be used as a placeholder for > expressions > // that are not valid C++ syntax, but warn that they are ignored. > S.Diag(Attr.getLoc(), diag::warn_thread_attribute_ignored) << > @@ -323,6 +327,14 @@ > > QualType ArgTy = ArgExp->getType(); > > + // A pointer to member expression of the form &MyClass::mu is treated > + // specially -- we need to look at the type of the member. > + if (UnaryOperator *UOp = dyn_cast<UnaryOperator>(ArgExp)) > + if (UOp->getOpcode() == UO_AddrOf) > + if (DeclRefExpr *DRE = dyn_cast<DeclRefExpr>(UOp->getSubExpr())) > + if (DRE->getDecl()->isCXXInstanceMember()) > + ArgTy = DRE->getDecl()->getType(); > + > // First see if we can just cast to record type, or point to record > type. > const RecordType *RT = getRecordType(ArgTy); > > > Modified: cfe/trunk/test/SemaCXX/warn-thread-safety-parsing.cpp > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/warn-thread-safety-parsing.cpp?rev=155357&r1=155356&r2=155357&view=diff > > ============================================================================== > --- cfe/trunk/test/SemaCXX/warn-thread-safety-parsing.cpp (original) > +++ cfe/trunk/test/SemaCXX/warn-thread-safety-parsing.cpp Mon Apr 23 > 11:45:01 2012 > @@ -1341,5 +1341,20 @@ > > } > > +namespace PointerToMemberTest { > + > +class Graph { > +public: > + Mu mu_; > +}; > + > +class Node { > +public: > + void foo() EXCLUSIVE_LOCKS_REQUIRED(&Graph::mu_); > + int a GUARDED_BY(&Graph::mu_); > +}; > + > +} > + > } // end namespace TestMultiDecl > > > > _______________________________________________ > cfe-commits mailing list > [email protected] > http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits >
_______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
