[PATCH] D92512: ADT: Change AlignedCharArrayUnion to an alias of std::aligned_union_t, NFC

Shafik Yaghmour via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Dec 2 15:34:51 PST 2020


shafik added inline comments.


================
Comment at: clang/include/clang/AST/APValue.h:405
     assert(isInt() && "Invalid accessor");
-    return *(APSInt*)(char*)Data.buffer;
+    return *(APSInt *)(char *)&Data;
   }
----------------
I notice that in `ASTTypeTraits.h` we use `reinterpret_cast` while here we revert to C-style casts.


================
Comment at: clang/include/clang/AST/APValue.h:511
     assert(isArray() && "Invalid accessor");
-    return ((const Arr*)(const void *)Data.buffer)->NumElts;
+    return ((const Arr *)(const void *)&Data)->NumElts;
   }
----------------
What is it `char *` in some cases and `void*` in others?


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

https://reviews.llvm.org/D92512



More information about the cfe-commits mailing list