[PATCH] D54943: [clang-tidy] implement const-transformation for cppcoreguidelines-const-correctness

Florin Iucha via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jan 3 18:59:41 PST 2020


0x8000-0000 added a comment.

Indicated where the new test code should go.



================
Comment at: clang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines-const-correctness-values.cpp:608
+}
+
+template <typename L, typename R>
----------------
Please insert the this test code here:

```
struct IntWrapper {

   unsigned low;
   unsigned high;

   IntWrapper& operator=(unsigned value) {
      low = value & 0xffff;
      high = (value >> 16) & 0xffff;
   }

   template<typename Istream>
   friend Istream& operator>>(Istream& is, IntWrapper& rhs) {
      unsigned someValue = 0;       // false positive now
      if (is >> someValue) {
         rhs = someValue;
      }
      return is;
   }
};

unsigned TestHiddenFriend(IntMaker& im) {
   IntWrapper iw;

   im >> iw;

   return iw.low;
}
```


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D54943/new/

https://reviews.llvm.org/D54943





More information about the cfe-commits mailing list