[PATCH] D76572: Replace `T(x)` with `reinterpret_cast(x)` everywhere it means reinterpret_cast. No functional change

2020-12-27 Thread Roman Lebedev via Phabricator via cfe-commits
lebedev.ri added a comment.

In D76572#2472256 , @Quuxplusone wrote:

> In D76572#2472221 , @lebedev.ri 
> wrote:
>
>> Do you plan to follow-up with the diagnostic itself, in some form?
>
> No, I don't. My diagnostic code was just an ad-hoc noisy hack with no hope of 
> ever passing Clang's test suite.

Huh.

> But @oneraynyday's D89765  will be of 
> interest to you.

Personally, i don't think that patch has hope of being upstreamed in it's 
current form,
introducing a new tool is directly counter-productive for usefulness/user 
adoption.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D76572

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D76572: Replace `T(x)` with `reinterpret_cast(x)` everywhere it means reinterpret_cast. No functional change

2020-12-27 Thread Arthur O'Dwyer via Phabricator via cfe-commits
Quuxplusone added a subscriber: oneraynyday.
Quuxplusone added a comment.

In D76572#2472221 , @lebedev.ri wrote:

> Do you plan to follow-up with the diagnostic itself, in some form?

No, I don't. My diagnostic code was just an ad-hoc noisy hack with no hope of 
ever passing Clang's test suite.
But @oneraynyday's D89765  will be of interest 
to you.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D76572

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D76572: Replace `T(x)` with `reinterpret_cast(x)` everywhere it means reinterpret_cast. No functional change

2020-12-27 Thread Roman Lebedev via Phabricator via cfe-commits
lebedev.ri added a comment.

Do you plan to follow-up with the diagnostic itself, in some form?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D76572

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D76572: Replace `T(x)` with `reinterpret_cast(x)` everywhere it means reinterpret_cast. No functional change

2020-12-22 Thread Arthur O'Dwyer via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG22cf54a7fba6: Replace `T(x)` with 
`reinterpret_castT(x)` everywhere it means… (authored by 
arthur.j.odwyer).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D76572

Files:
  clang/lib/CodeGen/CGCall.h
  llvm/include/llvm/IR/SymbolTableListTraits.h
  llvm/include/llvm/Object/Binary.h
  llvm/lib/CodeGen/AsmPrinter/OcamlGCPrinter.cpp
  llvm/lib/Object/COFFObjectFile.cpp
  llvm/lib/Object/ELFObjectFile.cpp
  llvm/lib/Object/XCOFFObjectFile.cpp
  llvm/lib/Target/Hexagon/HexagonCommonGEP.cpp
  llvm/tools/llvm-readobj/ELFDumper.cpp

