[cfe-dev] Strange return value of Sema::CheckFunctionReturnType

陳韋任 via cfe-dev cfe-dev at lists.llvm.org
Tue May 2 07:26:30 PDT 2017


Hi All,

  While reading Sema::CheckFunctionReturnType in SemaType.cpp [1], I
find something strange.
>From the context, the return value of CheckFunctionReturnType indicate
something is invalid.
If the check fail, CheckFunctionReturnType returns true.

The other two checks in CheckFunctionReturnType return true as I
expected. But the following
check return 0, which should be false.

    if (T->isObjCObjectType()) {
      Diag(Loc, diag::err_object_cannot_be_passed_returned_by_value) << 0 << T;
      return 0;
    }

Is it a bug? Or I am reading the code wrong?

Thanks.

[1] https://clang.llvm.org/doxygen/SemaType_8cpp_source.html

Regards,
chenwj

-- 
Wei-Ren Chen (陳韋任)
Homepage: https://people.cs.nctu.edu.tw/~chenwj



More information about the cfe-dev mailing list