[llvm] r239913 - [ArchiveWriter] Use EndianStream. No functional change intended.

Rafael EspĂ­ndola rafael.espindola at gmail.com
Wed Jun 17 18:05:02 PDT 2015


Thanks!
On Jun 17, 2015 12:11 PM, "Benjamin Kramer" <benny.kra at googlemail.com>
wrote:

> Author: d0k
> Date: Wed Jun 17 11:02:56 2015
> New Revision: 239913
>
> URL: http://llvm.org/viewvc/llvm-project?rev=239913&view=rev
> Log:
> [ArchiveWriter] Use EndianStream. No functional change intended.
>
> Modified:
>     llvm/trunk/lib/Object/ArchiveWriter.cpp
>
> Modified: llvm/trunk/lib/Object/ArchiveWriter.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Object/ArchiveWriter.cpp?rev=239913&r1=239912&r2=239913&view=diff
>
> ==============================================================================
> --- llvm/trunk/lib/Object/ArchiveWriter.cpp (original)
> +++ llvm/trunk/lib/Object/ArchiveWriter.cpp Wed Jun 17 11:02:56 2015
> @@ -18,6 +18,7 @@
>  #include "llvm/Object/Archive.h"
>  #include "llvm/Object/ObjectFile.h"
>  #include "llvm/Object/SymbolicFile.h"
> +#include "llvm/Support/EndianStream.h"
>  #include "llvm/Support/Errc.h"
>  #include "llvm/Support/ErrorHandling.h"
>  #include "llvm/Support/Format.h"
> @@ -83,9 +84,7 @@ static void printWithSpacePadding(raw_fd
>    OS << Data;
>    unsigned SizeSoFar = OS.tell() - OldPos;
>    if (Size > SizeSoFar) {
> -    unsigned Remaining = Size - SizeSoFar;
> -    for (unsigned I = 0; I < Remaining; ++I)
> -      OS << ' ';
> +    OS.indent(Size - SizeSoFar);
>    } else if (Size < SizeSoFar) {
>      assert(MayTruncate && "Data doesn't fit in Size");
>      // Some of the data this is used for (like UID) can be larger than the
> @@ -94,12 +93,8 @@ static void printWithSpacePadding(raw_fd
>    }
>  }
>
> -static void print32BE(raw_fd_ostream &Out, unsigned Val) {
> -  // FIXME: Should use Endian.h here.
> -  for (int I = 3; I >= 0; --I) {
> -    char V = (Val >> (8 * I)) & 0xff;
> -    Out << V;
> -  }
> +static void print32BE(raw_ostream &Out, uint32_t Val) {
> +  support::endian::Writer<support::big>(Out).write(Val);
>  }
>
>  static void printRestOfMemberHeader(raw_fd_ostream &Out,
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150617/82e8e573/attachment.html>


More information about the llvm-commits mailing list