================ @@ -560,6 +602,28 @@ Error InstrProfSymtab::addFuncWithName(Function &F, StringRef PGOFuncName) { return Error::success(); } +uint64_t InstrProfSymtab::getVTableHashFromAddress(uint64_t Address) { + finalizeSymtab(); ---------------- minglotus-6 wrote:
Added a comment. Thinking about it, there might be a way to call 'finalize' once to make the code simpler (illustrated below). If the overall idea looks good, I could work on a separate change to refactor existing code. 'Symtab' implementation is something like this ``` Status Symtab::addElement() { if (finalized) return error("symtab cannot have new element after being finalized"); // add element implementation } void Symtab::finalize() { llvm::sort(vectors); finalized=true; } ``` And user code is like ``` auto symtab = createSymtab(); for (auto element : elements) { symtab.addElement(element); } symtab.finalize(); auto result = symtab.getFuncHashFromAddress(addr); ... ``` https://github.com/llvm/llvm-project/pull/66825 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits