HomePhabricator

Don't use std::errc

Description

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

Details

Committed
ABataevAug 13 2019, 12:32 PM
Reviewer
thakis
Differential Revision
D66143: Don't use std::errc
Parents
rL368738: Revert "Fix crash on switch conditions of non-integer types in templates"
Branches
Unknown
Tags
Unknown