[PATCH] D153587: [GlobPattern] Support brace expansions

Jordan Rupprecht via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 29 12:14:02 PDT 2023


rupprecht added a comment.

LGTM, although this logic is already pretty obscure, so it's hard to follow. I wonder if we have fuzzers hooked up to this so we don't have to worry too much if this misses an edge case.



================
Comment at: llvm/unittests/Support/GlobPatternTest.cpp:148
 TEST_F(GlobPatternTest, Invalid) {
-  Expected<GlobPattern> Pat1 = GlobPattern::create("[");
-  EXPECT_FALSE((bool)Pat1);
-  handleAllErrors(Pat1.takeError(), [&](ErrorInfoBase &EIB) {});
-
-  Expected<GlobPattern> Pat2 = GlobPattern::create("[]");
-  EXPECT_FALSE((bool)Pat2);
-  handleAllErrors(Pat2.takeError(), [&](ErrorInfoBase &EIB) {});
+  for (auto &InvalidPattern : {"[", "[]", "{", "{{"}) {
+    Expected<GlobPattern> Pat1 = GlobPattern::create(InvalidPattern);
----------------
nit: `const auto&` should work here?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D153587/new/

https://reviews.llvm.org/D153587



More information about the llvm-commits mailing list