<html>
<head>
<base href="https://bugs.llvm.org/">
</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-format crashes with blank assume-filename"
href="https://bugs.llvm.org/show_bug.cgi?id=34667">34667</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>clang-format crashes with blank assume-filename
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>4.0
</td>
</tr>
<tr>
<th>Hardware</th>
<td>Macintosh
</td>
</tr>
<tr>
<th>OS</th>
<td>MacOS X
</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>Formatter
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>micah@werbitt.net
</td>
</tr>
<tr>
<th>CC</th>
<td>djasper@google.com, klimek@google.com, llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>Overview
--------------------
clang-format crashes when the assume-filename is given a blank string
Steps to Reproduce
--------------------
clang-format -output-replacements-xml -assume-filename '' -offset 0 -length 10
-cursor 5 <<< 'aaaa = 1234;'
Actual Results
--------------------
clang-format -output-replacements-xml -assume-filename '' -offset 0 -length 10
-cursor 5 <<< 'aaaa = 1234;'
0 clang-format 0x0000000106ba765b
llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 40
1 clang-format 0x0000000106ba6f93 llvm::sys::RunSignalHandlers() +
83
2 clang-format 0x0000000106ba7aaa SignalHandler(int) + 195
3 libsystem_platform.dylib 0x00007fff8d04452a _sigtramp + 26
4 libsystem_platform.dylib 0x00007fff59089ea0 _sigtramp + 3422837136
5 clang-format 0x0000000106bde825
clang::format::Environment::CreateVirtualEnvironment(llvm::StringRef,
llvm::StringRef, llvm::ArrayRef<clang::tooling::Range>) + 661
6 clang-format 0x0000000106bcc115
clang::format::reformat(clang::format::FormatStyle const&, llvm::StringRef,
llvm::ArrayRef<clang::tooling::Range>, llvm::StringRef, bool*) + 221
7 clang-format 0x0000000106b75892
clang::format::format(llvm::StringRef) + 3655
8 clang-format 0x0000000106b74880 main + 671
9 libdyld.dylib 0x00007fff93d4a5ad start + 1
zsh: segmentation fault clang-format -output-replacements-xml -assume-filename
'' -offset 0 -length 1
Expected Results
--------------------
Should exit with error:
No such file or directory
Clang Format Version
--------------------
clang-format version 4.0.1 (tags/RELEASE_401/final)</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>