Removing LLVM_DELETED_FUNCTION, as MSVC 2012 was the last reason for requiring the...
[oota-llvm.git] / include / llvm / MC / MCSymbol.h
index ead9bd9f4bc8b7b4efac34e9e646d23257ad618d..53443b01d96d5d3f2fee626071d845562cda41e2 100644 (file)
@@ -53,6 +53,9 @@ namespace llvm {
     /// "Lfoo" or ".foo".
     unsigned IsTemporary : 1;
 
+    /// \brief True if this symbol can be redefined.
+    unsigned IsRedefinable : 1;
+
     /// IsUsed - True if this symbol has been used.
     mutable unsigned IsUsed : 1;
 
@@ -60,11 +63,11 @@ namespace llvm {
     friend class MCExpr;
     friend class MCContext;
     MCSymbol(StringRef name, bool isTemporary)
-      : Name(name), Section(0), Value(0),
-        IsTemporary(isTemporary), IsUsed(false) {}
+      : Name(name), Section(nullptr), Value(nullptr),
+        IsTemporary(isTemporary), IsRedefinable(false), IsUsed(false) {}
 
-    MCSymbol(const MCSymbol&) LLVM_DELETED_FUNCTION;
-    void operator=(const MCSymbol&) LLVM_DELETED_FUNCTION;
+    MCSymbol(const MCSymbol&) = delete;
+    void operator=(const MCSymbol&) = delete;
   public:
     /// getName - Get the symbol name.
     StringRef getName() const { return Name; }
@@ -79,6 +82,19 @@ namespace llvm {
     bool isUsed() const { return IsUsed; }
     void setUsed(bool Value) const { IsUsed = Value; }
 
+    /// \brief Check if this symbol is redefinable.
+    bool isRedefinable() const { return IsRedefinable; }
+    /// \brief Mark this symbol as redefinable.
+    void setRedefinable(bool Value) { IsRedefinable = Value; }
+    /// \brief Prepare this symbol to be redefined.
+    void redefineIfPossible() {
+      if (IsRedefinable) {
+        Value = nullptr;
+        Section = nullptr;
+        IsRedefinable = false;
+      }
+    }
+
     /// @}
     /// @name Associated Sections
     /// @{
@@ -87,7 +103,7 @@ namespace llvm {
     ///
     /// Defined symbols are either absolute or in some section.
     bool isDefined() const {
-      return Section != 0;
+      return Section != nullptr;
     }
 
     /// isInSection - Check if this symbol is defined in some section (i.e., it
@@ -113,12 +129,12 @@ namespace llvm {
       return *Section;
     }
 
-    /// setSection - Mark the symbol as defined in the section \arg S.
+    /// setSection - Mark the symbol as defined in the section \p S.
     void setSection(const MCSection &S) { Section = &S; }
 
     /// setUndefined - Mark the symbol as undefined.
     void setUndefined() {
-      Section = 0;
+      Section = nullptr;
     }
 
     /// setAbsolute - Mark the symbol as absolute.
@@ -130,7 +146,7 @@ namespace llvm {
 
     /// isVariable - Check if this is a variable symbol.
     bool isVariable() const {
-      return Value != 0;
+      return Value != nullptr;
     }
 
     /// getVariableValue() - Get the value for variable symbols.
@@ -141,7 +157,7 @@ namespace llvm {
     }
 
     // AliasedSymbol() - If this is an alias (a = b), return the symbol
-    // we ultimately point to. For a non alias, this just returns the symbol
+    // we ultimately point to. For a non-alias, this just returns the symbol
     // itself.
     const MCSymbol &AliasedSymbol() const;
 
@@ -149,7 +165,7 @@ namespace llvm {
 
     /// @}
 
-    /// print - Print the value to the stream \arg OS.
+    /// print - Print the value to the stream \p OS.
     void print(raw_ostream &OS) const;
 
     /// dump - Print the value to stderr.