[PATCH] D56631: [MSVC Compat] Fix typo correction for inclusion directives.
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=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 "" // expected-error {{'' 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 ? : nullptr, Callbacks ? : nullptr, , ); 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 "" // expected-error {{'' 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 ? : nullptr, Callbacks ? : nullptr, , ); ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D56631: [MSVC Compat] Fix typo correction for inclusion directives.
vsapsai added a comment. Thanks for the review. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D56631/new/ https://reviews.llvm.org/D56631 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D56631: [MSVC Compat] Fix typo correction for inclusion directives.
christylee accepted this revision. christylee added a comment. This revision is now accepted and ready to land. Thanks for catching that! CHANGES SINCE LAST ACTION https://reviews.llvm.org/D56631/new/ https://reviews.llvm.org/D56631 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D56631: [MSVC Compat] Fix typo correction for inclusion directives.
vsapsai created this revision. vsapsai added reviewers: christylee, compnerd. Herald added subscribers: dexonsmith, jkorous. In MSVC compatibility mode we were checking not the typo corrected filename but the original filename. https://reviews.llvm.org/D56631 Files: clang/lib/Lex/PPDirectives.cpp clang/test/Preprocessor/include-likely-typo.c Index: clang/test/Preprocessor/include-likely-typo.c === --- clang/test/Preprocessor/include-likely-typo.c +++ clang/test/Preprocessor/include-likely-typo.c @@ -1,3 +1,4 @@ // RUN: %clang_cc1 %s -verify +// RUN: %clang_cc1 -fms-compatibility %s -verify #include "" // expected-error {{'' file not found, did you mean 'empty_file_to_include.h'?}} Index: clang/lib/Lex/PPDirectives.cpp === --- clang/lib/Lex/PPDirectives.cpp +++ clang/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 ? : nullptr, Callbacks ? : nullptr, , ); Index: clang/test/Preprocessor/include-likely-typo.c === --- clang/test/Preprocessor/include-likely-typo.c +++ clang/test/Preprocessor/include-likely-typo.c @@ -1,3 +1,4 @@ // RUN: %clang_cc1 %s -verify +// RUN: %clang_cc1 -fms-compatibility %s -verify #include "" // expected-error {{'' file not found, did you mean 'empty_file_to_include.h'?}} Index: clang/lib/Lex/PPDirectives.cpp === --- clang/lib/Lex/PPDirectives.cpp +++ clang/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 ? : nullptr, Callbacks ? : nullptr, , ); ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits