[PATCH] D56631: [MSVC Compat] Fix typo correction for inclusion directives.

Volodymyr Sapsai via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 15 12:13:47 PST 2019


This revision was automatically updated to reflect the committed changes.
Closed by commit rL351232: [MSVC Compat] Fix typo correction for inclusion directives. (authored by vsapsai, committed by ).
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D56631?vs=181417&id=181850#toc

Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D56631/new/

https://reviews.llvm.org/D56631

Files:
  cfe/trunk/lib/Lex/PPDirectives.cpp
  cfe/trunk/test/Preprocessor/include-likely-typo.c


Index: cfe/trunk/test/Preprocessor/include-likely-typo.c
===================================================================
--- cfe/trunk/test/Preprocessor/include-likely-typo.c
+++ cfe/trunk/test/Preprocessor/include-likely-typo.c
@@ -1,3 +1,4 @@
 // RUN: %clang_cc1 %s -verify
+// RUN: %clang_cc1 -fms-compatibility %s -verify
 
 #include "<empty_file_to_include.h>" // expected-error {{'<empty_file_to_include.h>' file not found, did you mean 'empty_file_to_include.h'?}}
Index: cfe/trunk/lib/Lex/PPDirectives.cpp
===================================================================
--- cfe/trunk/lib/Lex/PPDirectives.cpp
+++ cfe/trunk/lib/Lex/PPDirectives.cpp
@@ -1813,9 +1813,17 @@
           return Filename;
         };
         StringRef TypoCorrectionName = CorrectTypoFilename(Filename);
+        SmallString<128> NormalizedTypoCorrectionPath;
+        if (LangOpts.MSVCCompat) {
+          NormalizedTypoCorrectionPath = TypoCorrectionName.str();
+#ifndef _WIN32
+          llvm::sys::path::native(NormalizedTypoCorrectionPath);
+#endif
+        }
         File = LookupFile(
             FilenameLoc,
-            LangOpts.MSVCCompat ? NormalizedPath.c_str() : TypoCorrectionName,
+            LangOpts.MSVCCompat ? NormalizedTypoCorrectionPath.c_str()
+                                : TypoCorrectionName,
             isAngled, LookupFrom, LookupFromFile, CurDir,
             Callbacks ? &SearchPath : nullptr,
             Callbacks ? &RelativePath : nullptr, &SuggestedModule, &IsMapped);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D56631.181850.patch
Type: text/x-patch
Size: 1507 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190115/5aaf8da6/attachment.bin>


More information about the llvm-commits mailing list