return Filename;
};
StringRef TypoCorrectionName = CorrectTypoFilename(Filename);
- SmallString<128> NormalizedTypoCorrectionPath;
- if (LangOpts.MSVCCompat) {
- NormalizedTypoCorrectionPath = TypoCorrectionName.str();
+
#ifndef _WIN32
+ // Normalize slashes when compiling with -fms-extensions on non-Windows.
+ // This is unnecessary on Windows since the filesystem there handles
+ // backslashes.
+ SmallString<128> NormalizedTypoCorrectionPath;
+ if (LangOpts.MicrosoftExt) {
+ NormalizedTypoCorrectionPath = TypoCorrectionName;
llvm::sys::path::native(NormalizedTypoCorrectionPath);
-#endif
+ TypoCorrectionName = NormalizedTypoCorrectionPath;
}
+#endif
+
Optional<FileEntryRef> File = LookupFile(
- FilenameLoc,
- LangOpts.MSVCCompat ? NormalizedTypoCorrectionPath.c_str()
- : TypoCorrectionName,
- isAngled, LookupFrom, LookupFromFile, CurDir,
- Callbacks ? &SearchPath : nullptr, Callbacks ? &RelativePath : nullptr,
- &SuggestedModule, &IsMapped,
+ FilenameLoc, TypoCorrectionName, isAngled, LookupFrom, LookupFromFile,
+ CurDir, Callbacks ? &SearchPath : nullptr,
+ Callbacks ? &RelativePath : nullptr, &SuggestedModule, &IsMapped,
/*IsFrameworkFound=*/nullptr);
if (File) {
auto Hint =
// the path.
ModuleMap::KnownHeader SuggestedModule;
SourceLocation FilenameLoc = FilenameTok.getLocation();
+ StringRef LookupFilename = Filename;
+
+#ifndef _WIN32
+ // Normalize slashes when compiling with -fms-extensions on non-Windows. This
+ // is unnecessary on Windows since the filesystem there handles backslashes.
SmallString<128> NormalizedPath;
- if (LangOpts.MSVCCompat) {
+ if (LangOpts.MicrosoftExt) {
NormalizedPath = Filename.str();
-#ifndef _WIN32
llvm::sys::path::native(NormalizedPath);
-#endif
+ LookupFilename = NormalizedPath;
}
- StringRef LookupFilename =
- LangOpts.MSVCCompat ? StringRef(NormalizedPath) : Filename;
+#endif
Optional<FileEntryRef> File = LookupHeaderIncludeOrImport(
CurDir, Filename, FilenameLoc, FilenameRange, FilenameTok,
// CHECK: #include "Inputs\success.h"
// CHECK: ^
-// expected to fail on windows as the inclusion would succeed and the
-// compilation will fail due to the '#error success'.
-// XFAIL: windows-msvc
-
-// This test may or may not fail since 'Inputs\success.h' is passed
-// to Win32 APIs on Windows.
-// REQUIRES: disabled
+// This test is really checking that we *don't* replace backslashes with slashes
+// on non-Windows unless -fms-extensions is passed. It won't fail in this way on
+// Windows because the filesystem will interpret the backslash as a directory
+// separator.
+// UNSUPPORTED: system-windows