]> granicus.if.org Git - clang/commit
[Sema] Toggle diags when finding allocators (NFCI)
authorBrian Gesiak <modocache@gmail.com>
Thu, 15 Feb 2018 20:09:25 +0000 (20:09 +0000)
committerBrian Gesiak <modocache@gmail.com>
Thu, 15 Feb 2018 20:09:25 +0000 (20:09 +0000)
commitedbfdfb07e2eca1f696b000621e961306b85aade
tree96a2a59b0b3497eaae515f46aa86f4d2a17283a6
parent015d21eba5d1c8488e495ddb931b61ce357c4501
[Sema] Toggle diags when finding allocators (NFCI)

Summary:
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`

Reviewers: rsmith, GorNishanov, eric_niebler

Reviewed By: GorNishanov

Subscribers: cfe-commits

Differential Revision: https://reviews.llvm.org/D42605

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@325288 91177308-0d34-0410-b5e6-96231b3b80d8
include/clang/Sema/Sema.h
lib/Sema/SemaExprCXX.cpp