[llvm] r359480 - [CommandLine] Don't allow unlimitted dashes for options. Part 1 or 5
Don Hinton via llvm-commits
llvm-commits at lists.llvm.org
Mon Apr 29 11:34:22 PDT 2019
Author: dhinton
Date: Mon Apr 29 11:34:18 2019
New Revision: 359480
URL: http://llvm.org/viewvc/llvm-project?rev=359480&view=rev
Log:
[CommandLine] Don't allow unlimitted dashes for options. Part 1 or 5
Summary:
Prior to this patch, the CommandLine parser would strip an
unlimitted number of dashes from options. This patch limits it to
two.
Reviewers: rnk
Reviewed By: rnk
Subscribers: hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D61229
Modified:
llvm/trunk/lib/Support/CommandLine.cpp
llvm/trunk/test/DebugInfo/X86/array.ll
llvm/trunk/test/DebugInfo/dwarfdump-64-bit-dwarf.test
Modified: llvm/trunk/lib/Support/CommandLine.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/CommandLine.cpp?rev=359480&r1=359479&r2=359480&view=diff
==============================================================================
--- llvm/trunk/lib/Support/CommandLine.cpp (original)
+++ llvm/trunk/lib/Support/CommandLine.cpp Mon Apr 29 11:34:18 2019
@@ -1306,8 +1306,8 @@ bool CommandLineParser::ParseCommandLine
// option is another positional argument. If so, treat it as an argument,
// otherwise feed it to the eating positional.
ArgName = StringRef(argv[i] + 1);
- // Eat leading dashes.
- while (!ArgName.empty() && ArgName[0] == '-')
+ // Eat second dash.
+ if (!ArgName.empty() && ArgName[0] == '-')
ArgName = ArgName.substr(1);
Handler = LookupOption(*ChosenSubCommand, ArgName, Value);
@@ -1318,8 +1318,8 @@ bool CommandLineParser::ParseCommandLine
} else { // We start with a '-', must be an argument.
ArgName = StringRef(argv[i] + 1);
- // Eat leading dashes.
- while (!ArgName.empty() && ArgName[0] == '-')
+ // Eat second dash.
+ if (!ArgName.empty() && ArgName[0] == '-')
ArgName = ArgName.substr(1);
Handler = LookupOption(*ChosenSubCommand, ArgName, Value);
Modified: llvm/trunk/test/DebugInfo/X86/array.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/X86/array.ll?rev=359480&r1=359479&r2=359480&view=diff
==============================================================================
--- llvm/trunk/test/DebugInfo/X86/array.ll (original)
+++ llvm/trunk/test/DebugInfo/X86/array.ll Mon Apr 29 11:34:18 2019
@@ -13,7 +13,7 @@
; }
;
; RUN: llc -filetype=asm %s -o - | FileCheck %s
-; RUN: llc -filetype=obj %s -o - | llvm-dwarfdump -v - ---debug-info | FileCheck %s --check-prefix=DWARF
+; RUN: llc -filetype=obj %s -o - | llvm-dwarfdump -v - --debug-info | FileCheck %s --check-prefix=DWARF
; CHECK-LABEL: _main:
; CHECK: movaps {{.*}}, (%rsp)
Modified: llvm/trunk/test/DebugInfo/dwarfdump-64-bit-dwarf.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/dwarfdump-64-bit-dwarf.test?rev=359480&r1=359479&r2=359480&view=diff
==============================================================================
--- llvm/trunk/test/DebugInfo/dwarfdump-64-bit-dwarf.test (original)
+++ llvm/trunk/test/DebugInfo/dwarfdump-64-bit-dwarf.test Mon Apr 29 11:34:18 2019
@@ -1,5 +1,5 @@
RUN: llvm-dwarfdump %p/Inputs/dwarfdump.elf-mips64-64-bit-dwarf \
-RUN: ---debug-line | FileCheck %s
+RUN: --debug-line | FileCheck %s
# FIXME: llvm-dwarfdump's support for 64-bit dwarf is currently limited to
# .debug_line.
More information about the llvm-commits
mailing list