[llvm] r238708 - Rename HasData to IsRegistered.

Rafael Espindola rafael.espindola at gmail.com
Sun May 31 18:52:18 PDT 2015


Author: rafael
Date: Sun May 31 20:52:18 2015
New Revision: 238708

URL: http://llvm.org/viewvc/llvm-project?rev=238708&view=rev
Log:
Rename HasData to IsRegistered.

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.

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

Modified: llvm/trunk/include/llvm/MC/MCAssembler.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCAssembler.h?rev=238708&r1=238707&r2=238708&view=diff
==============================================================================
--- llvm/trunk/include/llvm/MC/MCAssembler.h (original)
+++ llvm/trunk/include/llvm/MC/MCAssembler.h Sun May 31 20:52:18 2015
@@ -911,11 +911,11 @@ public:
   }
 
   void registerSymbol(const MCSymbol &Symbol, bool *Created = nullptr) {
-    bool New = !Symbol.hasData();
+    bool New = !Symbol.isRegistered();
     if (Created)
       *Created = New;
     if (New) {
-      Symbol.initializeData();
+      Symbol.setIsRegistered(true);
       Symbols.push_back(&Symbol);
     }
   }

Modified: llvm/trunk/include/llvm/MC/MCSymbol.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCSymbol.h?rev=238708&r1=238707&r2=238708&view=diff
==============================================================================
--- llvm/trunk/include/llvm/MC/MCSymbol.h (original)
+++ llvm/trunk/include/llvm/MC/MCSymbol.h Sun May 31 20:52:18 2015
@@ -63,7 +63,7 @@ class MCSymbol {
   /// 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;
@@ -99,7 +99,7 @@ private: // MCContext creates and unique
   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;
   }
 
@@ -115,14 +115,8 @@ public:
   /// 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
   /// @{
@@ -201,13 +195,11 @@ public:
 
   /// 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 {
-    assert(HasData && "Uninitialized symbol data");
     Index = Value;
   }
 

Modified: llvm/trunk/lib/MC/MCObjectStreamer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCObjectStreamer.cpp?rev=238708&r1=238707&r2=238708&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCObjectStreamer.cpp (original)
+++ llvm/trunk/lib/MC/MCObjectStreamer.cpp Sun May 31 20:52:18 2015
@@ -57,10 +57,6 @@ void MCObjectStreamer::flushPendingLabel
 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;

Modified: llvm/trunk/lib/MC/WinCOFFObjectWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/WinCOFFObjectWriter.cpp?rev=238708&r1=238707&r2=238708&view=diff
==============================================================================
--- llvm/trunk/lib/MC/WinCOFFObjectWriter.cpp (original)
+++ llvm/trunk/lib/MC/WinCOFFObjectWriter.cpp Sun May 31 20:52:18 2015
@@ -706,7 +706,7 @@ void WinCOFFObjectWriter::RecordRelocati
 
   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");





More information about the llvm-commits mailing list