4 Commits

Author SHA1 Message Date
Ryan Mitchell
52e1f7a1ba Run idmap2 static-checks and fix formatting issues
Bug: 130324774
Test: builds
Change-Id: I2cf9d3aa268ffe38e525fadee9d81fc6aefe19b1
2019-04-15 08:48:10 -07:00
Mårten Kongstad
49d835d84e idmap2: switch to improved Result class
Remove the old std::optional based Result class, replace uses with the
new std::variant based Result class.

Test: make idmap2_tests
Change-Id: I401cb36e5af06133a2872d835cf29bfb0b106597
2019-02-27 20:31:51 +00:00
Chih-Hung Hsieh
a20e8a357c Suppress cert-dcl50-cpp tidy warnings.
Bug: 122832439
Test: make with WITH_TIDY=1 DEFAULT_GLOBAL_TIDY_CHECKS=-*,cert-dcl50-cpp
Change-Id: I034ec8c6e6338b38ee4b413e3edac223a01d8764
2019-02-15 23:38:54 +00:00
Mårten Kongstad
1e99b1783d idmap2: introduce improved Result class
Add a new version of the Result class that functions like the old
Result, but in case of an error, also encodes a string detailing the
error. This will allow us to write the following type of code:

Result<Foo> CreateFoo() {
    if (...) {
        return Error("errno=%d", errno());
    }
    return Foo(...);
}

auto foo = CreateFoo();
if (!foo) {
    std::cerr << "error: " << foo.GetErrorMessage() << std::endl;
    abort();
}
std::cout << "foo=" << *foo << std::endl;

This commit only adds the new Result class. A later change will replace
uses of the old version.

Test: make idmap2_tests
Change-Id: I674d8a06866402adedf85f8514400f25840d5eda
2019-02-06 16:54:25 -08:00