diff options
| author | Reid Kleckner <rnk@google.com> | 2019-08-09 19:49:14 +0000 |
|---|---|---|
| committer | Reid Kleckner <rnk@google.com> | 2019-08-09 19:49:14 +0000 |
| commit | 50fcf7285eeb001d751eadac5d001a0e216fd701 (patch) | |
| tree | 642e9014a9626fc804c7fc82c12ee279eb29b869 | |
| parent | 867dbf288309b30ff0d3301c7f717c2a28ca1808 (diff) | |
| download | bcm5719-llvm-50fcf7285eeb001d751eadac5d001a0e216fd701.tar.gz bcm5719-llvm-50fcf7285eeb001d751eadac5d001a0e216fd701.zip | |
Don't diagnose errors when a file matches an include component
This regressed in r368322, and was reported as PR42948 and on the
mailing list. The fix is to ignore the specific error code for this
case. The problem doesn't seem to reproduce on Windows, where a
different error code is used instead.
llvm-svn: 368475
4 files changed, 7 insertions, 1 deletions
diff --git a/clang/lib/Lex/HeaderSearch.cpp b/clang/lib/Lex/HeaderSearch.cpp index 8b6a19e080f..e9542b8d16a 100644 --- a/clang/lib/Lex/HeaderSearch.cpp +++ b/clang/lib/Lex/HeaderSearch.cpp @@ -316,7 +316,8 @@ const FileEntry *HeaderSearch::getFileAndSuggestModule( // message. std::error_code EC = File.getError(); if (EC != std::errc::no_such_file_or_directory && - EC != std::errc::invalid_argument && EC != std::errc::is_a_directory) { + EC != std::errc::invalid_argument && EC != std::errc::is_a_directory && + EC != std::errc::not_a_directory) { Diags.Report(IncludeLoc, diag::err_cannot_open_file) << FileName << EC.message(); } diff --git a/clang/test/Preprocessor/Inputs/include-file-and-dir/file-and-dir b/clang/test/Preprocessor/Inputs/include-file-and-dir/file-and-dir new file mode 100644 index 00000000000..e69de29bb2d --- /dev/null +++ b/clang/test/Preprocessor/Inputs/include-file-and-dir/file-and-dir diff --git a/clang/test/Preprocessor/Inputs/include-file-and-dir/incdir/file-and-dir/foo.h b/clang/test/Preprocessor/Inputs/include-file-and-dir/incdir/file-and-dir/foo.h new file mode 100644 index 00000000000..9d3235e89d5 --- /dev/null +++ b/clang/test/Preprocessor/Inputs/include-file-and-dir/incdir/file-and-dir/foo.h @@ -0,0 +1 @@ +included_foo_dot_h diff --git a/clang/test/Preprocessor/include-header-file-and-dir.c b/clang/test/Preprocessor/include-header-file-and-dir.c new file mode 100644 index 00000000000..8da95ce9b5f --- /dev/null +++ b/clang/test/Preprocessor/include-header-file-and-dir.c @@ -0,0 +1,4 @@ +// RUN: %clang_cc1 -E -P %s -I%S/Inputs/include-file-and-dir -I%S/Inputs/include-file-and-dir/incdir -o - | FileCheck %s +#include "file-and-dir/foo.h" + +// CHECK: included_foo_dot_h |

