Skip to content
Snippets Groups Projects
Select Git revision
1 result Searching

SemaChecking.cpp

  • Richard Trieu's avatar
    40adebec
    Warn on unsigned zero in call to std::max · 40adebec
    Richard Trieu authored
    New default warning that triggers when an unsigned zero is used in a call to
    std::max.  For unsigned values, zero is the minimum value, so any call to
    std::max is always equal to the other value.  A common pattern was to take
    the max of zero and the difference of two unsigned values, not taking into
    account that unsigned values wrap around below zero.  This warning also emits
    a note with a fixit hint to remove the zero and call to std::max.
    
    
    git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@288732 91177308-0d34-0410-b5e6-96231b3b80d8
    40adebec
    History
    Warn on unsigned zero in call to std::max
    Richard Trieu authored
    New default warning that triggers when an unsigned zero is used in a call to
    std::max.  For unsigned values, zero is the minimum value, so any call to
    std::max is always equal to the other value.  A common pattern was to take
    the max of zero and the difference of two unsigned values, not taking into
    account that unsigned values wrap around below zero.  This warning also emits
    a note with a fixit hint to remove the zero and call to std::max.
    
    
    git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@288732 91177308-0d34-0410-b5e6-96231b3b80d8