[clang] [clang][test] Fix test failures when LLVM_WINDOWS_PREFER_FORWARD_SLAS… (PR #193156)
Martin Storsjö via cfe-commits
cfe-commits at lists.llvm.org
Thu Apr 23 02:53:45 PDT 2026
================
@@ -820,8 +820,8 @@ TEST(ToolChainTest, ConfigInexistentInclude) {
#ifdef _WIN32
const char *TestRoot = "C:\\";
-#define USERCONFIG "C:\\home\\user\\test.cfg"
-#define UNEXISTENT "C:\\home\\user\\file.rsp"
+#define USERCONFIG "C:/home/user/test.cfg"
+#define UNEXISTENT "C:/home/user/file.rsp"
----------------
mstorsjo wrote:
I understand that. But - since changing the constant string is going to make it wrong for either format anyway - we can't just change the constant to one single form that works for both cases, right? That's why you do `llvm::replace` on the error message below, to make the actual error message match the expected reference, with forward slashes.
But wy do you need to change the reference for `USERCONFIG` and `UNEXISTENT` for that? You could just as well keep the reference using backslashes, and do `llvm::replace` from forward slash to backslash.
What I didn't think of before, is that requires adding an `#ifdef _WIN32` around the `llvm::replace` which you don't need when you do it this way though. Doing it without touching these constant strings would be less of a disruption/change for the regular Windows case, but end up with an ifdef in the common code instead. (But that would be less change for non-Windows platforms, where we now run a `llvm::replace`, even though that isn't supposed to change anything for them.)
https://github.com/llvm/llvm-project/pull/193156
More information about the cfe-commits
mailing list