r207811 - Use std::abs(int) portably.

David Blaikie dblaikie at gmail.com
Thu May 1 16:01:41 PDT 2014


Author: dblaikie
Date: Thu May  1 18:01:41 2014
New Revision: 207811

URL: http://llvm.org/viewvc/llvm-project?rev=207811&view=rev
Log:
Use std::abs(int) portably.

Code review feedback from Reid Kleckner on r207806.

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=207811&r1=207810&r2=207811&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaOverload.cpp (original)
+++ cfe/trunk/lib/Sema/SemaOverload.cpp Thu May  1 18:01:41 2014
@@ -33,6 +33,7 @@
 #include "llvm/ADT/SmallPtrSet.h"
 #include "llvm/ADT/SmallString.h"
 #include <algorithm>
+#include <cstdlib>
 
 namespace clang {
 using namespace sema;
@@ -9260,8 +9261,8 @@ struct CompareOverloadCandidatesForDispl
           L->FailureKind == ovl_fail_too_few_arguments) {
         if (R->FailureKind == ovl_fail_too_many_arguments ||
             R->FailureKind == ovl_fail_too_few_arguments) {
-          int LDist = abs((int)L->Function->getNumParams() - (int)NumArgs);
-          int RDist = abs((int)R->Function->getNumParams() - (int)NumArgs);
+          int LDist = std::abs((int)L->Function->getNumParams() - (int)NumArgs);
+          int RDist = std::abs((int)R->Function->getNumParams() - (int)NumArgs);
           if (LDist == RDist)
             return L->FailureKind == ovl_fail_too_many_arguments &&
                    R->FailureKind == ovl_fail_too_few_arguments;





More information about the cfe-commits mailing list