[all-commits] [llvm/llvm-project] 0ada5c: [Clang] Separate implicit int conversion on negati...

Yutong Zhu via All-commits all-commits at lists.llvm.org
Mon Jun 2 04:27:53 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 0ada5c7b1a52afb668bc42dd2d5573e5805433d1
      https://github.com/llvm/llvm-project/commit/0ada5c7b1a52afb668bc42dd2d5573e5805433d1
  Author: Yutong Zhu <115899167+YutongZhuu at users.noreply.github.com>
  Date:   2025-06-02 (Mon, 02 Jun 2025)

  Changed paths:
    M clang/docs/ReleaseNotes.rst
    M clang/include/clang/Basic/DiagnosticGroups.td
    M clang/include/clang/Basic/DiagnosticSemaKinds.td
    M clang/lib/Sema/SemaChecking.cpp
    A clang/test/Sema/implicit-int-conversion-on-int.c

  Log Message:
  -----------
  [Clang] Separate implicit int conversion on negation sign to new diagnostic group (#139429)

This PR reverts a change made in #126846. 

#126846 introduced an ``-Wimplicit-int-conversion`` diagnosis for 
```c++
int8_t x = something;
x = -x; // warning here
```

This is technically correct since -x could have a width of 9, but this
pattern is common in codebases.

Reverting this change would also introduce the false positive I fixed in
#126846:
```c++
bool b(signed char c) {
  return -c >= 128; // -c can be 128
}
```

This false positive is uncommon, so I think it makes sense to revert the
change.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list