[PATCH] D42605: [Sema] Toggle diags when finding allocators (NFCI)

Brian Gesiak via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jan 26 15:30:41 PST 2018


modocache created this revision.
modocache added reviewers: rsmith, GorNishanov, eric_niebler.

Many methods in Sema take a `bool Diagnose` parameter. Examples of such
methods include `Sema::FindDeallocationFunction` and
`Sema::SpecialMemberIsTrivial`. Calling these methods with
`Diagnose = false` allows callers to, for instance, check for the
existence of a deallocation function, without that check resulting in
error diagnostics being emitted if no matching deallocation function exists.

Add a similar `bool Diagnose` to the `Sema::FindAllocationFunctions`
method, so that checks for the existence of allocation functions can be
made without triggering error diagnostics.

This allows `SemaCoroutine.cpp`, in its implementation of the
Coroutines TS, to check for the existence of a particular `operator new`
overload, but then without error fall back to a default `operator new`
if no matching overload exists.

Test Plan: `check-clang`


Repository:
  rC Clang

https://reviews.llvm.org/D42605

Files:
  include/clang/Sema/Sema.h
  lib/Sema/SemaExprCXX.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D42605.131664.patch
Type: text/x-patch
Size: 4994 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180126/a812eb8e/attachment-0001.bin>


More information about the cfe-commits mailing list