[all-commits] [llvm/llvm-project] c95d58: [clang-tidy] bugprone-assert-side-effect non-const...

schenker via All-commits all-commits at lists.llvm.org
Thu Nov 16 00:53:54 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: c95d5813b823bbb61cd7d676b959e64754098f49
      https://github.com/llvm/llvm-project/commit/c95d5813b823bbb61cd7d676b959e64754098f49
  Author: schenker <thomas.schenker at protonmail.com>
  Date:   2023-11-16 (Thu, 16 Nov 2023)

  Changed paths:
    M clang-tools-extra/clang-tidy/bugprone/AssertSideEffectCheck.cpp
    M clang-tools-extra/docs/ReleaseNotes.rst
    M clang-tools-extra/test/clang-tidy/checkers/bugprone/assert-side-effect.cpp

  Log Message:
  -----------
  [clang-tidy] bugprone-assert-side-effect non-const operator methods (#71974)

With this PR, `bugprone-assert-side-effect` reports non-const calls to
`<<` and `>>` operators and does no longer consider any const operator
calls to have side effects.

E.g. the following snippet is now reported and was previously not:
```
std::stringstream ss;
assert(ss << 1);
```

The following snippet was previously a false-positive and is not
reported anymore:
```
struct {
  int operator+=(int i) const { return i; }
} t;
assert(t += 1);
```




More information about the All-commits mailing list