diff options
| author | Alexey Bataev <a.bataev@hotmail.com> | 2019-08-13 19:32:36 +0000 |
|---|---|---|
| committer | Alexey Bataev <a.bataev@hotmail.com> | 2019-08-13 19:32:36 +0000 |
| commit | 1ebee213b830bb73a11821e7ac7adb8e5d5f30e3 (patch) | |
| tree | f96d8a05db17d17a35b97b9f73572fa691a2bb2c /lib/Lex/HeaderSearch.cpp | |
| parent | 9cd89a1a8c51349102855d92d68c6f1f80a1cc35 (diff) | |
| download | clang-1ebee213b830bb73a11821e7ac7adb8e5d5f30e3.tar.gz | |
Don't use std::errc
Summary:
As noted on Errc.h:
// * std::errc is just marked with is_error_condition_enum. This means that
// common patters like AnErrorCode == errc::no_such_file_or_directory take
// 4 virtual calls instead of two comparisons.
And on some libstdc++ those virtual functions conclude that
------------------------
int main() {
std::error_code foo = std::make_error_code(std::errc::no_such_file_or_directory);
return foo == std::errc::no_such_file_or_directory;
}
-------------------------
should exit with 0.
Reviewers: thakis, rnk, jfb
Reviewed By: thakis
Subscribers: lebedev.ri, dexonsmith, xbolva00, cfe-commits, caomhin
Tags: #clang
Differential Revision: https://reviews.llvm.org/D66143
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@368739 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Lex/HeaderSearch.cpp')
| -rw-r--r-- | lib/Lex/HeaderSearch.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/Lex/HeaderSearch.cpp b/lib/Lex/HeaderSearch.cpp index e9542b8d16..7bc953ba1a 100644 --- a/lib/Lex/HeaderSearch.cpp +++ b/lib/Lex/HeaderSearch.cpp @@ -30,6 +30,7 @@ #include "llvm/ADT/StringRef.h" #include "llvm/Support/Allocator.h" #include "llvm/Support/Capacity.h" +#include "llvm/Support/Errc.h" #include "llvm/Support/ErrorHandling.h" #include "llvm/Support/FileSystem.h" #include "llvm/Support/Path.h" @@ -315,9 +316,9 @@ const FileEntry *HeaderSearch::getFileAndSuggestModule( // For rare, surprising errors (e.g. "out of file handles"), diag the EC // 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::not_a_directory) { + if (EC != llvm::errc::no_such_file_or_directory && + EC != llvm::errc::invalid_argument && + EC != llvm::errc::is_a_directory && EC != llvm::errc::not_a_directory) { Diags.Report(IncludeLoc, diag::err_cannot_open_file) << FileName << EC.message(); } |
