r343591 - [Preprocessor] Hide include typo correction behind SpellChecking.

Haojian Wu via cfe-commits cfe-commits at lists.llvm.org
Tue Oct 2 06:59:50 PDT 2018


Author: hokein
Date: Tue Oct  2 06:59:49 2018
New Revision: 343591

URL: http://llvm.org/viewvc/llvm-project?rev=343591&view=rev
Log:
[Preprocessor] Hide include typo correction behind SpellChecking.

Summary:
Similar to Sema typo correction, the Preprocessor typo correction should
also be hidden behind the SpellChecking flag.

Reviewers: sammccall

Subscribers: cfe-commits

Differential Revision: https://reviews.llvm.org/D52778

Modified:
    cfe/trunk/lib/Lex/PPDirectives.cpp

Modified: cfe/trunk/lib/Lex/PPDirectives.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/PPDirectives.cpp?rev=343591&r1=343590&r2=343591&view=diff
==============================================================================
--- cfe/trunk/lib/Lex/PPDirectives.cpp (original)
+++ cfe/trunk/lib/Lex/PPDirectives.cpp Tue Oct  2 06:59:49 2018
@@ -1888,7 +1888,7 @@ void Preprocessor::HandleIncludeDirectiv
       // Check for likely typos due to leading or trailing non-isAlphanumeric
       // characters
       StringRef OriginalFilename = Filename;
-      if (!File) {
+      if (LangOpts.SpellChecking && !File) {
         // A heuristic to correct a typo file name by removing leading and
         // trailing non-isAlphanumeric characters.
         auto CorrectTypoFilename = [](llvm::StringRef Filename) {




More information about the cfe-commits mailing list