[clang] [AST] Use explicit type erasure in TypeSourceInfo constructor (PR #68435)

via cfe-commits cfe-commits at lists.llvm.org
Tue Oct 10 00:38:16 PDT 2023


================
@@ -243,7 +243,7 @@ class TypeLoc {
 
 inline TypeSourceInfo::TypeSourceInfo(QualType ty, size_t DataSize) : Ty(ty) {
   // Init data attached to the object. See getTypeLoc.
-  memset(this + 1, 0, DataSize);
+  memset(const_cast<void *>(static_cast<const void *>(this + 1)), 0, DataSize);
----------------
cor3ntin wrote:

```suggestion
  memset(static_cast<void *>(this + 1), 0, DataSize);
```

This should be enough, right?

https://github.com/llvm/llvm-project/pull/68435


More information about the cfe-commits mailing list