<html>
<head>
<base href="https://llvm.org/bugs/" />
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW --- - clang api gets confused by positional arguments"
href="https://llvm.org/bugs/show_bug.cgi?id=29054">29054</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>clang api gets confused by positional arguments
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>3.9
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Linux
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>Driver
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>moritz.kiefer@purelyfunctional.org
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>Steps to reproduce:
Download and compile
<a href="https://gist.github.com/cocreature/5b511b3de6f2e2e2e08e48ec3ce25dcc">https://gist.github.com/cocreature/5b511b3de6f2e2e2e08e48ec3ce25dcc</a> and try to
run it with a single argument. That file identical to the clang-interpreter
example with the exception of one (unused) positional argument added via
llvm::cl (and some debug output).
Then try to run it and pass an arbitrary C file as the single argument.
Expected:
It compiles to an LLVM module and then tries to interpret it.
Actual behavior:
The call to CompilerInstance::ExecuteAction fails with the following error
message:
clang: Not enough positional command line arguments specified!
Must specify at least 1 positional arguments: See: clang -help
Comments:
Adding an unused argument is obviously not useful but I am encountering this
bug in a tool of mine where we actually use positional arguments so just
removing them is not an option (or would require us to switch to a different
cli arg parser). This is new behavior in 3.9 (3.8 works fine). I assume it is
not intended, but if so, is there a way around this?</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>