[clang] [clang][Lex] warn on backslashes in include paths (PR #186770)

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Mon Mar 16 07:44:38 PDT 2026


================
@@ -6,17 +6,17 @@
 // RUN: %clang_cc1 -fsyntax-only -fms-compatibility %s -include %s -I %t/Output -verify
 // RUN: %clang_cc1 -fsyntax-only -fms-compatibility -fdiagnostics-parseable-fixits %s -include %s -I %t/Output 2>&1 | FileCheck %s
 
-#include "..\Output\.\case-insensitive-include.h"
-#include "..\Output\.\Case-Insensitive-Include.h" // expected-warning {{non-portable path}}
-// CHECK: fix-it:"{{.*}}":{[[@LINE-1]]:10-[[@LINE-1]]:50}:"\"..\\Output\\.\\case-insensitive-include.h\""
-#include "..\\Output\.\\Case-Insensitive-Include.h" // expected-warning {{non-portable path}}
-// CHECK: fix-it:"{{.*}}":{[[@LINE-1]]:10-[[@LINE-1]]:52}:"\"..\\\\Output\\.\\\\case-insensitive-include.h\""
-#include "..\output\.\case-insensitive-include.h" // expected-warning {{non-portable path}}
-// CHECK: fix-it:"{{.*}}":{[[@LINE-1]]:10-[[@LINE-1]]:50}:"\"..\\Output\\.\\case-insensitive-include.h\""
+#include "../Output/./case-insensitive-include.h"
----------------
AaronBallman wrote:

We should not be changing this test file, it was testing particular path components for a reason. I'm not convinced we should emit this diagnostic in `-fms-compatibility` mode given that this is the idiomatic path separator on Windows.

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


More information about the cfe-commits mailing list