summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Support/CommandLine.cpp
diff options
context:
space:
mode:
authorChris Bieneman <beanz@apple.com>2014-10-15 21:54:35 +0000
committerChris Bieneman <beanz@apple.com>2014-10-15 21:54:35 +0000
commit732e0aa9fb84f1d89e8fa9233f814415cc45a637 (patch)
treee00e4701ee328fb676addf55b17ee53bcb4b6681 /llvm/lib/Support/CommandLine.cpp
parentde4de39c9d5f902c421e562d8b72af7361ace53d (diff)
downloadbcm5719-llvm-732e0aa9fb84f1d89e8fa9233f814415cc45a637.tar.gz
bcm5719-llvm-732e0aa9fb84f1d89e8fa9233f814415cc45a637.zip
Defining a new API for debug options that doesn't rely on static global cl::opts.
Summary: This is based on the discussions from the LLVMDev thread: http://lists.cs.uiuc.edu/pipermail/llvmdev/2014-August/075886.html Reviewers: chandlerc Reviewed By: chandlerc Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D5389 llvm-svn: 219854
Diffstat (limited to 'llvm/lib/Support/CommandLine.cpp')
-rw-r--r--llvm/lib/Support/CommandLine.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/llvm/lib/Support/CommandLine.cpp b/llvm/lib/Support/CommandLine.cpp
index 2c5174dc7d3..9d5f1580724 100644
--- a/llvm/lib/Support/CommandLine.cpp
+++ b/llvm/lib/Support/CommandLine.cpp
@@ -113,9 +113,15 @@ void Option::addArgument() {
}
void Option::removeArgument() {
- assert(NextRegistered && "argument never registered");
- assert(RegisteredOptionList == this && "argument is not the last registered");
- RegisteredOptionList = NextRegistered;
+ if (RegisteredOptionList == this) {
+ RegisteredOptionList = NextRegistered;
+ MarkOptionsChanged();
+ return;
+ }
+ Option *O = RegisteredOptionList;
+ for (; O->NextRegistered != this; O = O->NextRegistered)
+ ;
+ O->NextRegistered = NextRegistered;
MarkOptionsChanged();
}
OpenPOWER on IntegriCloud