[PATCH] D45015: [Preprocessor] Allow libc++ to detect when aligned allocation is unavailable.
Akira Hatanaka via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Jun 5 20:19:19 PDT 2018
ahatanak added a comment.
In https://reviews.llvm.org/D45015#1123097, @EricWF wrote:
> In https://reviews.llvm.org/D45015#1121874, @ahatanak wrote:
>
> > I see, thank you.
> >
> > clang front-end currently fails to issue a warning or error when an aligned allocation/deallocation functions are required but not available in a few cases (e.g., delete called from a deleting destructor, calls to operator or builtin operator new/delete). I suppose those bugs should be fixed in separate patches.
>
>
> I don't think we need to emit warnings from `__builtin_operator_new`/`__builtin_operator_delete`. Libc++ is the only consumer, and I think we can trust it to know what it's doing.
Shouldn't clang warn when users explicitly call an aligned builtin operator new or delete in their code and the OS is too old to support the operator?
For example:
typedef __SIZE_TYPE__ size_t;
namespace std {
enum class align_val_t : size_t {};
}
int main() {
void *p = __builtin_operator_new(100, std::align_val_t(32));
return 0;
}
https://reviews.llvm.org/D45015
More information about the cfe-commits
mailing list