mirror of
https://github.com/RPCS3/llvm.git
synced 2025-03-06 01:27:08 +00:00
DebugInfo: GDBIndexEntry*String conversion functions now return const char* for easy llvm::formating
This was previously invoking UB by passing a user-defined type to format. Thanks to Jordan Rose for pointing this out. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@191060 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
c2286720de
commit
ac3f016599
@ -17,7 +17,6 @@
|
|||||||
#define LLVM_SUPPORT_DWARF_H
|
#define LLVM_SUPPORT_DWARF_H
|
||||||
|
|
||||||
#include "llvm/Support/DataTypes.h"
|
#include "llvm/Support/DataTypes.h"
|
||||||
#include "llvm/ADT/StringRef.h"
|
|
||||||
|
|
||||||
namespace llvm {
|
namespace llvm {
|
||||||
|
|
||||||
@ -803,14 +802,14 @@ enum GDBIndexEntryKind {
|
|||||||
GIEK_UNUSED7
|
GIEK_UNUSED7
|
||||||
};
|
};
|
||||||
|
|
||||||
StringRef GDBIndexEntryKindString(GDBIndexEntryKind Kind);
|
const char *GDBIndexEntryKindString(GDBIndexEntryKind Kind);
|
||||||
|
|
||||||
enum GDBIndexEntryLinkage {
|
enum GDBIndexEntryLinkage {
|
||||||
GIEL_EXTERNAL,
|
GIEL_EXTERNAL,
|
||||||
GIEL_STATIC
|
GIEL_STATIC
|
||||||
};
|
};
|
||||||
|
|
||||||
StringRef GDBIndexEntryLinkageString(GDBIndexEntryLinkage Linkage);
|
const char *GDBIndexEntryLinkageString(GDBIndexEntryLinkage Linkage);
|
||||||
|
|
||||||
/// The gnu_pub* kind looks like:
|
/// The gnu_pub* kind looks like:
|
||||||
///
|
///
|
||||||
|
@ -2426,7 +2426,7 @@ void DwarfDebug::emitDebugPubNames(bool GnuStyle) {
|
|||||||
if (GnuStyle) {
|
if (GnuStyle) {
|
||||||
dwarf::PubIndexEntryDescriptor Desc = computeIndexValue(TheCU, Entity);
|
dwarf::PubIndexEntryDescriptor Desc = computeIndexValue(TheCU, Entity);
|
||||||
Asm->OutStreamer.AddComment(
|
Asm->OutStreamer.AddComment(
|
||||||
"Kind: " + dwarf::GDBIndexEntryKindString(Desc.Kind) + ", " +
|
Twine("Kind: ") + dwarf::GDBIndexEntryKindString(Desc.Kind) + ", " +
|
||||||
dwarf::GDBIndexEntryLinkageString(Desc.Linkage));
|
dwarf::GDBIndexEntryLinkageString(Desc.Linkage));
|
||||||
Asm->EmitInt8(Desc.toBits());
|
Asm->EmitInt8(Desc.toBits());
|
||||||
}
|
}
|
||||||
@ -2488,7 +2488,7 @@ void DwarfDebug::emitDebugPubTypes(bool GnuStyle) {
|
|||||||
if (GnuStyle) {
|
if (GnuStyle) {
|
||||||
dwarf::PubIndexEntryDescriptor Desc = computeIndexValue(TheCU, Entity);
|
dwarf::PubIndexEntryDescriptor Desc = computeIndexValue(TheCU, Entity);
|
||||||
Asm->OutStreamer.AddComment(
|
Asm->OutStreamer.AddComment(
|
||||||
"Kind: " + dwarf::GDBIndexEntryKindString(Desc.Kind) + ", " +
|
Twine("Kind: ") + dwarf::GDBIndexEntryKindString(Desc.Kind) + ", " +
|
||||||
dwarf::GDBIndexEntryLinkageString(Desc.Linkage));
|
dwarf::GDBIndexEntryLinkageString(Desc.Linkage));
|
||||||
Asm->EmitInt8(Desc.toBits());
|
Asm->EmitInt8(Desc.toBits());
|
||||||
}
|
}
|
||||||
|
@ -742,7 +742,7 @@ const char *llvm::dwarf::AtomTypeString(unsigned AT) {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
StringRef llvm::dwarf::GDBIndexEntryKindString(GDBIndexEntryKind Kind) {
|
const char *llvm::dwarf::GDBIndexEntryKindString(GDBIndexEntryKind Kind) {
|
||||||
switch (Kind) {
|
switch (Kind) {
|
||||||
case GIEK_NONE:
|
case GIEK_NONE:
|
||||||
return "NONE";
|
return "NONE";
|
||||||
@ -764,7 +764,7 @@ StringRef llvm::dwarf::GDBIndexEntryKindString(GDBIndexEntryKind Kind) {
|
|||||||
llvm_unreachable("Unknown GDBIndexEntryKind value");
|
llvm_unreachable("Unknown GDBIndexEntryKind value");
|
||||||
}
|
}
|
||||||
|
|
||||||
StringRef llvm::dwarf::GDBIndexEntryLinkageString(GDBIndexEntryLinkage Linkage) {
|
const char *llvm::dwarf::GDBIndexEntryLinkageString(GDBIndexEntryLinkage Linkage) {
|
||||||
switch (Linkage) {
|
switch (Linkage) {
|
||||||
case GIEL_EXTERNAL:
|
case GIEL_EXTERNAL:
|
||||||
return "EXTERNAL";
|
return "EXTERNAL";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user