[PATCH] D92512: ADT: Change AlignedCharArrayUnion to an alias of std::aligned_union_t, NFC
Duncan P. N. Exon Smith via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Dec 2 15:39:44 PST 2020
dexonsmith 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;
}
----------------
shafik wrote:
> I notice that in `ASTTypeTraits.h` we use `reinterpret_cast` while here we revert to C-style casts.
Yes, this old code probably predates C++11. It'd be nice to fix it, but that seems out of scope for this patch.
================
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;
}
----------------
shafik wrote:
> What is it `char *` in some cases and `void*` in others?
> What is it `char *` in some cases and `void*` in others?
Agreed it's inconsistent! I'd have to guess the original authors here had a different ideas about which type was more fundamental.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D92512/new/
https://reviews.llvm.org/D92512
More information about the llvm-commits
mailing list