Fix llvm/lib/ObjCopy, llvm/llvm-ifs: c++20 compatibility
authorAngelo Matni <angelomatni@google.com>
Fri, 14 Oct 2022 17:28:46 +0000 (10:28 -0700)
committerFangrui Song <i@maskray.me>
Fri, 14 Oct 2022 17:28:46 +0000 (10:28 -0700)
commitccde601f140c79344e67e3a5164524ea3d8f43aa
tree26c7d00f6c2ba25e77732bfd5f94f1809bbba636
parentc1909d73372e669a44a2aefe82de873c2161cc44
Fix llvm/lib/ObjCopy, llvm/llvm-ifs: c++20 compatibility

Cleanup: avoid referring to `std::vector<T>` members when `T` is incomplete.

This is [not legal](https://timsong-cpp.github.io/cppwp/n4868/vector#overview-4)
according to the C++ standard, and causes build errors in particular in C++20
mode. Fix it by defining the vector's type before using the vector.

Reviewed By: saugustine, MaskRay

Differential Revision: https://reviews.llvm.org/D135906
llvm/lib/ObjCopy/MachO/MachOObject.cpp
llvm/lib/ObjCopy/MachO/MachOObject.h
llvm/tools/llvm-ifs/ErrorCollector.h