}
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);
}
}
/// 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;
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;
}
/// 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
/// @{
/// 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;
}
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;