summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-08-13 00:21:53 +0000
committerChris Lattner <sabre@nondot.org>2009-08-13 00:21:53 +0000
commitb691316838646a0b6ea9743fe23683e650740290 (patch)
tree84c4255c300b209e739b6845cb78db5cf83c03e4
parentc0741ebb3a2d8fa5e69796f8e47253ef4f272033 (diff)
downloadbcm5719-llvm-b691316838646a0b6ea9743fe23683e650740290.tar.gz
bcm5719-llvm-b691316838646a0b6ea9743fe23683e650740290.zip
add some comments: MCContext owns the MCSections, but it bump pointer allocates
them, so it doesn't have to explicitly free them. llvm-svn: 78870
-rw-r--r--llvm/include/llvm/MC/MCContext.h5
-rw-r--r--llvm/lib/MC/MCContext.cpp2
-rw-r--r--llvm/lib/Target/TargetLoweringObjectFile.cpp2
3 files changed, 5 insertions, 4 deletions
diff --git a/llvm/include/llvm/MC/MCContext.h b/llvm/include/llvm/MC/MCContext.h
index f0f5e155553..adf380472a1 100644
--- a/llvm/include/llvm/MC/MCContext.h
+++ b/llvm/include/llvm/MC/MCContext.h
@@ -20,7 +20,9 @@ namespace llvm {
class MCSymbol;
class StringRef;
- /// MCContext - Context object for machine code objects.
+ /// MCContext - Context object for machine code objects. This class owns all
+ /// of the sections that it creates.
+ ///
class MCContext {
MCContext(const MCContext&); // DO NOT IMPLEMENT
MCContext &operator=(const MCContext&); // DO NOT IMPLEMENT
@@ -49,7 +51,6 @@ namespace llvm {
/// null if it doesn't exist.
MCSection *GetSection(const StringRef &Name) const;
-
void SetSection(const StringRef &Name, MCSection *S) {
MCSection *&Entry = Sections[Name];
assert(Entry == 0 && "Multiple sections with the same name created");
diff --git a/llvm/lib/MC/MCContext.cpp b/llvm/lib/MC/MCContext.cpp
index e6fb5c8809b..63338353a1f 100644
--- a/llvm/lib/MC/MCContext.cpp
+++ b/llvm/lib/MC/MCContext.cpp
@@ -18,6 +18,8 @@ MCContext::MCContext() {
}
MCContext::~MCContext() {
+ // NOTE: The sections are all allocated out of a bump pointer allocator,
+ // we don't need to free them here.
}
MCSection *MCContext::GetSection(const StringRef &Name) const {
diff --git a/llvm/lib/Target/TargetLoweringObjectFile.cpp b/llvm/lib/Target/TargetLoweringObjectFile.cpp
index 094e837f6f9..e7680c8a877 100644
--- a/llvm/lib/Target/TargetLoweringObjectFile.cpp
+++ b/llvm/lib/Target/TargetLoweringObjectFile.cpp
@@ -708,8 +708,6 @@ getExplicitSectionGlobal(const GlobalValue *GV, SectionKind Kind,
" section specifier");
}
-
-
return S;
}
OpenPOWER on IntegriCloud