[llvm-dev] Non-void function does not return value

Luo, Xionghu via llvm-dev llvm-dev at lists.llvm.org
Tue May 10 23:07:13 PDT 2016


Hi Chandler,
I scanned the LLVM source code, and found some potential code issues, take the piece of code in file './include/llvm/Support/Allocator.h' for example:


80

  /// \brief Deallocate space for a sequence of objects without constructing them.

81

  template <typename T>

82

  typename std::enable_if<

83

      !std::is_same<typename std::remove_cv<T>::type, void>::value, void>::type

84

[https://otckw.jf.intel.com:8080/review/review/images/folding/collapse_top.png]

  Deallocate(T *Ptr, size_t Num = 1) {

85

    Deallocate(static_cast<const void *>(Ptr), Num * sizeof(T));

86

[https://otckw.jf.intel.com:8080/review/review/images/folding/collapse_bottom.png]

  }



If the typename T is void, the std::is_same will be FALSE, which means the std::enable_if::type is UNDEFIED.
So do you think it need a fix?
Thanks.


Luo Xionghu
Best Regards

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20160511/9f5c7393/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image005.png
Type: image/png
Size: 478 bytes
Desc: image005.png
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20160511/9f5c7393/attachment.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image006.png
Type: image/png
Size: 476 bytes
Desc: image006.png
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20160511/9f5c7393/attachment-0001.png>


More information about the llvm-dev mailing list