diff --git a/lld/test/wasm/export-empty.test b/lld/test/wasm/export-empty.test new file mode 100644 --- /dev/null +++ b/lld/test/wasm/export-empty.test @@ -0,0 +1,4 @@ +RUN: llc -filetype=obj %p/Inputs/start.ll -o %t.o +RUN: not wasm-ld --export "" %t.o -o %t.wasm 2>&1 | FileCheck --match-full-lines %s + +CHECK: wasm-ld: error: symbol exported via --export not found: diff --git a/llvm/include/llvm/ADT/StringSet.h b/llvm/include/llvm/ADT/StringSet.h --- a/llvm/include/llvm/ADT/StringSet.h +++ b/llvm/include/llvm/ADT/StringSet.h @@ -36,7 +36,6 @@ explicit StringSet(AllocatorTy A) : base(A) {} std::pair insert(StringRef Key) { - assert(!Key.empty()); return base::insert(std::make_pair(Key, None)); } diff --git a/llvm/unittests/ADT/StringSetTest.cpp b/llvm/unittests/ADT/StringSetTest.cpp --- a/llvm/unittests/ADT/StringSetTest.cpp +++ b/llvm/unittests/ADT/StringSetTest.cpp @@ -41,4 +41,16 @@ Element->Destroy(); } +TEST_F(StringSetTest, EmptyString) { + // Verify that the empty string can by successfully inserted + StringSet<> Set; + size_t Count = Set.count(""); + EXPECT_EQ(Count, 0UL); + + Set.insert(""); + Count = Set.count(""); + EXPECT_EQ(Count, 1UL); +} + + } // end anonymous namespace diff --git a/llvm/unittests/Support/StringPool.cpp b/llvm/unittests/Support/StringPool.cpp --- a/llvm/unittests/Support/StringPool.cpp +++ b/llvm/unittests/Support/StringPool.cpp @@ -1,4 +1,4 @@ -//===- llvm/unittest/Support/StringPoiil.cpp - StringPool tests -----------===// +//===- llvm/unittest/Support/StringPool.cpp - StringPool tests ------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information.