To relay some comments I made to Sean in person...<br><br><div class="gmail_quote">On Wed, Jun 22, 2011 at 5:26 PM, Sean Hunt <span dir="ltr"><<a href="mailto:scshunt@csclub.uwaterloo.ca">scshunt@csclub.uwaterloo.ca</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">Author: coppro<br>
Date: Wed Jun 22 19:26:20 2011<br>
New Revision: 133671<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=133671&view=rev" target="_blank" class="cremed">http://llvm.org/viewvc/llvm-project?rev=133671&view=rev</a><br>
Log:<br>
Clean up the heart of the caching code and miss fewer edge cases.<br>
<br>
Added:<br>
cfe/trunk/test/SemaCXX/using-decl-assignment-cache.cpp<br>
Modified:<br>
cfe/trunk/lib/Sema/SemaLookup.cpp<br>
<br>
Modified: cfe/trunk/lib/Sema/SemaLookup.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaLookup.cpp?rev=133671&r1=133670&r2=133671&view=diff" target="_blank" class="cremed">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaLookup.cpp?rev=133671&r1=133670&r2=133671&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/lib/Sema/SemaLookup.cpp (original)<br>
+++ cfe/trunk/lib/Sema/SemaLookup.cpp Wed Jun 22 19:26:20 2011<br>
@@ -2240,7 +2240,7 @@<br>
ThisTy.addConst();<br>
if (VolatileThis)<br>
ThisTy.addVolatile();<br>
- Expr::Classification ObjectClassification =<br>
+ Expr::Classification Classification =<br>
(new (Context) OpaqueValueExpr(SourceLocation(), ThisTy,<br>
RValueThis ? VK_RValue : VK_LValue))-><br>
Classify(Context);<br>
@@ -2256,12 +2256,21 @@<br>
assert((I != E) &&<br>
"lookup for a constructor or assignment operator was empty");<br>
for ( ; I != E; ++I) {<br>
- if ((*I)->isInvalidDecl())<br>
+ Decl *DD = *I;<br></blockquote><div><br></div><div>Please, a better name than 'DD'... =[</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
+<br>
+ if (UsingShadowDecl *U = dyn_cast<UsingShadowDecl>(D))<br>
+ DD = U->getTargetDecl();<br></blockquote><div><br></div><div>Is this always safe to do without checking that U is valid?</div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
+<br>
+ if (DD->isInvalidDecl())<br>
continue;<br>
<br>
- if (CXXMethodDecl *M = dyn_cast<CXXMethodDecl>(*I)) {<br>
- AddOverloadCandidate(M, DeclAccessPair::make(M, AS_public), &Arg, NumArgs,<br>
- OCS, true);<br>
+ if (CXXMethodDecl *M = dyn_cast<CXXMethodDecl>(DD)) {<br>
+ if (SM == CXXCopyAssignment || SM == CXXMoveAssignment)<br>
+ AddMethodCandidate(M, DeclAccessPair::make(M, AS_public), D, ThisTy,<br>
+ Classification, &Arg, NumArgs, OCS, true);<br>
+ else<br>
+ AddOverloadCandidate(M, DeclAccessPair::make(M, AS_public), &Arg,<br>
+ NumArgs, OCS, true);<br>
<br>
// Here we're looking for a const parameter to speed up creation of<br>
// implicit copy methods.<br>
@@ -2274,9 +2283,14 @@<br>
Result->setConstParamMatch(true);<br>
}<br>
} else if (FunctionTemplateDecl *Tmpl =<br>
- dyn_cast<FunctionTemplateDecl>(*I)) {<br>
- AddTemplateOverloadCandidate(Tmpl, DeclAccessPair::make(Tmpl, AS_public),<br>
- 0, &Arg, NumArgs, OCS, true);<br>
+ dyn_cast<FunctionTemplateDecl>(DD)) {<br>
+ if (SM == CXXCopyAssignment || SM == CXXMoveAssignment)<br>
+ AddMethodTemplateCandidate(Tmpl, DeclAccessPair::make(Tmpl, AS_public),<br>
+ D, 0, ThisTy, Classification, &Arg, NumArgs,<br>
+ OCS, true);<br>
+ else<br>
+ AddTemplateOverloadCandidate(Tmpl, DeclAccessPair::make(Tmpl, AS_public),<br>
+ 0, &Arg, NumArgs, OCS, true);<br>
}<br>
}<br>
<br>
<br>
Added: cfe/trunk/test/SemaCXX/using-decl-assignment-cache.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/using-decl-assignment-cache.cpp?rev=133671&view=auto" target="_blank" class="cremed">http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/using-decl-assignment-cache.cpp?rev=133671&view=auto</a><br>
==============================================================================<br>
--- cfe/trunk/test/SemaCXX/using-decl-assignment-cache.cpp (added)<br>
+++ cfe/trunk/test/SemaCXX/using-decl-assignment-cache.cpp Wed Jun 22 19:26:20 2011<br>
@@ -0,0 +1,16 @@<br>
+// RUN: %clang_cc1 -std=c++0x -fsyntax-only %s<br>
+<br>
+struct D;<br>
+struct B {<br>
+ D& operator = (const D&);<br>
+};<br>
+struct D : B {<br>
+ using B::operator=;<br>
+};<br>
+struct F : D {<br>
+};<br>
+<br>
+void H () {<br>
+ F f;<br>
+ f = f;<br>
+}<br>
<br>
<br>
_______________________________________________<br>
cfe-commits mailing list<br>
<a href="mailto:cfe-commits@cs.uiuc.edu" class="cremed">cfe-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits" target="_blank" class="cremed">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits</a><br>
</blockquote></div><br><div class="vimiumHUD" style="right: 150px; zoom: 100%; opacity: 0; display: none; "></div>