Rename HasData to IsRegistered.
authorRafael Espindola <rafael.espindola@gmail.com>
Mon, 1 Jun 2015 01:52:18 +0000 (01:52 +0000)
committerRafael Espindola <rafael.espindola@gmail.com>
Mon, 1 Jun 2015 01:52:18 +0000 (01:52 +0000)
There is no MCSectionData, so the old name is now meaningless.

Also remove some asserts/checks that were there just because the information
they used was in MCSectionData.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238708 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/MC/MCAssembler.h
include/llvm/MC/MCSymbol.h
lib/MC/MCObjectStreamer.cpp
lib/MC/WinCOFFObjectWriter.cpp

index 6b6e0dc19c940a6708513898a79ce083b0ab77b0..d335db92d0cd84690fd2a651c25866a477a129a7 100644 (file)
@@ -911,11 +911,11 @@ public:
   }
 
   void registerSymbol(const MCSymbol &Symbol, bool *Created = nullptr) {
   }
 
   void registerSymbol(const MCSymbol &Symbol, bool *Created = nullptr) {
-    bool New = !Symbol.hasData();
+    bool New = !Symbol.isRegistered();
     if (Created)
       *Created = New;
     if (New) {
     if (Created)
       *Created = New;
     if (New) {
-      Symbol.initializeData();
+      Symbol.setIsRegistered(true);
       Symbols.push_back(&Symbol);
     }
   }
       Symbols.push_back(&Symbol);
     }
   }
index 355ed85deb5b683271396c07e6b76d67fed3d9bc..3194ed1863b2153c24605298aca9040181789d55 100644 (file)
@@ -63,7 +63,7 @@ class MCSymbol {
   /// IsUsed - True if this symbol has been used.
   mutable unsigned IsUsed : 1;
 
   /// IsUsed - True if this symbol has been used.
   mutable unsigned IsUsed : 1;
 
-  mutable bool HasData : 1;
+  mutable bool IsRegistered : 1;
 
   /// Index field, for use by the object file implementation.
   mutable uint32_t Index = 0;
 
   /// Index field, for use by the object file implementation.
   mutable uint32_t Index = 0;
@@ -99,7 +99,7 @@ private: // MCContext creates and uniques these.
   friend class MCContext;
   MCSymbol(const StringMapEntry<bool> *Name, bool isTemporary)
       : Name(Name), Section(nullptr), Value(nullptr), IsTemporary(isTemporary),
   friend class MCContext;
   MCSymbol(const StringMapEntry<bool> *Name, bool isTemporary)
       : Name(Name), Section(nullptr), Value(nullptr), IsTemporary(isTemporary),
-        IsRedefinable(false), IsUsed(false), HasData(false) {
+        IsRedefinable(false), IsUsed(false), IsRegistered(false) {
     Offset = 0;
   }
 
     Offset = 0;
   }
 
@@ -115,14 +115,8 @@ public:
   /// getName - Get the symbol name.
   StringRef getName() const { return Name ? Name->first() : ""; }
 
   /// getName - Get the symbol name.
   StringRef getName() const { return Name ? Name->first() : ""; }
 
-  bool hasData() const { return HasData; }
-
-  /// Initialize symbol data.
-  ///
-  /// Nothing really to do here, but this is enables an assertion that \a
-  /// MCAssembler::getOrCreateSymbolData() has actually been called before
-  /// anyone calls \a getData().
-  void initializeData() const { HasData = true; }
+  bool isRegistered() const { return IsRegistered; }
+  void setIsRegistered(bool Value) const { IsRegistered = Value; }
 
   /// \name Accessors
   /// @{
 
   /// \name Accessors
   /// @{
@@ -201,13 +195,11 @@ public:
 
   /// Get the (implementation defined) index.
   uint32_t getIndex() const {
 
   /// Get the (implementation defined) index.
   uint32_t getIndex() const {
-    assert(HasData && "Uninitialized symbol data");
     return Index;
   }
 
   /// Set the (implementation defined) index.
   void setIndex(uint32_t Value) const {
     return Index;
   }
 
   /// Set the (implementation defined) index.
   void setIndex(uint32_t Value) const {
-    assert(HasData && "Uninitialized symbol data");
     Index = Value;
   }
 
     Index = Value;
   }
 
index a17e9ea01d55435dac43423cb0a96ac8b0151c91..6de02bcb02d858417f90a6d88ad5f502a9dc602d 100644 (file)
@@ -57,10 +57,6 @@ void MCObjectStreamer::flushPendingLabels(MCFragment *F, uint64_t FOffset) {
 bool MCObjectStreamer::emitAbsoluteSymbolDiff(const MCSymbol *Hi,
                                               const MCSymbol *Lo,
                                               unsigned Size) {
 bool MCObjectStreamer::emitAbsoluteSymbolDiff(const MCSymbol *Hi,
                                               const MCSymbol *Lo,
                                               unsigned Size) {
-  // Must have symbol data.
-  if (!Hi->hasData() || !Lo->hasData())
-    return false;
-
   // Must both be assigned to the same (valid) fragment.
   if (!Hi->getFragment() || Hi->getFragment() != Lo->getFragment())
     return false;
   // Must both be assigned to the same (valid) fragment.
   if (!Hi->getFragment() || Hi->getFragment() != Lo->getFragment())
     return false;
index a202fcd0f48a64c20c2abfbfd2b394c1ccfa1663..d1453fdaad953e814d607bf7f01b0f6fd11adfe2 100644 (file)
@@ -706,7 +706,7 @@ void WinCOFFObjectWriter::RecordRelocation(
 
   const MCSymbol &Symbol = Target.getSymA()->getSymbol();
   const MCSymbol &A = Symbol;
 
   const MCSymbol &Symbol = Target.getSymA()->getSymbol();
   const MCSymbol &A = Symbol;
-  if (!A.hasData())
+  if (!A.isRegistered())
     Asm.getContext().reportFatalError(Fixup.getLoc(),
                                       Twine("symbol '") + A.getName() +
                                           "' can not be undefined");
     Asm.getContext().reportFatalError(Fixup.getLoc(),
                                       Twine("symbol '") + A.getName() +
                                           "' can not be undefined");