[PATCH] D58785: [llvm-cxxfilt]Add test to show that empty lines can be handled

James Henderson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 28 06:42:44 PST 2019


jhenderson created this revision.
jhenderson added reviewers: mattd, compnerd.
Herald added a project: LLVM.

I recently discovered a bug in llvm-cxxfilt introduced in rL353743 <https://reviews.llvm.org/rL353743> but was fixed later incidentally due to rL355031 <https://reviews.llvm.org/rL355031>. Specifically, llvm-cxxfilt was attempting to call `.back()` on an empty string any time there was a new line in the input. This was causing a crash in my debug builds only. This patch simply adds a test that explicitly tests that llvm-cxxfilt handles empty lines correctly. It may pass under release builds under the broken behaviour, but it fails at least in debug builds.

Note: a FileCheck assertion means that D58784 <https://reviews.llvm.org/D58784> needs to land before this test can land.


Repository:
  rL LLVM

https://reviews.llvm.org/D58785

Files:
  test/tools/llvm-cxxfilt/empty-line.test


Index: test/tools/llvm-cxxfilt/empty-line.test
===================================================================
--- test/tools/llvm-cxxfilt/empty-line.test
+++ test/tools/llvm-cxxfilt/empty-line.test
@@ -0,0 +1,9 @@
+# Show that llvm-cxxfilt can handle empty lines in the input.
+RUN: echo "" > %t
+RUN: echo "_Z3foov" >> %t
+RUN: echo "" >> %t
+RUN: llvm-cxxfilt < %t | FileCheck %s
+
+CHECK:       {{^$}}
+CHECK-NEXT:  foo()
+CHECK-EMPTY:


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D58785.188736.patch
Type: text/x-patch
Size: 444 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190228/7d738c0c/attachment.bin>


More information about the llvm-commits mailing list