diff options
author | Volodymyr Sapsai <vsapsai@apple.com> | 2019-01-15 20:08:23 +0000 |
---|---|---|
committer | Volodymyr Sapsai <vsapsai@apple.com> | 2019-01-15 20:08:23 +0000 |
commit | 3bbdd87c88d710bfb3e96cd8eabfaf3079c3f696 (patch) | |
tree | 85d7f9fc747943f9b8b1406c9f8aead1ce454f76 /clang/lib/Lex/PPDirectives.cpp | |
parent | 99fcbf67d04d488d819bffb8fda3bb9d5504b63b (diff) | |
download | bcm5719-llvm-3bbdd87c88d710bfb3e96cd8eabfaf3079c3f696.tar.gz bcm5719-llvm-3bbdd87c88d710bfb3e96cd8eabfaf3079c3f696.zip |
[MSVC Compat] Fix typo correction for inclusion directives.
In MSVC compatibility mode we were checking not the typo corrected
filename but the original filename.
Reviewers: christylee, compnerd
Reviewed By: christylee
Subscribers: jkorous, dexonsmith, sammccall, hokein, cfe-commits
Differential Revision: https://reviews.llvm.org/D56631
llvm-svn: 351232
Diffstat (limited to 'clang/lib/Lex/PPDirectives.cpp')
-rw-r--r-- | clang/lib/Lex/PPDirectives.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/clang/lib/Lex/PPDirectives.cpp b/clang/lib/Lex/PPDirectives.cpp index 15fc086f8ad..d62a3513c77 100644 --- a/clang/lib/Lex/PPDirectives.cpp +++ b/clang/lib/Lex/PPDirectives.cpp @@ -1813,9 +1813,17 @@ void Preprocessor::HandleIncludeDirective(SourceLocation HashLoc, 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); |