[cfe-commits] r67151 - in /cfe/trunk: lib/Driver/Arg.cpp test/Driver/parsing.c
Daniel Dunbar
daniel at zuster.org
Tue Mar 17 18:48:37 PDT 2009
Author: ddunbar
Date: Tue Mar 17 20:48:37 2009
New Revision: 67151
URL: http://llvm.org/viewvc/llvm-project?rev=67151&view=rev
Log:
Driver: Implement JoinedAndSeparateArg::getValue and add parsing test
case.
Added:
cfe/trunk/test/Driver/parsing.c
Modified:
cfe/trunk/lib/Driver/Arg.cpp
Modified: cfe/trunk/lib/Driver/Arg.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Arg.cpp?rev=67151&r1=67150&r2=67151&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/Arg.cpp (original)
+++ cfe/trunk/lib/Driver/Arg.cpp Tue Mar 17 20:48:37 2009
@@ -142,6 +142,7 @@
const char *JoinedAndSeparateArg::getValue(const ArgList &Args,
unsigned N) const {
assert(N < getNumValues() && "Invalid index.");
- assert(0 && "FIXME: Implement");
- return 0;
+ if (N == 0)
+ return Args.getArgString(getIndex()) + strlen(getOption().getName());
+ return Args.getArgString(getIndex() + 1);
}
Added: cfe/trunk/test/Driver/parsing.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/parsing.c?rev=67151&view=auto
==============================================================================
--- cfe/trunk/test/Driver/parsing.c (added)
+++ cfe/trunk/test/Driver/parsing.c Tue Mar 17 20:48:37 2009
@@ -0,0 +1,15 @@
+// RUN: clang-driver -ccc-print-options input -Yunknown -m32 -arch ppc -djoined -A separate -Ajoined -Wp,one,two -Xarch_joined AndSeparate -sectalign 1 2 3 &> %t &&
+// RUN: grep 'Option 0 - Name: "<input>", Values: {"input"}' %t &&
+// RUN: grep 'Option 1 - Name: "<unknown>", Values: {"-Yunknown"}' %t &&
+// RUN: grep 'Option 2 - Name: "-m32", Values: {}' %t &&
+// RUN: grep 'Option 3 - Name: "-arch", Values: {"ppc"}' %t &&
+// RUN: grep 'Option 4 - Name: "-d", Values: {"joined"}' %t &&
+// RUN: grep 'Option 5 - Name: "-A", Values: {"separate"}' %t &&
+// RUN: grep 'Option 6 - Name: "-A", Values: {"joined"}' %t &&
+// RUN: grep 'Option 7 - Name: "-Wp,", Values: {"one", "two"}' %t &&
+// RUN: grep 'Option 8 - Name: "-Xarch_", Values: {"joined", "AndSeparate"}' %t &&
+// RUN: grep 'Option 9 - Name: "-sectalign", Values: {"1", "2", "3"}' %t &&
+
+// RUN: true
+
+
More information about the cfe-commits
mailing list