summaryrefslogtreecommitdiff
path: root/include/llvm/MC/MCSection.h
diff options
context:
space:
mode:
authorJeffrey Yasskin <jyasskin@google.com>2010-03-22 23:26:12 +0000
committerJeffrey Yasskin <jyasskin@google.com>2010-03-22 23:26:12 +0000
commit1ccd91a5b156ff8b415806b0d60fd7c302d62693 (patch)
treeb0850a0d4176e01e042e509dcebb62e68160e3b4 /include/llvm/MC/MCSection.h
parent3f4dcd92daef80f87919507b6baf2a97d4bfaa2e (diff)
downloadllvm-1ccd91a5b156ff8b415806b0d60fd7c302d62693.tar.gz
llvm-1ccd91a5b156ff8b415806b0d60fd7c302d62693.tar.bz2
llvm-1ccd91a5b156ff8b415806b0d60fd7c302d62693.tar.xz
Put MCSectionCOFF::Name into the MCContext instead of leaking it.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@99231 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/MC/MCSection.h')
-rw-r--r--include/llvm/MC/MCSection.h7
1 files changed, 3 insertions, 4 deletions
diff --git a/include/llvm/MC/MCSection.h b/include/llvm/MC/MCSection.h
index 3d8815a778..4a1c46ccb9 100644
--- a/include/llvm/MC/MCSection.h
+++ b/include/llvm/MC/MCSection.h
@@ -42,9 +42,8 @@ namespace llvm {
};
class MCSectionCOFF : public MCSection {
- // FIXME: This memory is leaked because MCSectionCOFF is bump pointer
- // allocated and this never gets freed.
- std::string Name;
+ // The memory for this string is stored in the same MCContext as *this.
+ StringRef Name;
/// IsDirective - This is true if the section name is a directive, not
/// something that should be printed with ".section".
@@ -61,7 +60,7 @@ namespace llvm {
static MCSectionCOFF *Create(StringRef Name, bool IsDirective,
SectionKind K, MCContext &Ctx);
- const std::string &getName() const { return Name; }
+ StringRef getName() const { return Name; }
bool isDirective() const { return IsDirective; }
virtual void PrintSwitchToSection(const MCAsmInfo &MAI,