1111#include " llvm/ADT/PointerUnion.h"
1212#include " llvm/ADT/PostOrderIterator.h"
1313#include " llvm/ADT/StringSet.h"
14+ #include " llvm/CAS/CASReference.h"
1415#include " llvm/CASObjectFormats/CASObjectReader.h"
1516#include " llvm/CASObjectFormats/Encoding.h"
1617#include " llvm/CASObjectFormats/ObjectFormatHelpers.h"
@@ -812,7 +813,7 @@ Expected<BlockRef> BlockRef::create(
812813 const ObjectFileSchema &Schema, const jitlink::Block &Block,
813814 function_ref<Expected<Optional<TargetRef>>(const jitlink::Symbol &)>
814815 GetTargetRef,
815- cas::CASID *AbbrevID ) {
816+ cas::ObjectRef *AbbrevRef ) {
816817 Expected<SectionRef> Section = SectionRef::create (Schema, Block.getSection ());
817818 if (!Section)
818819 return Section.takeError ();
@@ -832,7 +833,7 @@ Expected<BlockRef> BlockRef::create(
832833 Expected<BlockDataRef> Data = BlockDataRef::create (Schema, Block, Fixups);
833834 if (!Data)
834835 return Data.takeError ();
835- return createImpl (Schema, *Section, *Data, TIs, Targets, Fixups, AbbrevID ,
836+ return createImpl (Schema, *Section, *Data, TIs, Targets, Fixups, AbbrevRef ,
836837 Block.getSection ().getName () == " __DWARF,__debug_info" );
837838}
838839
@@ -845,7 +846,7 @@ Expected<BlockRef>
845846BlockRef::createImpl (const ObjectFileSchema &Schema, SectionRef Section,
846847 BlockDataRef Data, ArrayRef<TargetInfo> TargetInfo,
847848 ArrayRef<TargetRef> Targets, ArrayRef<Fixup> Fixups,
848- cas::CASID *AbbrevID , bool IsDebugInfoBlock) {
849+ cas::ObjectRef *AbbrevRef , bool IsDebugInfoBlock) {
849850 Expected<Builder> B = Builder::startNode (Schema, KindString);
850851 if (!B)
851852 return B.takeError ();
@@ -904,9 +905,9 @@ BlockRef::createImpl(const ObjectFileSchema &Schema, SectionRef Section,
904905 }
905906
906907 if (IsDebugInfoBlock) {
907- assert (AbbrevID &&
908- " The CAS ID for the abbrev section shouldn't be nullptr" );
909- B->IDs .push_back (*AbbrevID );
908+ assert (AbbrevRef &&
909+ " The CAS Ref for the abbrev section shouldn't be nullptr" );
910+ B->Refs .push_back (*AbbrevRef );
910911 }
911912
912913 return get (B->build (), IsDebugInfoBlock);
@@ -1448,7 +1449,7 @@ class CompileUnitBuilder {
14481449
14491450 // / Create the given symbol and cache it.
14501451 Expected<SymbolRef> createSymbol (const jitlink::Symbol &S,
1451- cas::CASID *AbbrevID = nullptr );
1452+ cas::ObjectRef *AbbrevRef = nullptr );
14521453
14531454 // / Cache the symbol. Asserts that the result is not already cached.
14541455 void cacheSymbol (const jitlink::Symbol &S, SymbolRef Ref);
@@ -1467,12 +1468,12 @@ class CompileUnitBuilder {
14671468
14681469 // / Get or create a block.
14691470 Expected<BlockRef> getOrCreateBlock (const jitlink::Block &B,
1470- cas::CASID *AbbrevID = nullptr );
1471+ cas::ObjectRef *AbbrevRef = nullptr );
14711472
14721473 // / Get or create a symbol definition.
14731474 Expected<SymbolDefinitionRef>
14741475 getOrCreateSymbolDefinition (const jitlink::Symbol &S,
1475- cas::CASID *AbbrevID = nullptr );
1476+ cas::ObjectRef *AbbrevRef = nullptr );
14761477
14771478private:
14781479 // / Guaranteed to be called in post-order. All undefined targets must be
@@ -1564,18 +1565,18 @@ Error CompileUnitBuilder::makeSymbols(const jitlink::LinkGraph &G) {
15641565 llvm::sort (AbbrevSymbols.begin (), AbbrevSymbols.end (),
15651566 compareSymbolBlocksByAddress);
15661567
1567- SmallVector<cas::CASID , 16 > AbbrevIDs ;
1568+ SmallVector<cas::ObjectRef , 16 > AbbrevRefs ;
15681569 for (auto *S : AbbrevSymbols) {
15691570 Expected<SymbolRef> Symbol = createSymbol (*S);
15701571 if (!Symbol)
15711572 return Symbol.takeError ();
1572- AbbrevIDs .push_back (Symbol->getReferenceID (0 ));
1573+ AbbrevRefs .push_back (Symbol->getReference (0 ));
15731574 }
15741575
15751576 unsigned I = 0 ;
15761577 for (auto *S : InfoSymbols) {
1577- Expected<SymbolRef> Symbol =
1578- createSymbol ( *S, AbbrevIDs .size () == 1 ? &AbbrevIDs [0 ] : &AbbrevIDs [I]);
1578+ Expected<SymbolRef> Symbol = createSymbol (
1579+ *S, AbbrevRefs .size () == 1 ? &AbbrevRefs [0 ] : &AbbrevRefs [I]);
15791580 if (!Symbol)
15801581 return Symbol.takeError ();
15811582 I++;
@@ -1593,8 +1594,9 @@ cl::opt<bool> DropLeafSymbolNamesWithDot(
15931594 " drop-leaf-symbol-names-with-dot" ,
15941595 cl::desc (" Drop symbol names with '.' in them from leafs." ), cl::init(true ));
15951596
1596- Expected<SymbolRef> CompileUnitBuilder::createSymbol (const jitlink::Symbol &S,
1597- cas::CASID *AbbrevID) {
1597+ Expected<SymbolRef>
1598+ CompileUnitBuilder::createSymbol (const jitlink::Symbol &S,
1599+ cas::ObjectRef *AbbrevRef) {
15981600 assert (!S.isExternal ());
15991601 assert (!Symbols.lookup (&S).Symbol );
16001602
@@ -1605,7 +1607,7 @@ Expected<SymbolRef> CompileUnitBuilder::createSymbol(const jitlink::Symbol &S,
16051607 bool HasIndirectReference = bool (Name);
16061608
16071609 Expected<SymbolDefinitionRef> Definition =
1608- getOrCreateSymbolDefinition (S, AbbrevID );
1610+ getOrCreateSymbolDefinition (S, AbbrevRef );
16091611 if (!Definition)
16101612 return Definition.takeError ();
16111613
@@ -1685,22 +1687,23 @@ void CompileUnitBuilder::cacheSymbol(const jitlink::Symbol &S, SymbolRef Ref) {
16851687
16861688Expected<SymbolDefinitionRef>
16871689CompileUnitBuilder::getOrCreateSymbolDefinition (const jitlink::Symbol &S,
1688- cas::CASID *AbbrevID ) {
1690+ cas::ObjectRef *AbbrevRef ) {
16891691 // If the assertion in S.getBlock() starts failing, probably LinkGraph added
16901692 // support for aliases to external symbols.
1691- return SymbolDefinitionRef::get (getOrCreateBlock (S.getBlock (), AbbrevID ));
1693+ return SymbolDefinitionRef::get (getOrCreateBlock (S.getBlock (), AbbrevRef ));
16921694}
16931695
1694- Expected<BlockRef> CompileUnitBuilder::getOrCreateBlock (const jitlink::Block &B,
1695- cas::CASID *AbbrevID) {
1696+ Expected<BlockRef>
1697+ CompileUnitBuilder::getOrCreateBlock (const jitlink::Block &B,
1698+ cas::ObjectRef *AbbrevRef) {
16961699 auto Cached = Blocks.find (&B);
16971700 if (Cached != Blocks.end ())
16981701 return Cached->second ;
16991702
17001703 Expected<BlockRef> ExpectedBlock = BlockRef::create (
17011704 Schema, B,
17021705 [&](const jitlink::Symbol &S) { return getOrCreateTarget (S, B); },
1703- AbbrevID );
1706+ AbbrevRef );
17041707 if (!ExpectedBlock)
17051708 return ExpectedBlock.takeError ();
17061709 Cached = Blocks.insert (std::make_pair (&B, *ExpectedBlock)).first ;
@@ -2058,7 +2061,7 @@ DefinedSymbolNodeRef::materialize(const NestedV1ObjectReader &Reader) const {
20582061 bool MergeByContent = Flags.Merge & SymbolRef::M_ByContent;
20592062
20602063 Expected<SectionRef> Section =
2061- SectionRef::get (Definition->getSchema (), Definition->getReferenceID (0 ));
2064+ SectionRef::get (Definition->getSchema (), Definition->getReference (0 ));
20622065 if (!Section)
20632066 return Section.takeError ();
20642067 Expected<NameRef> SectionName = Section->getName ();
0 commit comments