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
This commit is contained in:
parent
c1909d7337
commit
ccde601f14
|
@ -13,6 +13,15 @@
|
|||
using namespace llvm;
|
||||
using namespace llvm::objcopy::macho;
|
||||
|
||||
Section::Section(StringRef SegName, StringRef SectName)
|
||||
: Segname(std::string(SegName)), Sectname(std::string(SectName)),
|
||||
CanonicalName((Twine(SegName) + Twine(',') + SectName).str()) {}
|
||||
|
||||
Section::Section(StringRef SegName, StringRef SectName, StringRef Content)
|
||||
: Segname(std::string(SegName)), Sectname(std::string(SectName)),
|
||||
CanonicalName((Twine(SegName) + Twine(',') + SectName).str()),
|
||||
Content(Content) {}
|
||||
|
||||
const SymbolEntry *SymbolTable::getSymbolByIndex(uint32_t Index) const {
|
||||
assert(Index < Symbols.size() && "invalid symbol index");
|
||||
return Symbols[Index].get();
|
||||
|
|
|
@ -57,14 +57,9 @@ struct Section {
|
|||
StringRef Content;
|
||||
std::vector<RelocationInfo> Relocations;
|
||||
|
||||
Section(StringRef SegName, StringRef SectName)
|
||||
: Segname(std::string(SegName)), Sectname(std::string(SectName)),
|
||||
CanonicalName((Twine(SegName) + Twine(',') + SectName).str()) {}
|
||||
Section(StringRef SegName, StringRef SectName);
|
||||
|
||||
Section(StringRef SegName, StringRef SectName, StringRef Content)
|
||||
: Segname(std::string(SegName)), Sectname(std::string(SectName)),
|
||||
CanonicalName((Twine(SegName) + Twine(',') + SectName).str()),
|
||||
Content(Content) {}
|
||||
Section(StringRef SegName, StringRef SectName, StringRef Content);
|
||||
|
||||
MachO::SectionType getType() const {
|
||||
return static_cast<MachO::SectionType>(Flags & MachO::SECTION_TYPE);
|
||||
|
|
|
@ -21,13 +21,12 @@
|
|||
#ifndef LLVM_TOOLS_LLVM_IFS_ERRORCOLLECTOR_H
|
||||
#define LLVM_TOOLS_LLVM_IFS_ERRORCOLLECTOR_H
|
||||
|
||||
#include "llvm/Support/Error.h"
|
||||
#include "llvm/Support/raw_ostream.h"
|
||||
#include <vector>
|
||||
|
||||
namespace llvm {
|
||||
|
||||
class Error;
|
||||
|
||||
namespace ifs {
|
||||
|
||||
class ErrorCollector {
|
||||
|
|
Loading…
Reference in New Issue