llvm.org GIT mirror llvm / 58121fb
Return a StringRef instead of a Comdat*. This is a small step in making this interface compatible with an bitcode symbol table. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@284408 91177308-0d34-0410-b5e6-96231b3b80d8 Rafael Espindola 4 years ago
2 changed file(s) with 8 addition(s) and 9 deletion(s). Raw diff Collapse all Expand all
175175 return GV && GV->isThreadLocal();
176176 }
177177
178 //FIXME: We shouldn't expose this information.
179 Expected<const Comdat *> getComdat() const {
178 Expected<StringRef> getComdat() const {
180179 if (!GV)
181 return nullptr;
180 return "";
182181 const GlobalObject *GO;
183182 if (auto *GA = dyn_cast(GV)) {
184183 GO = GA->getBaseObject();
188187 } else {
189188 GO = cast(GV);
190189 }
191 if (GO)
192 return GO->getComdat();
193 return nullptr;
190 if (const Comdat *C = GO->getComdat())
191 return C->getName();
192 return "";
194193 }
195194
196195 uint64_t getCommonSize() const {
525525
526526 sym.size = 0;
527527 sym.comdat_key = nullptr;
528 const Comdat *C = check(Sym.getComdat());
529 if (C)
530 sym.comdat_key = strdup(C->getName().str().c_str());
528 StringRef C = check(Sym.getComdat());
529 if (!C.empty())
530 sym.comdat_key = strdup(C.str().c_str());
531531
532532 sym.resolution = LDPR_UNKNOWN;
533533 }