This is a small step in making this interface compatible with an
bitcode symbol table.
llvm-svn: 284408
return GV && GV->isThreadLocal();
}
- //FIXME: We shouldn't expose this information.
- Expected<const Comdat *> getComdat() const {
+ Expected<StringRef> getComdat() const {
if (!GV)
- return nullptr;
+ return "";
const GlobalObject *GO;
if (auto *GA = dyn_cast<GlobalAlias>(GV)) {
GO = GA->getBaseObject();
} else {
GO = cast<GlobalObject>(GV);
}
- if (GO)
- return GO->getComdat();
- return nullptr;
+ if (const Comdat *C = GO->getComdat())
+ return C->getName();
+ return "";
}
uint64_t getCommonSize() const {
sym.size = 0;
sym.comdat_key = nullptr;
- const Comdat *C = check(Sym.getComdat());
- if (C)
- sym.comdat_key = strdup(C->getName().str().c_str());
+ StringRef C = check(Sym.getComdat());
+ if (!C.empty())
+ sym.comdat_key = strdup(C.str().c_str());
sym.resolution = LDPR_UNKNOWN;
}