[PATCH] D108123: [MemoryBuiltins] Mark user defined delete as nobuiltin

Bryan Chan via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 23 05:09:40 PDT 2021


bryanpkc added a comment.

> Just saying "any function with a definition isn't a target library function" probably produces a sane result in most cases.

That doesn't sound like the right solution though. If the programmer provides operators `new` and `delete` in some translation unit other than the one being compiled, without LTO, the definitions are not available in the current translation unit. I think @lebedev.ri was describing the same.

Moreover, `__attribute__((no_builtin))` does not work on declarations, so the programmer currently has no way to tell Clang that these operators shouldn't be treated as builtins. Adding options such as `-fno-builtin-operator-new` and `-fno-builtin-operator-delete` sounds like the best solution to me.

As a reference point, GCC doesn't seem to optimize these operators at all.


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

https://reviews.llvm.org/D108123



More information about the llvm-commits mailing list