Changeset View
Changeset View
Standalone View
Standalone View
llvm/include/llvm/MC/MCSymbolXCOFF.h
Show All 29 Lines | if (Name.back() == ']') { | ||||
std::tie(Lhs, Rhs) = Name.rsplit('['); | std::tie(Lhs, Rhs) = Name.rsplit('['); | ||||
assert(!Rhs.empty() && "Invalid SMC format in XCOFF symbol."); | assert(!Rhs.empty() && "Invalid SMC format in XCOFF symbol."); | ||||
return Lhs; | return Lhs; | ||||
} | } | ||||
return Name; | return Name; | ||||
} | } | ||||
void setStorageClass(XCOFF::StorageClass SC) { | void setStorageClass(XCOFF::StorageClass SC) { | ||||
assert((!StorageClass.hasValue() || StorageClass.getValue() == SC) && | |||||
Xiangling_L: It looks like this assertion is still useful to prevent someone from setting SC twice or… | |||||
If I understand correctly, we would actually set MCSectionXCOFF/csect's SC twice in some scenarios. First time being the default HIDE_EXT. Second time, when someone called emitLinkage on a csect's qualname symbol (and we could set it to C_EXT at that time. jasonliu: If I understand correctly, we would actually set MCSectionXCOFF/csect's SC twice in some… | |||||
yes, we need to set twice as jason explain DiggerLin: yes, we need to set twice as jason explain | |||||
"Redefining StorageClass of XCOFF MCSymbol."); | |||||
StorageClass = SC; | StorageClass = SC; | ||||
}; | }; | ||||
XCOFF::StorageClass getStorageClass() const { | XCOFF::StorageClass getStorageClass() const { | ||||
assert(StorageClass.hasValue() && | assert(StorageClass.hasValue() && | ||||
"StorageClass not set on XCOFF MCSymbol."); | "StorageClass not set on XCOFF MCSymbol."); | ||||
return StorageClass.getValue(); | return StorageClass.getValue(); | ||||
} | } | ||||
StringRef getUnqualifiedName() const { return getUnqualifiedName(getName()); } | StringRef getUnqualifiedName() const { return getUnqualifiedName(getName()); } | ||||
bool hasRepresentedCsectSet() const { return RepresentedCsect != nullptr; } | |||||
MCSectionXCOFF *getRepresentedCsect() const; | MCSectionXCOFF *getRepresentedCsect() const; | ||||
Not Done ReplyInline Actionsnit: For the implementation of getRepresentedCsect and setRepresentedCsect, please remove || RepresentedCsect->getCSectType() == XCOFF::XTY_ER and || C->getCSectType() == XCOFF::XTY_ER from their asserts, as right now every RepresentedCsect symbol must be a qualname. jasonliu: nit: For the implementation of `getRepresentedCsect` and `setRepresentedCsect`, please remove… | |||||
void setRepresentedCsect(MCSectionXCOFF *C); | void setRepresentedCsect(MCSectionXCOFF *C); | ||||
void setVisibilityType(XCOFF::VisibilityType SVT) { VisibilityType = SVT; }; | void setVisibilityType(XCOFF::VisibilityType SVT) { VisibilityType = SVT; }; | ||||
XCOFF::VisibilityType getVisibilityType() const { return VisibilityType; } | XCOFF::VisibilityType getVisibilityType() const { return VisibilityType; } | ||||
bool hasRename() const { return !SymbolTableName.empty(); } | bool hasRename() const { return !SymbolTableName.empty(); } | ||||
Show All 19 Lines |
It looks like this assertion is still useful to prevent someone from setting SC twice or setting other SC for a same symbol accidentally, if we don't need to set a default SC as I mentioned above.