[PATCH] D39212: Check special-case-list regex before insertion.
Mitch Phillips via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Oct 24 16:56:44 PDT 2017
This revision was automatically updated to reflect the committed changes.
Closed by commit rL316537: Check special-case-list regex before insertion. (authored by hctim).
Repository:
rL LLVM
https://reviews.llvm.org/D39212
Files:
llvm/trunk/lib/Support/SpecialCaseList.cpp
llvm/trunk/unittests/Support/SpecialCaseListTest.cpp
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) {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D39212.120152.patch
Type: text/x-patch
Size: 1118 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171024/1049efeb/attachment.bin>
More information about the llvm-commits
mailing list