aboutsummaryrefslogtreecommitdiff
path: root/include/llvm
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-07-31 16:43:49 +0000
committerChris Lattner <sabre@nondot.org>2009-07-31 16:43:49 +0000
commitfcdbf4ecc33d6d9a197c88ac06218741a9228375 (patch)
tree7f0fda95732aa8d3fd7e751f8ca5825313203209 /include/llvm
parent82987bfe9b6ae85a8836c9f2d2e9f0ef9866edb1 (diff)
create sections with MCSection::Create instead of Context->getOrCreateSection.
This is needed to allow polymorphic sections. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77680 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm')
-rw-r--r--include/llvm/MC/MCContext.h6
-rw-r--r--include/llvm/MC/MCSection.h6
2 files changed, 7 insertions, 5 deletions
diff --git a/include/llvm/MC/MCContext.h b/include/llvm/MC/MCContext.h
index 24dbc40479..a8187cce6f 100644
--- a/include/llvm/MC/MCContext.h
+++ b/include/llvm/MC/MCContext.h
@@ -42,12 +42,14 @@ namespace llvm {
/// objects.
BumpPtrAllocator Allocator;
+ friend class MCSection;
public:
MCContext();
~MCContext();
- /// GetSection - Get or create a new section with the given @param Name.
- MCSection *GetSection(const StringRef &Name);
+ /// GetSection - Look up a section with the given @param Name, returning
+ /// null if it doesn't exist.
+ MCSection *GetSection(const StringRef &Name) const;
/// CreateSymbol - Create a new symbol with the specified @param Name.
///
diff --git a/include/llvm/MC/MCSection.h b/include/llvm/MC/MCSection.h
index 48ffa2facd..024bc6c33a 100644
--- a/include/llvm/MC/MCSection.h
+++ b/include/llvm/MC/MCSection.h
@@ -25,13 +25,13 @@ namespace llvm {
class MCSection {
std::string Name;
private:
- friend class MCContext;
- MCSection(const StringRef &_Name) : Name(_Name) {}
-
MCSection(const MCSection&); // DO NOT IMPLEMENT
void operator=(const MCSection&); // DO NOT IMPLEMENT
+ MCSection(const StringRef &_Name, MCContext &Ctx);
public:
+ static MCSection *Create(const StringRef &_Name, MCContext &Ctx);
+
const std::string &getName() const { return Name; }
};