MCPcopy Create free account
hub / github.com/GANGE666/xVMP / recordValue

Method recordValue

src/lib/Bitcode/Reader/BitcodeReader.cpp:1852–1876  ·  view source on GitHub ↗

Associate a value with its name from the given index in the provided record.

Source from the content-addressed store, hash-verified

1850
1851/// Associate a value with its name from the given index in the provided record.
1852Expected<Value *> BitcodeReader::recordValue(SmallVectorImpl<uint64_t> &Record,
1853 unsigned NameIndex, Triple &TT) {
1854 SmallString<128> ValueName;
1855 if (convertToString(Record, NameIndex, ValueName))
1856 return error("Invalid record");
1857 unsigned ValueID = Record[0];
1858 if (ValueID >= ValueList.size() || !ValueList[ValueID])
1859 return error("Invalid record");
1860 Value *V = ValueList[ValueID];
1861
1862 StringRef NameStr(ValueName.data(), ValueName.size());
1863 if (NameStr.find_first_of(0) != StringRef::npos)
1864 return error("Invalid value name");
1865 V->setName(NameStr);
1866 auto *GO = dyn_cast<GlobalObject>(V);
1867 if (GO) {
1868 if (GO->getComdat() == reinterpret_cast<Comdat *>(1)) {
1869 if (TT.supportsCOMDAT())
1870 GO->setComdat(TheModule->getOrInsertComdat(V->getName()));
1871 else
1872 GO->setComdat(nullptr);
1873 }
1874 }
1875 return V;
1876}
1877
1878/// Helper to note and return the current location, and jump to the given
1879/// offset.

Callers

nothing calls this directly

Calls 11

getOrInsertComdatMethod · 0.80
convertToStringFunction · 0.70
errorFunction · 0.70
sizeMethod · 0.45
dataMethod · 0.45
find_first_ofMethod · 0.45
setNameMethod · 0.45
getComdatMethod · 0.45
supportsCOMDATMethod · 0.45
setComdatMethod · 0.45
getNameMethod · 0.45

Tested by

no test coverage detected