]> granicus.if.org Git - clang/commitdiff
[Preprocessor] Hide include typo correction behind SpellChecking.
authorHaojian Wu <hokein@google.com>
Tue, 2 Oct 2018 13:59:49 +0000 (13:59 +0000)
committerHaojian Wu <hokein@google.com>
Tue, 2 Oct 2018 13:59:49 +0000 (13:59 +0000)
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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@343591 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Lex/PPDirectives.cpp

index 2e20a8b9dbc9829c97d79880a9e286b984470495..ceddada9eb8759ba41930b033424bdc4f4218596 100644 (file)
@@ -1888,7 +1888,7 @@ void Preprocessor::HandleIncludeDirective(SourceLocation HashLoc,
       // 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) {