================ @@ -342,6 +350,107 @@ bool YAMLProfileReader::mayHaveProfileData(const BinaryFunction &BF) { return false; } +uint64_t YAMLProfileReader::matchWithNameSimilarity(BinaryContext &BC) { + uint64_t MatchedWithNameSimilarity = 0; + ItaniumPartialDemangler ItaniumPartialDemangler; + + // Demangle and derive namespace from function name. + auto DemangleName = [&](std::string &FunctionName) { + StringRef RestoredName = NameResolver::restore(FunctionName); + return demangle(RestoredName); + }; + auto DeriveNameSpace = [&](std::string &DemangledName) { + if (ItaniumPartialDemangler.partialDemangle(DemangledName.c_str())) + return std::string(""); + std::vector<char> Buffer(DemangledName.begin(), DemangledName.end()); + size_t BufferSize = Buffer.size(); + char *NameSpace = ItaniumPartialDemangler.getFunctionDeclContextName( + &Buffer[0], &BufferSize); ---------------- aaupov wrote:
What's bothering me here is the use of BufferSize – it's an output parameter from `getFunctionDecContextName` and yet unused in the construction of output string. https://github.com/llvm/llvm-project/pull/95884 _______________________________________________ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits