[cfe-commits] r93629 - /cfe/trunk/lib/Sema/SemaOverload.cpp

John McCall rjmccall at apple.com
Fri Jan 15 19:50:16 PST 2010


Author: rjmccall
Date: Fri Jan 15 21:50:16 2010
New Revision: 93629

URL: http://llvm.org/viewvc/llvm-project?rev=93629&view=rev
Log:
Fix a use of uninitialized memory in overload diagnostics.


Modified:
    cfe/trunk/lib/Sema/SemaOverload.cpp

Modified: cfe/trunk/lib/Sema/SemaOverload.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaOverload.cpp?rev=93629&r1=93628&r2=93629&view=diff

==============================================================================
--- cfe/trunk/lib/Sema/SemaOverload.cpp (original)
+++ cfe/trunk/lib/Sema/SemaOverload.cpp Fri Jan 15 21:50:16 2010
@@ -4585,7 +4585,7 @@
 SourceLocation GetLocationForCandidate(const OverloadCandidate *Cand) {
   if (Cand->Function)
     return Cand->Function->getLocation();
-  if (Cand->Surrogate)
+  if (Cand->IsSurrogate)
     return Cand->Surrogate->getLocation();
   return SourceLocation();
 }
@@ -4596,6 +4596,9 @@
 
   bool operator()(const OverloadCandidate *L,
                   const OverloadCandidate *R) {
+    // Fast-path this check.
+    if (L == R) return false;
+
     // Order first by viability.
     if (L->Viable) {
       if (!R->Viable) return true;





More information about the cfe-commits mailing list