[llvm-bugs] [Bug 34667] New: clang-format crashes with blank assume-filename

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Sep 19 04:52:19 PDT 2017


https://bugs.llvm.org/show_bug.cgi?id=34667

            Bug ID: 34667
           Summary: clang-format crashes with blank assume-filename
           Product: clang
           Version: 4.0
          Hardware: Macintosh
                OS: MacOS X
            Status: NEW
          Severity: normal
          Priority: P
         Component: Formatter
          Assignee: unassignedclangbugs at nondot.org
          Reporter: micah at werbitt.net
                CC: djasper at google.com, klimek at google.com,
                    llvm-bugs at lists.llvm.org

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)

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20170919/29733f2f/attachment.html>


More information about the llvm-bugs mailing list