================ @@ -516,15 +518,16 @@ writeFileDefinition(const Location &L, std::make_unique<TagNode>(HTMLTag::TAG_A, std::to_string(L.LineNumber)); // The links to a specific line in the source code use the github / // googlesource notation so it won't work for all hosting pages. - // FIXME: we probably should have a configuration setting for line number - // rendering in the HTML. For example, GitHub uses #L22, while googlesource - // uses #22 for line numbers. - LocNumberNode->Attributes.emplace_back( - "href", (FileURL + "#" + std::to_string(L.LineNumber)).str()); + std::string LineAnchor = + formatv("#{0}{1}", RepositoryLinePrefix, L.LineNumber); ---------------- ilovepi wrote:
If you think its too complex then factor it into a helper, but we want to avoid all these heap allocations and copies. plus, I don't think its too complex to just write out the format string and add one additional string. In fact memory is still a big bottleneck for clang-doc. It's gotten much better, but its still a concern, and we need to be cognizant of that as we're modifying the codebase. If we were really being serious about removing allocations, we'd make the interface for the attribute constructor take a Twine so we can have efficient concatenation. https://llvm.org/docs/ProgrammersManual.html#the-twine-class https://github.com/llvm/llvm-project/pull/131280 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits