Skip to content
This repository was archived by the owner on Nov 1, 2021. It is now read-only.

Commit 6bd17d2

Browse files
committed
Make use of const-correct ParseCommandLineOptions
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150000 91177308-0d34-0410-b5e6-96231b3b80d8
1 parent 52aabaf commit 6bd17d2

File tree

4 files changed

+5
-6
lines changed

4 files changed

+5
-6
lines changed

lib/CodeGen/BackendUtil.cpp

+2-3
Original file line numberDiff line numberDiff line change
@@ -246,8 +246,7 @@ bool EmitAssemblyHelper::AddEmitPasses(BackendAction Action,
246246
CM = llvm::CodeModel::Default;
247247
}
248248

249-
std::vector<const char *> BackendArgs;
250-
BackendArgs.reserve(16);
249+
SmallVector<const char *, 16> BackendArgs;
251250
BackendArgs.push_back("clang"); // Fake program name.
252251
if (!CodeGenOpts.DebugPass.empty()) {
253252
BackendArgs.push_back("-debug-pass");
@@ -265,7 +264,7 @@ bool EmitAssemblyHelper::AddEmitPasses(BackendAction Action,
265264
BackendArgs.push_back("-global-merge=false");
266265
BackendArgs.push_back(0);
267266
llvm::cl::ParseCommandLineOptions(BackendArgs.size() - 1,
268-
const_cast<char **>(&BackendArgs[0]));
267+
BackendArgs.data());
269268

270269
std::string FeaturesStr;
271270
if (TargetOpts.Features.size()) {

lib/FrontendTool/ExecuteCompilerInvocation.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ bool clang::ExecuteCompilerInvocation(CompilerInstance *Clang) {
157157
for (unsigned i = 0; i != NumArgs; ++i)
158158
Args[i + 1] = Clang->getFrontendOpts().LLVMArgs[i].c_str();
159159
Args[NumArgs + 1] = 0;
160-
llvm::cl::ParseCommandLineOptions(NumArgs + 1, const_cast<char **>(Args));
160+
llvm::cl::ParseCommandLineOptions(NumArgs + 1, Args);
161161
}
162162

163163
// Honor -analyzer-checker-help.

tools/arcmt-test/arcmt-test.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,7 @@ int main(int argc, const char **argv) {
353353
if (StringRef(argv[optargc]) == "--args")
354354
break;
355355
}
356-
llvm::cl::ParseCommandLineOptions(optargc, const_cast<char **>(argv), "arcmt-test");
356+
llvm::cl::ParseCommandLineOptions(optargc, argv, "arcmt-test");
357357

358358
if (VerifyTransformedFiles) {
359359
if (ResultFiles.empty()) {

tools/driver/cc1as_main.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,7 @@ int cc1as_main(const char **ArgBegin, const char **ArgEnd,
413413
for (unsigned i = 0; i != NumArgs; ++i)
414414
Args[i + 1] = Asm.LLVMArgs[i].c_str();
415415
Args[NumArgs + 1] = 0;
416-
llvm::cl::ParseCommandLineOptions(NumArgs + 1, const_cast<char **>(Args));
416+
llvm::cl::ParseCommandLineOptions(NumArgs + 1, Args);
417417
}
418418

419419
// Execute the invocation, unless there were parsing errors.

0 commit comments

Comments
 (0)