mirror of
https://github.com/RPCS3/llvm.git
synced 2025-02-25 05:10:56 +00:00
MCStreamer: Reimplement the virtual EmitRawText as a protected member, EmitRawTextImpl, to avoid string literal ambiguities
Also improve the implementation of EmitRawText(Twine) so it doesn't bother using the SmallString buffer if the Twine is a simple StringRef anyway. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193378 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
07d5aef305
commit
5759c3a029
@ -149,6 +149,8 @@ protected:
|
|||||||
}
|
}
|
||||||
void EmitW64Tables();
|
void EmitW64Tables();
|
||||||
|
|
||||||
|
virtual void EmitRawTextImpl(StringRef String);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
virtual ~MCStreamer();
|
virtual ~MCStreamer();
|
||||||
|
|
||||||
@ -657,7 +659,6 @@ public:
|
|||||||
/// EmitRawText - If this file is backed by a assembly streamer, this dumps
|
/// EmitRawText - If this file is backed by a assembly streamer, this dumps
|
||||||
/// the specified string in the output .s file. This capability is
|
/// the specified string in the output .s file. This capability is
|
||||||
/// indicated by the hasRawTextSupport() predicate. By default this aborts.
|
/// indicated by the hasRawTextSupport() predicate. By default this aborts.
|
||||||
virtual void EmitRawText(StringRef String);
|
|
||||||
void EmitRawText(const Twine &String);
|
void EmitRawText(const Twine &String);
|
||||||
|
|
||||||
/// Flush - Causes any cached state to be written out.
|
/// Flush - Causes any cached state to be written out.
|
||||||
|
@ -196,7 +196,7 @@ void DIEInteger::EmitValue(AsmPrinter *Asm, dwarf::Form Form) const {
|
|||||||
// Emit something to keep the lines and comments in sync.
|
// Emit something to keep the lines and comments in sync.
|
||||||
// FIXME: Is there a better way to do this?
|
// FIXME: Is there a better way to do this?
|
||||||
if (Asm->OutStreamer.hasRawTextSupport())
|
if (Asm->OutStreamer.hasRawTextSupport())
|
||||||
Asm->OutStreamer.EmitRawText(StringRef(""));
|
Asm->OutStreamer.EmitRawText("");
|
||||||
return;
|
return;
|
||||||
case dwarf::DW_FORM_flag: // Fall thru
|
case dwarf::DW_FORM_flag: // Fall thru
|
||||||
case dwarf::DW_FORM_ref1: // Fall thru
|
case dwarf::DW_FORM_ref1: // Fall thru
|
||||||
|
@ -255,7 +255,7 @@ public:
|
|||||||
/// EmitRawText - If this file is backed by an assembly streamer, this dumps
|
/// EmitRawText - If this file is backed by an assembly streamer, this dumps
|
||||||
/// the specified string in the output .s file. This capability is
|
/// the specified string in the output .s file. This capability is
|
||||||
/// indicated by the hasRawTextSupport() predicate.
|
/// indicated by the hasRawTextSupport() predicate.
|
||||||
virtual void EmitRawText(StringRef String);
|
virtual void EmitRawTextImpl(StringRef String);
|
||||||
|
|
||||||
virtual void FinishImpl();
|
virtual void FinishImpl();
|
||||||
};
|
};
|
||||||
@ -1346,7 +1346,7 @@ void MCAsmStreamer::EmitBundleUnlock() {
|
|||||||
/// EmitRawText - If this file is backed by an assembly streamer, this dumps
|
/// EmitRawText - If this file is backed by an assembly streamer, this dumps
|
||||||
/// the specified string in the output .s file. This capability is
|
/// the specified string in the output .s file. This capability is
|
||||||
/// indicated by the hasRawTextSupport() predicate.
|
/// indicated by the hasRawTextSupport() predicate.
|
||||||
void MCAsmStreamer::EmitRawText(StringRef String) {
|
void MCAsmStreamer::EmitRawTextImpl(StringRef String) {
|
||||||
if (!String.empty() && String.back() == '\n')
|
if (!String.empty() && String.back() == '\n')
|
||||||
String = String.substr(0, String.size()-1);
|
String = String.substr(0, String.size()-1);
|
||||||
OS << String;
|
OS << String;
|
||||||
|
@ -571,7 +571,7 @@ void MCStreamer::EmitCOFFSecRel32(MCSymbol const *Symbol) {
|
|||||||
/// EmitRawText - If this file is backed by an assembly streamer, this dumps
|
/// EmitRawText - If this file is backed by an assembly streamer, this dumps
|
||||||
/// the specified string in the output .s file. This capability is
|
/// the specified string in the output .s file. This capability is
|
||||||
/// indicated by the hasRawTextSupport() predicate.
|
/// indicated by the hasRawTextSupport() predicate.
|
||||||
void MCStreamer::EmitRawText(StringRef String) {
|
void MCStreamer::EmitRawTextImpl(StringRef String) {
|
||||||
errs() << "EmitRawText called on an MCStreamer that doesn't support it, "
|
errs() << "EmitRawText called on an MCStreamer that doesn't support it, "
|
||||||
" something must not be fully mc'ized\n";
|
" something must not be fully mc'ized\n";
|
||||||
abort();
|
abort();
|
||||||
@ -579,8 +579,7 @@ void MCStreamer::EmitRawText(StringRef String) {
|
|||||||
|
|
||||||
void MCStreamer::EmitRawText(const Twine &T) {
|
void MCStreamer::EmitRawText(const Twine &T) {
|
||||||
SmallString<128> Str;
|
SmallString<128> Str;
|
||||||
T.toVector(Str);
|
EmitRawTextImpl(T.toStringRef(Str));
|
||||||
EmitRawText(Str.str());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MCStreamer::EmitFrames(MCAsmBackend *MAB, bool usingCFI) {
|
void MCStreamer::EmitFrames(MCAsmBackend *MAB, bool usingCFI) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user