[lld] r223527 - [mach-o] Pass vectors by reference and name empty vector.

David Blaikie dblaikie at gmail.com
Fri Dec 5 14:52:48 PST 2014


On Fri, Dec 5, 2014 at 2:03 PM, Nick Kledzik <kledzik at apple.com> wrote:

> Author: kledzik
> Date: Fri Dec  5 16:03:20 2014
> New Revision: 223527
>
> URL: http://llvm.org/viewvc/llvm-project?rev=223527&view=rev
> Log:
> [mach-o] Pass vectors by reference and name empty vector.
>
> Modified:
>     lld/trunk/lib/ReaderWriter/MachO/CompactUnwindPass.cpp
>
> Modified: lld/trunk/lib/ReaderWriter/MachO/CompactUnwindPass.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/MachO/CompactUnwindPass.cpp?rev=223527&r1=223526&r2=223527&view=diff
>
> ==============================================================================
> --- lld/trunk/lib/ReaderWriter/MachO/CompactUnwindPass.cpp (original)
> +++ lld/trunk/lib/ReaderWriter/MachO/CompactUnwindPass.cpp Fri Dec  5
> 16:03:20 2014
> @@ -67,9 +67,9 @@ struct UnwindInfoPage {
>  class UnwindInfoAtom : public SimpleDefinedAtom {
>  public:
>    UnwindInfoAtom(ArchHandler &archHandler, const File &file, bool isBig,
> -                 std::vector<uint32_t> commonEncodings,
> -                 std::vector<const Atom *> personalities,
> -                 std::vector<UnwindInfoPage> pages, uint32_t numLSDAs)
> +                 std::vector<const Atom *> &personalities,
> +                 std::vector<uint32_t> &commonEncodings,
> +                 std::vector<UnwindInfoPage> &pages, uint32_t numLSDAs)
>

Should these be const ref? Does the caller already use the side-effects,
not expect side effects, or not care about the side effects of the ctors
possible mutations of these vectors?


>        : SimpleDefinedAtom(file), _archHandler(archHandler),
>          _commonEncodingsOffset(7 * sizeof(uint32_t)),
>          _personalityArrayOffset(_commonEncodingsOffset +
> @@ -302,6 +302,9 @@ private:
>      // also probably be sorted by frequency.
>      assert(personalities.size() <= 4);
>
> +    // TODO: Find commmon encodings for use by compressed pages.
> +    std::vector<uint32_t> commonEncodings;
> +
>      // Now sort the entries by final address and fixup the compact
> encoding to
>      // its final form (i.e. set personality function bits & create DWARF
>      // references where needed).
> @@ -338,8 +341,8 @@ private:
>      } while (pageStart < unwindInfos.size());
>
>      UnwindInfoAtom *unwind = new (_file.allocator())
> -        UnwindInfoAtom(_archHandler, _file, _isBig,
> std::vector<uint32_t>(),
> -                       personalities, pages, numLSDAs);
> +        UnwindInfoAtom(_archHandler, _file, _isBig, personalities,
> +                       commonEncodings, pages, numLSDAs);
>      mergedFile->addAtom(*unwind);
>
>      // Finally, remove all __compact_unwind atoms now that we've
> processed them.
>
>
> _______________________________________________
> 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/20141205/54c66f05/attachment.html>


More information about the llvm-commits mailing list