mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-05 12:31:33 +00:00
Revert "IR: Simplify DIBuilder's HeaderBuilder API, NFC"
This reverts commit r226540, since I hit an unexpected bot failure [1]. I'll investigate. [1]: http://bb.pgr.jp/builders/cmake-llvm-x86_64-linux/builds/20244 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226542 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
749d6fbf7e
commit
0ab88ac2a1
@ -25,23 +25,15 @@ using namespace llvm::dwarf;
|
|||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
class HeaderBuilder {
|
class HeaderBuilder {
|
||||||
/// \brief Whether there are any fields yet.
|
|
||||||
///
|
|
||||||
/// Note that this is not equivalent to \c Chars.empty(), since \a concat()
|
|
||||||
/// may have been called already with an empty string.
|
|
||||||
bool IsEmpty;
|
|
||||||
SmallVector<char, 256> Chars;
|
SmallVector<char, 256> Chars;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
HeaderBuilder() : IsEmpty(true) {}
|
explicit HeaderBuilder(Twine T) { T.toVector(Chars); }
|
||||||
HeaderBuilder(const HeaderBuilder &X) : Chars(X.Chars) {}
|
HeaderBuilder(const HeaderBuilder &X) : Chars(X.Chars) {}
|
||||||
HeaderBuilder(HeaderBuilder &&X) : Chars(std::move(X.Chars)) {}
|
HeaderBuilder(HeaderBuilder &&X) : Chars(std::move(X.Chars)) {}
|
||||||
|
|
||||||
template <class Twineable> HeaderBuilder &concat(Twineable &&X) {
|
template <class Twineable> HeaderBuilder &concat(Twineable &&X) {
|
||||||
if (IsEmpty)
|
Chars.push_back(0);
|
||||||
IsEmpty = false;
|
|
||||||
else
|
|
||||||
Chars.push_back(0);
|
|
||||||
Twine(X).toVector(Chars);
|
Twine(X).toVector(Chars);
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
@ -51,7 +43,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
static HeaderBuilder get(unsigned Tag) {
|
static HeaderBuilder get(unsigned Tag) {
|
||||||
return HeaderBuilder().concat("0x" + Twine::utohexstr(Tag));
|
return HeaderBuilder("0x" + Twine::utohexstr(Tag));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@ -747,10 +739,8 @@ static HeaderBuilder setTypeFlagsInHeader(StringRef Header,
|
|||||||
Flags = 0;
|
Flags = 0;
|
||||||
Flags |= FlagsToSet;
|
Flags |= FlagsToSet;
|
||||||
|
|
||||||
return HeaderBuilder()
|
return HeaderBuilder(Twine(I.getPrefix())).concat(Flags).concat(
|
||||||
.concat(I.getPrefix())
|
I.getSuffix());
|
||||||
.concat(Flags)
|
|
||||||
.concat(I.getSuffix());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static DIType createTypeWithFlags(LLVMContext &Context, DIType Ty,
|
static DIType createTypeWithFlags(LLVMContext &Context, DIType Ty,
|
||||||
|
Loading…
Reference in New Issue
Block a user