Skip to content

Commit 91d9bcd

Browse files
committed
avoid unnecessary string copies
1 parent 02c9e07 commit 91d9bcd

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

clang-tools-extra/clang-doc/HTMLGenerator.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -492,15 +492,13 @@ genReferencesBlock(const std::vector<Reference> &References,
492492
}
493493
static std::unique_ptr<TagNode>
494494
writeFileDefinition(const ClangDocContext &CDCtx, const Location &L) {
495-
std::string RepositoryUrl = CDCtx.RepositoryUrl.value_or("");
496-
std::string RepositoryLinePrefix = CDCtx.RepositoryLinePrefix.value_or("");
497495

498-
if (!L.IsFileInRootDir && RepositoryUrl.empty())
496+
if (!L.IsFileInRootDir && !CDCtx.RepositoryUrl)
499497
return std::make_unique<TagNode>(
500498
HTMLTag::TAG_P, "Defined at line " + std::to_string(L.LineNumber) +
501499
" of file " + L.Filename);
502500

503-
SmallString<128> FileURL(RepositoryUrl);
501+
SmallString<128> FileURL(CDCtx.RepositoryUrl.value_or(""));
504502
llvm::sys::path::append(
505503
FileURL, llvm::sys::path::Style::posix,
506504
// If we're on Windows, the file name will be in the wrong format, and

0 commit comments

Comments
 (0)