[llvm] [llvm][Support][NFC] Disentangle SpecialCaseList parsing and matching (PR #116800)

Boaz Brickner via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 20 04:17:25 PST 2024


================
@@ -113,22 +120,49 @@ bool SpecialCaseList::createInternal(const std::vector<std::string> &Paths,
       Error = (Twine("can't open file '") + Path + "': " + EC.message()).str();
       return false;
     }
-    std::string ParseError;
-    if (!parse(FileOrErr.get().get(), ParseError)) {
-      Error = (Twine("error parsing file '") + Path + "': " + ParseError).str();
+    if (!createInternal(FileOrErr->get(), Error)) {
+      Error = llvm::formatv("error parsing file '{0}': {1}", Path, Error);
       return false;
     }
   }
   return true;
 }
-
 bool SpecialCaseList::createInternal(const MemoryBuffer *MB,
                                      std::string &Error) {
----------------
bricknerb wrote:

Orthogonal to this change, do you think we should fix the API here to return the error instead of having a bool+Error& ?
It seems like this will make the code simpler.

https://github.com/llvm/llvm-project/pull/116800


More information about the llvm-commits mailing list