[PATCH] D44552: [Coroutines] Find custom allocators in class scope

Brian Gesiak via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Mar 15 23:26:54 PDT 2018

modocache created this revision.
modocache added reviewers: GorNishanov, eric_niebler, lewissbaker.
Herald added a subscriber: EricWF.

https://reviews.llvm.org/rL325291 implemented Coroutines TS N4723
section [dcl.fct.def.coroutine]/7, but it performed lookup of allocator
functions within both the global and class scope, whereas the specified
behavior is to perform lookup for custom allocators within just the
class scope.

To fix, add parameters to the `Sema::FindAllocationFunctions` function
such that it can be used to lookup allocators in global scope,
class scope, or both (instead of just being able to look up in just global
scope or in both global and class scope). Then, use those parameters
from within the coroutine Sema.

This incorrect behavior had the unfortunate side-effect of causing the
bug https://bugs.llvm.org/show_bug.cgi?id=36578 (or at least the reports
of that bug in C++ programs). That bug would occur for any C++ user with
a coroutine frame that took a single pointer argument, since it would
then find the global placement form `operator new`, described in the
C++ standard This patch prevents Clang from generating code
that triggers the LLVM assert described in that bug report.

Test Plan: `check-clang`

  rC Clang



-------------- next part --------------
A non-text attachment was scrubbed...
Name: D44552.138663.patch
Type: text/x-patch
Size: 12420 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180316/1149e367/attachment-0001.bin>

More information about the cfe-commits mailing list