[cfe-commits] r94065 - /cfe/trunk/lib/Sema/SemaDecl.cpp

Daniel Dunbar daniel at zuster.org
Thu Jan 21 08:47:28 PST 2010


Thanks Mike!

On Wed, Jan 20, 2010 at 7:43 PM, Mike Stump <mrs at apple.com> wrote:
> Author: mrs
> Date: Wed Jan 20 21:43:13 2010
> New Revision: 94065
>
> URL: http://llvm.org/viewvc/llvm-project?rev=94065&view=rev
> Log:
> Avoid instantiating std::sort to save on compiler size.
>
> Modified:
>    cfe/trunk/lib/Sema/SemaDecl.cpp
>
> Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=94065&r1=94064&r2=94065&view=diff
>
> ==============================================================================
> --- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
> +++ cfe/trunk/lib/Sema/SemaDecl.cpp Wed Jan 20 21:43:13 2010
> @@ -1411,16 +1411,10 @@
>   return top;
>  }
>
> -namespace {
> -class LineCmp {
> -  SourceManager &SM;
> -public:
> -  LineCmp(SourceManager &sm) : SM(sm) {
> -  }
> -  bool operator () (SourceLocation l1, SourceLocation l2) {
> -    return l1 < l2;
> -  }
> -};
> +static int LineCmp(const void *p1, const void *p2) {
> +  SourceLocation *Line1 = (SourceLocation *)p1;
> +  SourceLocation *Line2 = (SourceLocation *)p2;
> +  return !(*Line1 < *Line2);
>  }
>
>  /// CheckUnreachable - Check for unreachable code.
> @@ -1477,7 +1471,7 @@
>     }
>   }
>
> -  std::sort(lines.begin(), lines.end(), LineCmp(Context.getSourceManager()));
> +  llvm::array_pod_sort(lines.begin(), lines.end(), LineCmp);
>   for (llvm::SmallVector<SourceLocation, 24>::iterator I = lines.begin(),
>          E = lines.end();
>        I != E;
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>




More information about the cfe-commits mailing list