[clang] [Driver] Fix detection of libc++ with empty sysroot. (PR #66947)

Sam McCall via cfe-commits cfe-commits at lists.llvm.org
Fri Sep 22 12:23:01 PDT 2023


================
@@ -316,6 +318,52 @@ TEST(ToolChainTest, VFSSolarisMultiGCCInstallation) {
   }
 }
 
+MATCHER_P(jobHasArgs, Substr, "") {
+  const driver::Command &C = arg;
+  std::string Args = "";
+  llvm::ListSeparator Sep(" ");
+  for (const char *Arg : C.getArguments()) {
+    Args += Sep;
+    Args += Arg;
+  }
+  if (is_style_windows(llvm::sys::path::Style::native))
+    std::replace(Args.begin(), Args.end(), '\\', '/');
+  if (llvm::StringRef(Args).contains(Substr))
+    return true;
+  *result_listener << "whose args are '" << Args << "'";
----------------
sam-mccall wrote:

Yeah, this is printed only when the matcher fails. It's needed for a decent error message as the job itself has no useful printer.

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


More information about the cfe-commits mailing list