This is an archive of the discontinued LLVM Phabricator instance.

[Sema] Toggle diags when finding allocators (NFCI)
ClosedPublic

Authored by modocache on Jan 26 2018, 3:30 PM.

Details

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

Diff Detail

Repository
rC Clang

Event Timeline

modocache created this revision.Jan 26 2018, 3:30 PM
modocache updated this revision to Diff 131728.Jan 28 2018, 1:05 PM

Prevent note diagnostics from being emitted for arity mismatch.

This revision is now accepted and ready to land.Feb 12 2018, 2:43 PM
This revision was automatically updated to reflect the committed changes.

Thanks again, @GorNishanov, for all the reviews!