Author: rnk Date: Fri Aug 9 12:49:14 2019 New Revision: 368475 URL: http://llvm.org/viewvc/llvm-project?rev=368475&view=rev Log: 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. Added: cfe/trunk/test/Preprocessor/Inputs/include-file-and-dir/ cfe/trunk/test/Preprocessor/Inputs/include-file-and-dir/file-and-dir cfe/trunk/test/Preprocessor/Inputs/include-file-and-dir/incdir/ cfe/trunk/test/Preprocessor/Inputs/include-file-and-dir/incdir/file-and-dir/ cfe/trunk/test/Preprocessor/Inputs/include-file-and-dir/incdir/file-and-dir/foo.h cfe/trunk/test/Preprocessor/include-header-file-and-dir.c Modified: cfe/trunk/lib/Lex/HeaderSearch.cpp Modified: cfe/trunk/lib/Lex/HeaderSearch.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/HeaderSearch.cpp?rev=368475&r1=368474&r2=368475&view=diff ============================================================================== --- cfe/trunk/lib/Lex/HeaderSearch.cpp (original) +++ cfe/trunk/lib/Lex/HeaderSearch.cpp Fri Aug 9 12:49:14 2019 @@ -316,7 +316,8 @@ const FileEntry *HeaderSearch::getFileAn // 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(); } Added: cfe/trunk/test/Preprocessor/Inputs/include-file-and-dir/file-and-dir URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Preprocessor/Inputs/include-file-and-dir/file-and-dir?rev=368475&view=auto ============================================================================== (empty) Added: cfe/trunk/test/Preprocessor/Inputs/include-file-and-dir/incdir/file-and-dir/foo.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Preprocessor/Inputs/include-file-and-dir/incdir/file-and-dir/foo.h?rev=368475&view=auto ============================================================================== --- cfe/trunk/test/Preprocessor/Inputs/include-file-and-dir/incdir/file-and-dir/foo.h (added) +++ cfe/trunk/test/Preprocessor/Inputs/include-file-and-dir/incdir/file-and-dir/foo.h Fri Aug 9 12:49:14 2019 @@ -0,0 +1 @@ +included_foo_dot_h Added: cfe/trunk/test/Preprocessor/include-header-file-and-dir.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Preprocessor/include-header-file-and-dir.c?rev=368475&view=auto ============================================================================== --- cfe/trunk/test/Preprocessor/include-header-file-and-dir.c (added) +++ cfe/trunk/test/Preprocessor/include-header-file-and-dir.c Fri Aug 9 12:49:14 2019 @@ -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 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits