[cfe-commits] r142910 - in /cfe/trunk: lib/Sema/TreeTransform.h test/SemaCXX/warn-thread-safety-analysis.cpp
Richard Smith
richard-llvm at metafoo.co.uk
Mon Oct 24 23:33:21 PDT 2011
Author: rsmith
Date: Tue Oct 25 01:33:21 2011
New Revision: 142910
URL: http://llvm.org/viewvc/llvm-project?rev=142910&view=rev
Log:
Don't forget the lvalue-to-rvalue conversion on the LHS when instantiating a
dependent ->, where the member being referred to is an anonymous struct or
union. This path was missed by the fix in r142890.
Modified:
cfe/trunk/lib/Sema/TreeTransform.h
cfe/trunk/test/SemaCXX/warn-thread-safety-analysis.cpp
Modified: cfe/trunk/lib/Sema/TreeTransform.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/TreeTransform.h?rev=142910&r1=142909&r2=142910&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/TreeTransform.h (original)
+++ cfe/trunk/lib/Sema/TreeTransform.h Tue Oct 25 01:33:21 2011
@@ -1482,6 +1482,11 @@
FoundDecl, Member);
if (BaseResult.isInvalid())
return ExprError();
+ if (isArrow) {
+ BaseResult = getSema().DefaultLvalueConversion(BaseResult.take());
+ if (BaseResult.isInvalid())
+ return ExprError();
+ }
Base = BaseResult.take();
ExprValueKind VK = isArrow ? VK_LValue : Base->getValueKind();
MemberExpr *ME =
Modified: cfe/trunk/test/SemaCXX/warn-thread-safety-analysis.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/warn-thread-safety-analysis.cpp?rev=142910&r1=142909&r2=142910&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/warn-thread-safety-analysis.cpp (original)
+++ cfe/trunk/test/SemaCXX/warn-thread-safety-analysis.cpp Tue Oct 25 01:33:21 2011
@@ -1516,10 +1516,17 @@
Mutex m;
S *s GUARDED_BY(this->m);
};
+ Mutex m;
+ struct U {
+ union {
+ int n;
+ };
+ } *u GUARDED_BY(m);
template<typename U>
struct IndirectLock {
int DoNaughtyThings(T *t) {
+ u->n = 0; // expected-warning {{reading variable 'u' requires locking 'm'}}
return t->s->n; // expected-warning {{reading variable 's' requires locking 'm'}}
}
};
More information about the cfe-commits
mailing list