From 383cbff0311237bfd60daaa77d07bc9785a07ee8 Mon Sep 17 00:00:00 2001 From: Daniel Dunbar Date: Wed, 26 Aug 2009 09:16:57 +0000 Subject: [PATCH] llvm-mc: Change MCContext value table to take const MCSymbol*s. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80079 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/MC/MCContext.h | 16 +++++++--------- lib/MC/MCContext.cpp | 8 ++++---- 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/include/llvm/MC/MCContext.h b/include/llvm/MC/MCContext.h index 082b515a2e1..28436f052d9 100644 --- a/include/llvm/MC/MCContext.h +++ b/include/llvm/MC/MCContext.h @@ -36,7 +36,7 @@ namespace llvm { /// SymbolValues - Bindings of symbols to values. // // FIXME: Is there a good reason to not just put this in the MCSymbol? - DenseMap SymbolValues; + DenseMap SymbolValues; /// Allocator - Allocator object used for creating machine code objects. /// @@ -70,17 +70,15 @@ namespace llvm { /// LookupSymbol - Get the symbol for @param Name, or null. MCSymbol *LookupSymbol(const StringRef &Name) const; - /// ClearSymbolValue - Erase a value binding for @param Symbol, if one - /// exists. - void ClearSymbolValue(MCSymbol *Symbol); + /// ClearSymbolValue - Erase a value binding for @arg Symbol, if one exists. + void ClearSymbolValue(const MCSymbol *Symbol); - /// SetSymbolValue - Set the value binding for @param Symbol to @param - /// Value. - void SetSymbolValue(MCSymbol *Symbol, const MCValue &Value); + /// SetSymbolValue - Set the value binding for @arg Symbol to @arg Value. + void SetSymbolValue(const MCSymbol *Symbol, const MCValue &Value); - /// GetSymbolValue - Return the current value for @param Symbol, or null if + /// GetSymbolValue - Return the current value for @arg Symbol, or null if /// none exists. - const MCValue *GetSymbolValue(MCSymbol *Symbol) const; + const MCValue *GetSymbolValue(const MCSymbol *Symbol) const; void *Allocate(unsigned Size, unsigned Align = 8) { return Allocator.Allocate(Size, Align); diff --git a/lib/MC/MCContext.cpp b/lib/MC/MCContext.cpp index 061d7c2498e..5a3e7f661ec 100644 --- a/lib/MC/MCContext.cpp +++ b/lib/MC/MCContext.cpp @@ -54,16 +54,16 @@ MCSymbol *MCContext::LookupSymbol(const StringRef &Name) const { return Symbols.lookup(Name); } -void MCContext::ClearSymbolValue(MCSymbol *Sym) { +void MCContext::ClearSymbolValue(const MCSymbol *Sym) { SymbolValues.erase(Sym); } -void MCContext::SetSymbolValue(MCSymbol *Sym, const MCValue &Value) { +void MCContext::SetSymbolValue(const MCSymbol *Sym, const MCValue &Value) { SymbolValues[Sym] = Value; } -const MCValue *MCContext::GetSymbolValue(MCSymbol *Sym) const { - DenseMap::iterator it = SymbolValues.find(Sym); +const MCValue *MCContext::GetSymbolValue(const MCSymbol *Sym) const { + DenseMap::iterator it = SymbolValues.find(Sym); if (it == SymbolValues.end()) return 0;