[llvm] r226542 - Revert "IR: Simplify DIBuilder's HeaderBuilder API, NFC"
Duncan P. N. Exon Smith
dexonsmith at apple.com
Mon Jan 19 19:01:27 PST 2015
Author: dexonsmith
Date: Mon Jan 19 21:01:27 2015
New Revision: 226542
URL: http://llvm.org/viewvc/llvm-project?rev=226542&view=rev
Log:
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
Modified:
llvm/trunk/lib/IR/DIBuilder.cpp
Modified: llvm/trunk/lib/IR/DIBuilder.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/DIBuilder.cpp?rev=226542&r1=226541&r2=226542&view=diff
==============================================================================
--- llvm/trunk/lib/IR/DIBuilder.cpp (original)
+++ llvm/trunk/lib/IR/DIBuilder.cpp Mon Jan 19 21:01:27 2015
@@ -25,23 +25,15 @@ using namespace llvm::dwarf;
namespace {
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;
public:
- HeaderBuilder() : IsEmpty(true) {}
+ explicit HeaderBuilder(Twine T) { T.toVector(Chars); }
HeaderBuilder(const HeaderBuilder &X) : Chars(X.Chars) {}
HeaderBuilder(HeaderBuilder &&X) : Chars(std::move(X.Chars)) {}
template <class Twineable> HeaderBuilder &concat(Twineable &&X) {
- if (IsEmpty)
- IsEmpty = false;
- else
- Chars.push_back(0);
+ Chars.push_back(0);
Twine(X).toVector(Chars);
return *this;
}
@@ -51,7 +43,7 @@ public:
}
static HeaderBuilder get(unsigned Tag) {
- return HeaderBuilder().concat("0x" + Twine::utohexstr(Tag));
+ return HeaderBuilder("0x" + Twine::utohexstr(Tag));
}
};
}
@@ -747,10 +739,8 @@ static HeaderBuilder setTypeFlagsInHeade
Flags = 0;
Flags |= FlagsToSet;
- return HeaderBuilder()
- .concat(I.getPrefix())
- .concat(Flags)
- .concat(I.getSuffix());
+ return HeaderBuilder(Twine(I.getPrefix())).concat(Flags).concat(
+ I.getSuffix());
}
static DIType createTypeWithFlags(LLVMContext &Context, DIType Ty,
More information about the llvm-commits
mailing list