Index: llvm/trunk/lib/Support/SpecialCaseList.cpp =================================================================== --- llvm/trunk/lib/Support/SpecialCaseList.cpp +++ llvm/trunk/lib/Support/SpecialCaseList.cpp @@ -28,6 +28,11 @@ bool SpecialCaseList::Matcher::insert(std::string Regexp, std::string &REError) { + if (Regexp.empty()) { + REError = "Supplied regexp was blank"; + return false; + } + if (Regex::isLiteralERE(Regexp)) { Strings.insert(Regexp); return true; Index: llvm/trunk/unittests/Support/SpecialCaseListTest.cpp =================================================================== --- llvm/trunk/unittests/Support/SpecialCaseListTest.cpp +++ llvm/trunk/unittests/Support/SpecialCaseListTest.cpp @@ -67,6 +67,9 @@ EXPECT_EQ(makeSpecialCaseList("[[]", Error), nullptr); EXPECT_TRUE(((StringRef)Error).startswith("malformed regex for section [: ")); + + EXPECT_EQ(makeSpecialCaseList("src:=", Error), nullptr); + EXPECT_TRUE(((StringRef)Error).endswith("Supplied regexp was blank")); } TEST_F(SpecialCaseListTest, Section) {