Skip to content

Commit 85581ed

Browse files
committed
[clang][clang-doc] fixes bug caused by not passing by reference
1 parent eeb3346 commit 85581ed

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

clang-tools-extra/clang-doc/tool/ClangDocMain.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ std::string GetExecutablePath(const char *Argv0, void *MainAddr) {
137137
return llvm::sys::fs::getMainExecutable(Argv0, MainAddr);
138138
}
139139

140-
void GetAssetFiles(clang::doc::ClangDocContext CDCtx) {
140+
void GetAssetFiles(clang::doc::ClangDocContext &CDCtx) {
141141
std::error_code Code;
142142
for (auto DirIt = llvm::sys::fs::directory_iterator(
143143
std::string(UserAssetPath), Code),
@@ -146,16 +146,17 @@ void GetAssetFiles(clang::doc::ClangDocContext CDCtx) {
146146
llvm::SmallString<128> filePath = llvm::SmallString<128>(DirIt->path());
147147
if (llvm::sys::fs::is_regular_file(filePath)) {
148148
if (filePath.ends_with(".css")) {
149-
CDCtx.UserStylesheets.push_back(std::string(filePath));
149+
CDCtx.UserStylesheets.insert(CDCtx.UserStylesheets.begin(),
150+
std::string(filePath));
150151
} else if (filePath.ends_with(".js")) {
151-
CDCtx.FilesToCopy.push_back(std::string(filePath));
152+
CDCtx.FilesToCopy.emplace_back(filePath.str());
152153
}
153154
}
154155
}
155156
}
156157

157158
void GetDefaultAssetFiles(const char *Argv0,
158-
clang::doc::ClangDocContext CDCtx) {
159+
clang::doc::ClangDocContext &CDCtx) {
159160
void *MainAddr = (void *)(intptr_t)GetExecutablePath;
160161
std::string ClangDocPath = GetExecutablePath(Argv0, MainAddr);
161162
llvm::SmallString<128> NativeClangDocPath;

0 commit comments

Comments
 (0)