From 74130c075012528462e19e1eefcec43bbfe6e0c0 Mon Sep 17 00:00:00 2001 From: Mehdi Amini Date: Sat, 1 Oct 2016 05:57:50 +0000 Subject: [PATCH] DIFlags: use StringRef instead of raw pointer (NFC) llvm-svn: 283012 --- include/llvm/IR/DebugInfoMetadata.h | 2 +- lib/IR/AsmWriter.cpp | 4 ++-- lib/IR/DebugInfoMetadata.cpp | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/include/llvm/IR/DebugInfoMetadata.h b/include/llvm/IR/DebugInfoMetadata.h index 84763f48dfc..9b61da3387f 100644 --- a/include/llvm/IR/DebugInfoMetadata.h +++ b/include/llvm/IR/DebugInfoMetadata.h @@ -183,7 +183,7 @@ public: }; static DIFlags getFlag(StringRef Flag); - static const char *getFlagString(DIFlags Flag); + static StringRef getFlagString(DIFlags Flag); /// \brief Split up a flags bitfield. /// diff --git a/lib/IR/AsmWriter.cpp b/lib/IR/AsmWriter.cpp index 0734a3772e3..fa67425bc6c 100644 --- a/lib/IR/AsmWriter.cpp +++ b/lib/IR/AsmWriter.cpp @@ -1488,8 +1488,8 @@ void MDFieldPrinter::printDIFlags(StringRef Name, DINode::DIFlags Flags) { FieldSeparator FlagsFS(" | "); for (auto F : SplitFlags) { - const char *StringF = DINode::getFlagString(F); - assert(StringF && "Expected valid flag"); + auto StringF = DINode::getFlagString(F); + assert(!StringF.empty() && "Expected valid flag"); Out << FlagsFS << StringF; } if (Extra || SplitFlags.empty()) diff --git a/lib/IR/DebugInfoMetadata.cpp b/lib/IR/DebugInfoMetadata.cpp index 74f8ce84db0..96f28dd19c5 100644 --- a/lib/IR/DebugInfoMetadata.cpp +++ b/lib/IR/DebugInfoMetadata.cpp @@ -72,7 +72,7 @@ DINode::DIFlags DINode::getFlag(StringRef Flag) { .Default(DINode::FlagZero); } -const char *DINode::getFlagString(DIFlags Flag) { +StringRef DINode::getFlagString(DIFlags Flag) { switch (Flag) { #define HANDLE_DI_FLAG(ID, NAME) \ case Flag##NAME: \