Index: llvm/tools/llvm-readobj/ELFDumper.cpp
===
--- llvm/tools/llvm-readobj/ELFDumper.cpp
+++ llvm/tools/llvm-readobj/ELFDumper.cpp
@@ -505,7 +505,9 @@
 ELFDumper::getVersionTable(const Elf_Shdr , ArrayRef *SymTab,
  StringRef *StrTab) const {
   assert((!SymTab && !StrTab) || (SymTab && StrTab));
-  if (uintptr_t(Obj.base() + Sec.sh_offset) % sizeof(uint16_t) != 0)
+  if (reinterpret_cast(Obj.base() + Sec.sh_offset) %
+  sizeof(uint16_t) !=
+  0)
 return createError("the " + describe(Sec) + " is misaligned");
 
   Expected> VersionsOrErr =
@@ -576,7 +578,7 @@
   return createError("invalid " + describe(Sec) + ": version definition " +
  Twine(I) + " goes past the end of the section");
 
-if (uintptr_t(VerdefBuf) % sizeof(uint32_t) != 0)
+if (reinterpret_cast(VerdefBuf) % sizeof(uint32_t) != 0)
   return createError(
   "invalid " + describe(Sec) +
   ": found a misaligned version definition entry at offset 0x" +
@@ -598,7 +600,7 @@
 
 const uint8_t *VerdauxBuf = VerdefBuf + D->vd_aux;
 for (unsigned J = 0; J < D->vd_cnt; ++J) {
-  if (uintptr_t(VerdauxBuf) % sizeof(uint32_t) != 0)
+  if (reinterpret_cast(VerdauxBuf) % sizeof(uint32_t) != 0)
 return createError("invalid " + describe(Sec) +
": found a misaligned auxiliary entry at offset 0x" +
Twine::utohexstr(VerdauxBuf - Start));
@@ -644,7 +646,7 @@
   return createError("invalid " + describe(Sec) + ": version dependency " +
  Twine(I) + " goes past the end of the section");
 
-if (uintptr_t(VerneedBuf) % sizeof(uint32_t) != 0)
+if (reinterpret_cast(VerneedBuf) % sizeof(uint32_t) != 0)
   return createError(
   "invalid " + describe(Sec) +
   ": found a misaligned version dependency entry at offset 0x" +
@@ -670,7 +672,7 @@
 
 const uint8_t *VernauxBuf = VerneedBuf + Verneed->vn_aux;
 for (unsigned J = 0; J < Verneed->vn_cnt; ++J) {
-  if (uintptr_t(VernauxBuf) % sizeof(uint32_t) != 0)
+  if (reinterpret_cast(VernauxBuf) % sizeof(uint32_t) != 0)
 return createError("invalid " + describe(Sec) +
": found a misaligned auxiliary entry at offset 0x" +
Twine::utohexstr(VernauxBuf - Start));
Index: llvm/lib/Target/Hexagon/HexagonCommonGEP.cpp
===
--- llvm/lib/Target/Hexagon/HexagonCommonGEP.cpp
+++ llvm/lib/Target/Hexagon/HexagonCommonGEP.cpp
@@ -472,10 +472,11 @@
   // determining equality. The only purpose of the ordering is to eliminate
   // duplication due to the commutativity of equality/non-equality.
 static NodePair node_pair(GepNode *N1, GepNode *N2) {
-uintptr_t P1 = uintptr_t(N1), P2 = uintptr_t(N2);
-if (P1 <= P2)
-  return std::make_pair(N1, N2);
-return std::make_pair(N2, N1);
+  uintptr_t P1 = reinterpret_cast(N1);
+  uintptr_t P2 = reinterpret_cast(N2);
+  if (P1 <= P2)
+return std::make_pair(N1, N2);
+  return std::make_pair(N2, N1);
 }
 
 static unsigned node_hash(GepNode *N) {
Index: llvm/lib/Object/XCOFFObjectFile.cpp
===
--- llvm/lib/Object/XCOFFObjectFile.cpp
+++ llvm/lib/Object/XCOFFObjectFile.cpp
@@ -31,7 +31,7 @@
 template 
 static Expected getObject(MemoryBufferRef M, const void *Ptr,
  const uint64_t Size = sizeof(T)) {
-  uintptr_t Addr = uintptr_t(Ptr);
+  uintptr_t Addr = reinterpret_cast(Ptr);
   if (Error E = Binary::checkOffset(M, Addr, Size))
 return std::move(E);
   return reinterpret_cast(Addr);
@@ -283,7 +283,7 @@
 
   const uint8_t * ContentStart = base() + OffsetToRaw;
   uint64_t SectionSize = getSectionSize(Sec);
-  if (checkOffset(Data, uintptr_t(ContentStart), SectionSize))
+  if (checkOffset(Data, reinterpret_cast(ContentStart), SectionSize))
 return make_error();
 
   return makeArrayRef(ContentStart,SectionSize);
Index: llvm/lib/Object/ELFObjectFile.cpp
===
--- 

[PATCH] D76572: Replace `T(x)` with `reinterpret_cast(x)` everywhere it means reinterpret_cast. No functional change

2020-12-22 Thread Arthur O'Dwyer via Phabricator via cfe-commits
Quuxplusone updated this revision to Diff 313446.

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D76572

Files:
  clang/lib/CodeGen/CGCall.h
  llvm/include/llvm/IR/SymbolTableListTraits.h
  llvm/include/llvm/Object/Binary.h
  llvm/lib/CodeGen/AsmPrinter/OcamlGCPrinter.cpp
  llvm/lib/Object/COFFObjectFile.cpp
  llvm/lib/Object/ELFObjectFile.cpp
  llvm/lib/Object/XCOFFObjectFile.cpp
  llvm/lib/Target/Hexagon/HexagonCommonGEP.cpp
  llvm/tools/llvm-readobj/ELFDumper.cpp

Index: llvm/tools/llvm-readobj/ELFDumper.cpp
===
--- llvm/tools/llvm-readobj/ELFDumper.cpp
+++ llvm/tools/llvm-readobj/ELFDumper.cpp
@@ -505,7 +505,9 @@
 ELFDumper::getVersionTable(const Elf_Shdr , ArrayRef *SymTab,
  StringRef *StrTab) const {
   assert((!SymTab && !StrTab) || (SymTab && StrTab));
-  if (uintptr_t(Obj.base() + Sec.sh_offset) % sizeof(uint16_t) != 0)
+  if (reinterpret_cast(Obj.base() + Sec.sh_offset) %
+  sizeof(uint16_t) !=
+  0)
 return createError("the " + describe(Sec) + " is misaligned");
 
   Expected> VersionsOrErr =
@@ -576,7 +578,7 @@
   return createError("invalid " + describe(Sec) + ": version definition " +
  Twine(I) + " goes past the end of the section");
 
-if (uintptr_t(VerdefBuf) % sizeof(uint32_t) != 0)
+if (reinterpret_cast(VerdefBuf) % sizeof(uint32_t) != 0)
   return createError(
   "invalid " + describe(Sec) +
   ": found a misaligned version definition entry at offset 0x" +
@@ -598,7 +600,7 @@
 
 const uint8_t *VerdauxBuf = VerdefBuf + D->vd_aux;
 for (unsigned J = 0; J < D->vd_cnt; ++J) {
-  if (uintptr_t(VerdauxBuf) % sizeof(uint32_t) != 0)
+  if (reinterpret_cast(VerdauxBuf) % sizeof(uint32_t) != 0)
 return createError("invalid " + describe(Sec) +
": found a misaligned auxiliary entry at offset 0x" +
Twine::utohexstr(VerdauxBuf - Start));
@@ -644,7 +646,7 @@
   return createError("invalid " + describe(Sec) + ": version dependency " +
  Twine(I) + " goes past the end of the section");
 
-if (uintptr_t(VerneedBuf) % sizeof(uint32_t) != 0)
+if (reinterpret_cast(VerneedBuf) % sizeof(uint32_t) != 0)
   return createError(
   "invalid " + describe(Sec) +
   ": found a misaligned version dependency entry at offset 0x" +
@@ -670,7 +672,7 @@
 
 const uint8_t *VernauxBuf = VerneedBuf + Verneed->vn_aux;
 for (unsigned J = 0; J < Verneed->vn_cnt; ++J) {
-  if (uintptr_t(VernauxBuf) % sizeof(uint32_t) != 0)
+  if (reinterpret_cast(VernauxBuf) % sizeof(uint32_t) != 0)
 return createError("invalid " + describe(Sec) +
": found a misaligned auxiliary entry at offset 0x" +
Twine::utohexstr(VernauxBuf - Start));
Index: llvm/lib/Target/Hexagon/HexagonCommonGEP.cpp
===
--- llvm/lib/Target/Hexagon/HexagonCommonGEP.cpp
+++ llvm/lib/Target/Hexagon/HexagonCommonGEP.cpp
@@ -472,10 +472,11 @@
   // determining equality. The only purpose of the ordering is to eliminate
   // duplication due to the commutativity of equality/non-equality.
 static NodePair node_pair(GepNode *N1, GepNode *N2) {
-uintptr_t P1 = uintptr_t(N1), P2 = uintptr_t(N2);
-if (P1 <= P2)
-  return std::make_pair(N1, N2);
-return std::make_pair(N2, N1);
+  uintptr_t P1 = reinterpret_cast(N1);
+  uintptr_t P2 = reinterpret_cast(N2);
+  if (P1 <= P2)
+return std::make_pair(N1, N2);
+  return std::make_pair(N2, N1);
 }
 
 static unsigned node_hash(GepNode *N) {
Index: llvm/lib/Object/XCOFFObjectFile.cpp
===
--- llvm/lib/Object/XCOFFObjectFile.cpp
+++ llvm/lib/Object/XCOFFObjectFile.cpp
@@ -31,7 +31,7 @@
 template 
 static Expected getObject(MemoryBufferRef M, const void *Ptr,
  const uint64_t Size = sizeof(T)) {
-  uintptr_t Addr = uintptr_t(Ptr);
+  uintptr_t Addr = reinterpret_cast(Ptr);
   if (Error E = Binary::checkOffset(M, Addr, Size))
 return std::move(E);
   return reinterpret_cast(Addr);
@@ -283,7 +283,7 @@
 
   const uint8_t * ContentStart = base() + OffsetToRaw;
   uint64_t SectionSize = getSectionSize(Sec);
-  if (checkOffset(Data, uintptr_t(ContentStart), SectionSize))
+  if (checkOffset(Data, reinterpret_cast(ContentStart), SectionSize))
 return make_error();
 
   return makeArrayRef(ContentStart,SectionSize);
Index: llvm/lib/Object/ELFObjectFile.cpp
===
--- llvm/lib/Object/ELFObjectFile.cpp
+++ llvm/lib/Object/ELFObjectFile.cpp
@@ -73,7 +73,8 @@
   std::pair Ident =
   getElfArchType(Obj.getBuffer());
   std::size_t MaxAlignment =
-   

[PATCH] D76572: Replace `T(x)` with `reinterpret_cast(x)` everywhere it means reinterpret_cast. No functional change

2020-12-22 Thread Arthur O'Dwyer via Phabricator via cfe-commits
Quuxplusone updated this revision to Diff 313433.
Quuxplusone edited the summary of this revision.
Quuxplusone added a comment.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Rebase in preparation for finally pushing this thing if the buildbots seem 
happy.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D76572

Files:
  clang/lib/CodeGen/CGCall.h
  llvm/include/llvm/IR/SymbolTableListTraits.h
  llvm/include/llvm/Object/Binary.h
  llvm/lib/CodeGen/AsmPrinter/OcamlGCPrinter.cpp
  llvm/lib/Object/COFFObjectFile.cpp
  llvm/lib/Object/ELFObjectFile.cpp
  llvm/lib/Object/XCOFFObjectFile.cpp
  llvm/lib/Target/Hexagon/HexagonCommonGEP.cpp
  llvm/tools/llvm-readobj/ELFDumper.cpp

Index: llvm/tools/llvm-readobj/ELFDumper.cpp
===
--- llvm/tools/llvm-readobj/ELFDumper.cpp
+++ llvm/tools/llvm-readobj/ELFDumper.cpp
@@ -505,7 +505,9 @@
 ELFDumper::getVersionTable(const Elf_Shdr , ArrayRef *SymTab,
  StringRef *StrTab) const {
   assert((!SymTab && !StrTab) || (SymTab && StrTab));
-  if (uintptr_t(Obj.base() + Sec.sh_offset) % sizeof(uint16_t) != 0)
+  if (reinterpret_cast(Obj.base() + Sec.sh_offset) %
+  sizeof(uint16_t) !=
+  0)
 return createError("the " + describe(Sec) + " is misaligned");
 
   Expected> VersionsOrErr =
@@ -576,7 +578,7 @@
   return createError("invalid " + describe(Sec) + ": version definition " +
  Twine(I) + " goes past the end of the section");
 
-if (uintptr_t(VerdefBuf) % sizeof(uint32_t) != 0)
+if (reinterpret_cast(VerdefBuf) % sizeof(uint32_t) != 0)
   return createError(
   "invalid " + describe(Sec) +
   ": found a misaligned version definition entry at offset 0x" +
@@ -598,7 +600,7 @@
 
 const uint8_t *VerdauxBuf = VerdefBuf + D->vd_aux;
 for (unsigned J = 0; J < D->vd_cnt; ++J) {
-  if (uintptr_t(VerdauxBuf) % sizeof(uint32_t) != 0)
+  if (reinterpret_cast(VerdauxBuf) % sizeof(uint32_t) != 0)
 return createError("invalid " + describe(Sec) +
": found a misaligned auxiliary entry at offset 0x" +
Twine::utohexstr(VerdauxBuf - Start));
@@ -644,7 +646,7 @@
   return createError("invalid " + describe(Sec) + ": version dependency " +
  Twine(I) + " goes past the end of the section");
 
-if (uintptr_t(VerneedBuf) % sizeof(uint32_t) != 0)
+if (reinterpret_cast(VerneedBuf) % sizeof(uint32_t) != 0)
   return createError(
   "invalid " + describe(Sec) +
   ": found a misaligned version dependency entry at offset 0x" +
@@ -670,7 +672,7 @@
 
 const uint8_t *VernauxBuf = VerneedBuf + Verneed->vn_aux;
 for (unsigned J = 0; J < Verneed->vn_cnt; ++J) {
-  if (uintptr_t(VernauxBuf) % sizeof(uint32_t) != 0)
+  if (reinterpret_cast(VernauxBuf) % sizeof(uint32_t) != 0)
 return createError("invalid " + describe(Sec) +
": found a misaligned auxiliary entry at offset 0x" +
Twine::utohexstr(VernauxBuf - Start));
Index: llvm/lib/Target/Hexagon/HexagonCommonGEP.cpp
===
--- llvm/lib/Target/Hexagon/HexagonCommonGEP.cpp
+++ llvm/lib/Target/Hexagon/HexagonCommonGEP.cpp
@@ -472,10 +472,11 @@
   // determining equality. The only purpose of the ordering is to eliminate
   // duplication due to the commutativity of equality/non-equality.
 static NodePair node_pair(GepNode *N1, GepNode *N2) {
-uintptr_t P1 = uintptr_t(N1), P2 = uintptr_t(N2);
-if (P1 <= P2)
-  return std::make_pair(N1, N2);
-return std::make_pair(N2, N1);
+  uintptr_t P1 = reinterpret_cast(N1);
+  uintptr_t P2 = reinterpret_cast(N2);
+  if (P1 <= P2)
+return std::make_pair(N1, N2);
+  return std::make_pair(N2, N1);
 }
 
 static unsigned node_hash(GepNode *N) {
Index: llvm/lib/Object/XCOFFObjectFile.cpp
===
--- llvm/lib/Object/XCOFFObjectFile.cpp
+++ llvm/lib/Object/XCOFFObjectFile.cpp
@@ -31,7 +31,7 @@
 template 
 static Expected getObject(MemoryBufferRef M, const void *Ptr,
  const uint64_t Size = sizeof(T)) {
-  uintptr_t Addr = uintptr_t(Ptr);
+  uintptr_t Addr = reinterpret_cast(Ptr);
   if (Error E = Binary::checkOffset(M, Addr, Size))
 return std::move(E);
   return reinterpret_cast(Addr);
@@ -283,7 +283,7 @@
 
   const uint8_t * ContentStart = base() + OffsetToRaw;
   uint64_t SectionSize = getSectionSize(Sec);
-  if (checkOffset(Data, uintptr_t(ContentStart), SectionSize))
+  if (checkOffset(Data, reinterpret_cast(ContentStart), SectionSize))
 return make_error();
 
   return makeArrayRef(ContentStart,SectionSize);
Index: llvm/lib/Object/ELFObjectFile.cpp

[PATCH] D76572: Replace `T(x)` with `reinterpret_cast(x)` everywhere it means reinterpret_cast. No functional change

2020-04-03 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak added a comment.

I'm not sure which part I'm supposed to look at, but the changes LGTM.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D76572



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D76572: Replace `T(x)` with `reinterpret_cast(x)` everywhere it means reinterpret_cast. No functional change

2020-04-03 Thread Michael Spencer via Phabricator via cfe-commits
Bigcheese accepted this revision.
Bigcheese added a comment.

LGTM for llvm/{lib,include/llvm}/Object/* and llvm/tools/llvm-readobj/*.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D76572



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D76572: Replace `T(x)` with `reinterpret_cast(x)` everywhere it means reinterpret_cast. No functional change

2020-04-03 Thread Roman Lebedev via Phabricator via cfe-commits
lebedev.ri added a comment.

All these changes are rather NFCI, i'm not sure each one needs to be reviewed.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D76572



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D76572: Replace `T(x)` with `reinterpret_cast(x)` everywhere it means reinterpret_cast. No functional change

2020-04-03 Thread Arthur O'Dwyer via Phabricator via cfe-commits
Quuxplusone added subscribers: kparzysz, Bigcheese.
Quuxplusone added a comment.

Ah. Then I'm not sure who else to ping, or even which pieces remain in need of 
review.
CODE_OWNERS.TXT isn't being very helpful here...
@kparzysz for HexagonCommonGEP.cpp ("Hexagon backend")?
@Bigcheese for Binary.h ("Object")?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D76572



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D76572: Replace `T(x)` with `reinterpret_cast(x)` everywhere it means reinterpret_cast. No functional change

2020-04-03 Thread Hubert Tong via Phabricator via cfe-commits
hubert.reinterpretcast added a comment.

I am guessing @DiggerLin was pinged with regards to `XCOFFObjectFile.cpp`. 
@jhenderson already reviewed and approved the changes to that file (it falls 
under libObject).


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D76572



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D76572: Replace `T(x)` with `reinterpret_cast(x)` everywhere it means reinterpret_cast. No functional change

2020-04-03 Thread Arthur O'Dwyer via Phabricator via cfe-commits
Quuxplusone marked an inline comment as done.
Quuxplusone added a comment.

@DiggerLin @ahatanak @espindola @reames Gentle ping!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D76572



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D76572: Replace `T(x)` with `reinterpret_cast(x)` everywhere it means reinterpret_cast. No functional change

2020-03-27 Thread Stephan Bergmann via Phabricator via cfe-commits
sberg added a comment.

In D76572#1936935 , @grandinj wrote:

> In D76572#1936861 , @Quuxplusone 
> wrote:
>
> > Nice. Does LibreOffice have anything (either in clang-tidy or in a paper 
> > guideline) against `T(x)`-style casts? E.g.
>
>
> No, we don't have very many of those in our codebase, so we have left them 
> alone.
>  Our plugin is designed to convert c-style casts to modern C++ casts.


Heh, I've meanwhile improved LibreOffice's cstylecast check now (after I'd read 
only the first few initial comments here), to also flag function-style casts 
that should be const_/reinterpret_cast, and it indeed only found a handful of 
cases that would better be reinterpret_cast 
(https://gerrit.libreoffice.org/plugins/gitiles/core/+/1ebeacb20ad0165e399629fcfd7795ad0da3edf8%5E!/
 "Extend loplugin:cstylecast to certain function-style casts").  Though in two 
of those places it conveniently unearthed code that should rather do without 
any kind of casting (addressed with follow-up 
https://gerrit.libreoffice.org/plugins/gitiles/core/+/741d30b5e1b0dcdbafb300ed7c7ad46756ffd946%5E!/
 "Simplify pointer equality comparison" and 
https://gerrit.libreoffice.org/plugins/gitiles/core/+/e3196f3dddad6e7825db3b35e8196be35b466fd9%5E!/
 "Fix pointer equality comparision").


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D76572



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D76572: Replace `T(x)` with `reinterpret_cast(x)` everywhere it means reinterpret_cast. No functional change

2020-03-26 Thread James Henderson via Phabricator via cfe-commits
jhenderson added a comment.

In D76572#1942024 , @Quuxplusone wrote:

> Btw, @jhenderson and @rsmith, if you wanted to land your own files' pieces of 
> this patch while waiting on whoever-it-is to approve the pieces in other 
> files, that'd be cool. As I mentioned initially, I don't have the access 
> necessary to land any part of it myself.


From my point of view, I don't see any particular rush to land this, so let's 
just keep it all as one, and wait for the other bits to be reviewed.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D76572



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D76572: Replace `T(x)` with `reinterpret_cast(x)` everywhere it means reinterpret_cast. No functional change

2020-03-25 Thread Arthur O'Dwyer via Phabricator via cfe-commits
Quuxplusone marked 2 inline comments as done.
Quuxplusone added a comment.

Btw, @jhenderson and @rsmith, if you wanted to land your own files' pieces of 
this patch while waiting on whoever-it-is to approve the pieces in other files, 
that'd be cool. As I mentioned initially, I don't have the access necessary to 
land any part of it myself.




Comment at: llvm/lib/CodeGen/AsmPrinter/OcamlGCPrinter.cpp:150
+ ">= 65536.\n"
+ "(" +
+ Twine(reinterpret_cast()) + ")");

jhenderson wrote:
> Nit: I think you can fold these two string literals together. Not sure why 
> they were separate before.
I think the current code is intentionally parallel to what's on line 162, so 
I'd prefer to leave it alone and let whoever maintains it reflow it if they 
want.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D76572



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D76572: Replace `T(x)` with `reinterpret_cast(x)` everywhere it means reinterpret_cast. No functional change

2020-03-25 Thread James Henderson via Phabricator via cfe-commits
jhenderson accepted this revision.
jhenderson added a comment.

LGTM, with nit, with regards to the llvm-readobj and libObject parts. I haven't 
looked at the other bits though.




Comment at: llvm/lib/CodeGen/AsmPrinter/OcamlGCPrinter.cpp:150
+ ">= 65536.\n"
+ "(" +
+ Twine(reinterpret_cast()) + ")");

Nit: I think you can fold these two string literals together. Not sure why they 
were separate before.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D76572



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D76572: Replace `T(x)` with `reinterpret_cast(x)` everywhere it means reinterpret_cast. No functional change

2020-03-23 Thread Richard Smith - zygoloid via Phabricator via cfe-commits
rsmith added a comment.

In D76572#1937641 , @Quuxplusone wrote:

> [...] take my word for it, you **don't** want to start with the code I wrote 
> the other day. :)


Understood, thanks :) (FWIW, I had a stab at implementing essentially this last 
year and hit exactly the issues you highlighted.)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D76572



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D76572: Replace `T(x)` with `reinterpret_cast(x)` everywhere it means reinterpret_cast. No functional change

2020-03-23 Thread Arthur O'Dwyer via Phabricator via cfe-commits
Quuxplusone added a comment.

In D76572#1937558 , @rsmith wrote:

> In D76572#1935791 , @lebedev.ri 
> wrote:
>
> > Passing-by remark:
> >
> > > I wrote a Clang warning [not pictured] to diagnose any use of `T(x)` 
> > > which was not equivalent to `static_cast(x)`.
> >
> > I'm not sure whether or not this will pass the bar for a clang diagnostic
>
>
> I'd like to try it out on a larger codebase, but it sounds at least 
> potentially good to me. There's a simple syntactic workaround (use `(T)x` 
> instead of `T(x)`), and there's a high likelihood that the code doesn't mean 
> what the programmer intended.
>
> Does the warning catch the cases where the code is equivalent to 
> `static_cast(x)` except that it ignores access? That seems like a really 
> good thing to warn on regardless of whether we warn on the general case.


Yes, I verified with some simple test cases that it catches the equivalents of 
(1) reinterpret_cast, (2) const_cast, (3) const_cast plus static_cast, (4) 
upcast to private base, and (5) downcast to private base.
However, the thing I wrote is 100% **not** ready for prime time. It basically 
just inserts a call to `TryStaticCast` from inside `CheckCXXCStyleCast`. 
Unfortunately `TryStaticCast` is one of these functions that Clang is full of, 
where it both "checks if X is possible" and also "does X" and also "prints 
error messages to stdout," all from within the same function. So my patch ends 
up being morally equivalent to just treating `T(x)` as `static_cast(x)`; it 
emits some errors that shouldn't be there if it's supposed to just warn, and I 
have no idea how to shut up those errors except by completely refactoring 
`TryCast`. (E.g., it could take an extra parameter `Mode` that indicated 
whether to actually do the conversion, or just report whether it was possible, 
or emit notes about why it was impossible.) I wrestled unsuccessfully with 
similar issues when I did `-Wreturn-std-move`.

I 100% want to see someone like you tackle this issue, but take my word for it, 
you **don't** want to start with the code I wrote the other day. :)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D76572



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D76572: Replace `T(x)` with `reinterpret_cast(x)` everywhere it means reinterpret_cast. No functional change

2020-03-23 Thread Richard Smith - zygoloid via Phabricator via cfe-commits
rsmith accepted this revision.
rsmith added a comment.
This revision is now accepted and ready to land.

Changes LGTM on the Clang side.

In D76572#1935791 , @lebedev.ri wrote:

> Passing-by remark:
>
> > I wrote a Clang warning [not pictured] to diagnose any use of `T(x)` which 
> > was not equivalent to `static_cast(x)`.
>
> I'm not sure whether or not this will pass the bar for a clang diagnostic


I'd like to try it out on a larger codebase, but it sounds at least potentially 
good to me. There's a simple syntactic workaround (use `(T)x` instead of 
`T(x)`), and there's a high likelihood that the code doesn't mean what the 
programmer intended.

Does the warning catch the cases where the code is equivalent to 
`static_cast(x)` except that it ignores access? That seems like a really 
good thing to warn on regardless of whether we warn on the general case.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D76572



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D76572: Replace `T(x)` with `reinterpret_cast(x)` everywhere it means reinterpret_cast. No functional change

2020-03-23 Thread Noel Grandin via Phabricator via cfe-commits
grandinj added a comment.

In D76572#1936861 , @Quuxplusone wrote:

> Nice. Does LibreOffice have anything (either in clang-tidy or in a paper 
> guideline) against `T(x)`-style casts? E.g.


No, we don't have very many of those in our codebase, so we have left them 
alone.
Our plugin is designed to convert c-style casts to modern C++ casts.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D76572



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D76572: Replace `T(x)` with `reinterpret_cast(x)` everywhere it means reinterpret_cast. No functional change

2020-03-23 Thread Arthur O'Dwyer via Phabricator via cfe-commits
Quuxplusone updated this revision to Diff 252031.
Quuxplusone added a comment.

@jhenderson: Updated! clang-format's suggested linebreaks look horrendous to 
me, but if this makes that buildbot happy, okay... I guess the moral of the 
story is "deeply nested expressions that also use lots of reinterpret_casts, 
should be avoided," and I can't argue with that. ;)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D76572

Files:
  clang/lib/CodeGen/CGCall.h
  llvm/include/llvm/IR/SymbolTableListTraits.h
  llvm/include/llvm/Object/Binary.h
  llvm/lib/CodeGen/AsmPrinter/OcamlGCPrinter.cpp
  llvm/lib/Object/COFFObjectFile.cpp
  llvm/lib/Object/ELFObjectFile.cpp
  llvm/lib/Object/XCOFFObjectFile.cpp
  llvm/lib/Target/Hexagon/HexagonCommonGEP.cpp
  llvm/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp
  llvm/tools/llvm-readobj/ELFDumper.cpp

Index: llvm/tools/llvm-readobj/ELFDumper.cpp
===
--- llvm/tools/llvm-readobj/ELFDumper.cpp
+++ llvm/tools/llvm-readobj/ELFDumper.cpp
@@ -443,7 +443,9 @@
   const ELFFile *Obj = ObjF->getELFFile();
   unsigned SecNdx = Sec - (Obj->sections()).front();
 
-  if (uintptr_t(Obj->base() + Sec->sh_offset) % sizeof(uint16_t) != 0)
+  if (reinterpret_cast(Obj->base() + Sec->sh_offset) %
+  sizeof(uint16_t) !=
+  0)
 return createError("the SHT_GNU_versym section with index " +
Twine(SecNdx) + " is misaligned");
 
@@ -522,7 +524,7 @@
  Twine(SecNdx) + ": version definition " + Twine(I) +
  " goes past the end of the section");
 
-if (uintptr_t(VerdefBuf) % sizeof(uint32_t) != 0)
+if (reinterpret_cast(VerdefBuf) % sizeof(uint32_t) != 0)
   return createError(
   "invalid SHT_GNU_verdef section with index " + Twine(SecNdx) +
   ": found a misaligned version definition entry at offset 0x" +
@@ -545,7 +547,7 @@
 
 const uint8_t *VerdauxBuf = VerdefBuf + D->vd_aux;
 for (unsigned J = 0; J < D->vd_cnt; ++J) {
-  if (uintptr_t(VerdauxBuf) % sizeof(uint32_t) != 0)
+  if (reinterpret_cast(VerdauxBuf) % sizeof(uint32_t) != 0)
 return createError("invalid SHT_GNU_verdef section with index " +
Twine(SecNdx) +
": found a misaligned auxiliary entry at offset 0x" +
@@ -597,7 +599,7 @@
  Twine(SecNdx) + ": version dependency " + Twine(I) +
  " goes past the end of the section");
 
-if (uintptr_t(VerneedBuf) % sizeof(uint32_t) != 0)
+if (reinterpret_cast(VerneedBuf) % sizeof(uint32_t) != 0)
   return createError(
   "invalid SHT_GNU_verneed section with index " + Twine(SecNdx) +
   ": found a misaligned version dependency entry at offset 0x" +
@@ -624,7 +626,7 @@
 
 const uint8_t *VernauxBuf = VerneedBuf + Verneed->vn_aux;
 for (unsigned J = 0; J < Verneed->vn_cnt; ++J) {
-  if (uintptr_t(VernauxBuf) % sizeof(uint32_t) != 0)
+  if (reinterpret_cast(VernauxBuf) % sizeof(uint32_t) != 0)
 return createError("invalid SHT_GNU_verneed section with index " +
Twine(SecNdx) +
": found a misaligned auxiliary entry at offset 0x" +
Index: llvm/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp
===
--- llvm/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp
+++ llvm/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp
@@ -619,14 +619,15 @@
 ArgTLS = nullptr;
 GetArgTLSTy = FunctionType::get(PointerType::getUnqual(ArgTLSTy), false);
 GetArgTLS = ConstantExpr::getIntToPtr(
-ConstantInt::get(IntptrTy, uintptr_t(GetArgTLSPtr)),
+ConstantInt::get(IntptrTy, reinterpret_cast(GetArgTLSPtr)),
 PointerType::getUnqual(GetArgTLSTy));
   }
   if (GetRetvalTLSPtr) {
 RetvalTLS = nullptr;
 GetRetvalTLSTy = FunctionType::get(PointerType::getUnqual(ShadowTy), false);
 GetRetvalTLS = ConstantExpr::getIntToPtr(
-ConstantInt::get(IntptrTy, uintptr_t(GetRetvalTLSPtr)),
+ConstantInt::get(IntptrTy,
+ reinterpret_cast(GetRetvalTLSPtr)),
 PointerType::getUnqual(GetRetvalTLSTy));
   }
 
Index: llvm/lib/Target/Hexagon/HexagonCommonGEP.cpp
===
--- llvm/lib/Target/Hexagon/HexagonCommonGEP.cpp
+++ llvm/lib/Target/Hexagon/HexagonCommonGEP.cpp
@@ -482,10 +482,11 @@
   // determining equality. The only purpose of the ordering is to eliminate
   // duplication due to the commutativity of equality/non-equality.
 static NodePair node_pair(GepNode *N1, GepNode *N2) {
-uintptr_t P1 = uintptr_t(N1), P2 = uintptr_t(N2);
-if (P1 <= P2)
-  return std::make_pair(N1, N2);
-return std::make_pair(N2, N1);
+  uintptr_t P1 = 

[PATCH] D76572: Replace `T(x)` with `reinterpret_cast(x)` everywhere it means reinterpret_cast. No functional change

2020-03-23 Thread Arthur O'Dwyer via Phabricator via cfe-commits
Quuxplusone added a comment.

In D76572#1936191 , @grandinj wrote:

> Libreoffice has a similar clang-tidy-style cast-checker [for C-style casts] 
> here:
>
> https://cgit.freedesktop.org/libreoffice/core/tree/compilerplugins/clang/cstylecast.cxx
>  
> https://cgit.freedesktop.org/libreoffice/core/tree/compilerplugins/clang/test/cstylecast.cxx


Nice. Does LibreOffice have anything (either in clang-tidy or in a paper 
guideline) against `T(x)`-style casts? E.g.

  struct PB {};
  struct D : private PB {};
  using FloatRef = float&;
  using IntPtr = int*;
  using PBPtr = PB*;
  int i = 42;
  const int *cpi = 
  D *pd = nullptr;
  float& f = FloatRef(i);  // reinterpret_cast
  int *pi = IntPtr(cpi);  // const_cast
  PB *pb = PBPtr(pd);  // cast to private base


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D76572



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D76572: Replace `T(x)` with `reinterpret_cast(x)` everywhere it means reinterpret_cast. No functional change

2020-03-23 Thread James Henderson via Phabricator via cfe-commits
jhenderson added a comment.

@Quuxplusone - did you see that there are several clang-format warnings 
reported against these changes? Please could you fix them.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D76572



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D76572: Replace `T(x)` with `reinterpret_cast(x)` everywhere it means reinterpret_cast. No functional change

2020-03-23 Thread Noel Grandin via Phabricator via cfe-commits
grandinj added a comment.

Libreoffice has a similar clang-tidy-style cast-checker here:

https://cgit.freedesktop.org/libreoffice/core/tree/compilerplugins/clang/cstylecast.cxx
https://cgit.freedesktop.org/libreoffice/core/tree/compilerplugins/clang/test/cstylecast.cxx


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D76572



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D76572: Replace `T(x)` with `reinterpret_cast(x)` everywhere it means reinterpret_cast. No functional change

2020-03-22 Thread Roman Lebedev via Phabricator via cfe-commits
lebedev.ri added a comment.

Passing-by remark:

> I wrote a Clang warning [not pictured] to diagnose any use of `T(x)` which 
> was not equivalent to `static_cast(x)`.

I'm not sure whether or not this will pass the bar for a clang diagnostic,
but that does sound like a good clang-tidy readability check.

I also have a bit of pet peeve with `T(x)` (i.e. including those that should be 
`static_cast<>`),
so if you do go with clang-tidy direction, it may be good to generalize it to 
handle all `T(x)`,
but diagnose only those cast types that are specified in the config.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D76572



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D76572: Replace `T(x)` with `reinterpret_cast(x)` everywhere it means reinterpret_cast. No functional change

2020-03-22 Thread Arthur O'Dwyer via Phabricator via cfe-commits
Quuxplusone created this revision.
Quuxplusone added reviewers: rsmith, espindola, DiggerLin, ahatanak, reames.
Herald added subscribers: cfe-commits, rupprecht, dexonsmith, MaskRay, 
hiraditya.
Herald added a reviewer: jhenderson.
Herald added a project: clang.

I wrote a Clang warning [not pictured] to diagnose any use of `T(x)` which was 
not equivalent to `static_cast(x)`. Then I built Clang with that warning 
turned on. Here are all of the instances of "unsafe" `T(x)` that it identified 
in the codebase. Every single one is a cast from some pointer type to 
`uintptr_t`.

N.B.: The code in `llvm/IR/SymbolTableListTraits.h` looks absolutely crazy, and 
this will be the first time it's been touched in over a decade.

If this refactor is acceptable, I'll need someone to land it for me, as I don't 
have permissions.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D76572

Files:
  clang/lib/CodeGen/CGCall.h
  llvm/include/llvm/IR/SymbolTableListTraits.h
  llvm/include/llvm/Object/Binary.h
  llvm/lib/CodeGen/AsmPrinter/OcamlGCPrinter.cpp
  llvm/lib/Object/COFFObjectFile.cpp
  llvm/lib/Object/ELFObjectFile.cpp
  llvm/lib/Object/XCOFFObjectFile.cpp
  llvm/lib/Target/Hexagon/HexagonCommonGEP.cpp
  llvm/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp
  llvm/tools/llvm-readobj/ELFDumper.cpp

Index: llvm/tools/llvm-readobj/ELFDumper.cpp
===
--- llvm/tools/llvm-readobj/ELFDumper.cpp
+++ llvm/tools/llvm-readobj/ELFDumper.cpp
@@ -443,7 +443,7 @@
   const ELFFile *Obj = ObjF->getELFFile();
   unsigned SecNdx = Sec - (Obj->sections()).front();
 
-  if (uintptr_t(Obj->base() + Sec->sh_offset) % sizeof(uint16_t) != 0)
+  if (reinterpret_cast(Obj->base() + Sec->sh_offset) % sizeof(uint16_t) != 0)
 return createError("the SHT_GNU_versym section with index " +
Twine(SecNdx) + " is misaligned");
 
@@ -522,7 +522,7 @@
  Twine(SecNdx) + ": version definition " + Twine(I) +
  " goes past the end of the section");
 
-if (uintptr_t(VerdefBuf) % sizeof(uint32_t) != 0)
+if (reinterpret_cast(VerdefBuf) % sizeof(uint32_t) != 0)
   return createError(
   "invalid SHT_GNU_verdef section with index " + Twine(SecNdx) +
   ": found a misaligned version definition entry at offset 0x" +
@@ -545,7 +545,7 @@
 
 const uint8_t *VerdauxBuf = VerdefBuf + D->vd_aux;
 for (unsigned J = 0; J < D->vd_cnt; ++J) {
-  if (uintptr_t(VerdauxBuf) % sizeof(uint32_t) != 0)
+  if (reinterpret_cast(VerdauxBuf) % sizeof(uint32_t) != 0)
 return createError("invalid SHT_GNU_verdef section with index " +
Twine(SecNdx) +
": found a misaligned auxiliary entry at offset 0x" +
@@ -597,7 +597,7 @@
  Twine(SecNdx) + ": version dependency " + Twine(I) +
  " goes past the end of the section");
 
-if (uintptr_t(VerneedBuf) % sizeof(uint32_t) != 0)
+if (reinterpret_cast(VerneedBuf) % sizeof(uint32_t) != 0)
   return createError(
   "invalid SHT_GNU_verneed section with index " + Twine(SecNdx) +
   ": found a misaligned version dependency entry at offset 0x" +
@@ -624,7 +624,7 @@
 
 const uint8_t *VernauxBuf = VerneedBuf + Verneed->vn_aux;
 for (unsigned J = 0; J < Verneed->vn_cnt; ++J) {
-  if (uintptr_t(VernauxBuf) % sizeof(uint32_t) != 0)
+  if (reinterpret_cast(VernauxBuf) % sizeof(uint32_t) != 0)
 return createError("invalid SHT_GNU_verneed section with index " +
Twine(SecNdx) +
": found a misaligned auxiliary entry at offset 0x" +
Index: llvm/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp
===
--- llvm/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp
+++ llvm/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp
@@ -619,14 +619,14 @@
 ArgTLS = nullptr;
 GetArgTLSTy = FunctionType::get(PointerType::getUnqual(ArgTLSTy), false);
 GetArgTLS = ConstantExpr::getIntToPtr(
-ConstantInt::get(IntptrTy, uintptr_t(GetArgTLSPtr)),
+ConstantInt::get(IntptrTy, reinterpret_cast(GetArgTLSPtr)),
 PointerType::getUnqual(GetArgTLSTy));
   }
   if (GetRetvalTLSPtr) {
 RetvalTLS = nullptr;
 GetRetvalTLSTy = FunctionType::get(PointerType::getUnqual(ShadowTy), false);
 GetRetvalTLS = ConstantExpr::getIntToPtr(
-ConstantInt::get(IntptrTy, uintptr_t(GetRetvalTLSPtr)),
+ConstantInt::get(IntptrTy, reinterpret_cast(GetRetvalTLSPtr)),
 PointerType::getUnqual(GetRetvalTLSTy));
   }
 
Index: llvm/lib/Target/Hexagon/HexagonCommonGEP.cpp
===
--- llvm/lib/Target/Hexagon/HexagonCommonGEP.cpp
+++ llvm/lib/Target/Hexagon/HexagonCommonGEP.cpp
@@ -482,7 +482,8 @@
   // determining