cpp: explicitly manage isl_bool return values
commitd96d7ae28faf51ba63a6f95c549761c9fb4bd2ec
authorTobias Grosser <tobias@grosser.es>
Sat, 13 May 2017 09:02:44 +0000 (13 11:02 +0200)
committerSven Verdoolaege <sven.verdoolaege@gmail.com>
Wed, 17 May 2017 08:11:26 +0000 (17 10:11 +0200)
treef5d35b398ee304d35b5b5d614c45872ba384e582
parent78b5b5134ae1996e20fba23e9d739f09e1cd0c89
cpp: explicitly manage isl_bool return values

Use isl::mangage(res) when returning isl_bool values, instead of relying
on implicit conversion.

Before this change the following code was generated:

  isl::boolean set::is_empty() const {
    auto res = isl_set_is_empty(get());
    return res;
  }

For this code, the return value of the function was implicitly
constructed from the value res of type isl_bool. As no implicit
constructor isl::boolean(isl_bool) was available, the constructor
isl::boolean(bool) was invoked and isl_bool was implicitly converted to
bool. As part of this conversion, isl_bool_error was converted to true,
which is incorrect. This issue is resolved by explicitly calling "return
isl::manage(res)".

Signed-off-by: Tobias Grosser <tobias@grosser.es>
Signed-off-by: Sven Verdoolaege <sven.verdoolaege@gmail.com>
interface/cpp.cc