1 //===--- DelayedDiagnostic.cpp - Delayed declarator diagnostics -*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file defines the DelayedDiagnostic class implementation, which
11 // is used to record diagnostics that are being conditionally produced
12 // during declarator parsing.
14 // This file also defines AccessedEntity.
16 //===----------------------------------------------------------------------===//
17 #include "clang/Sema/DelayedDiagnostic.h"
19 using namespace clang;
23 DelayedDiagnostic::makeAvailability(AvailabilityResult AR,
25 const NamedDecl *ReferringDecl,
26 const NamedDecl *OffendingDecl,
27 const ObjCInterfaceDecl *UnknownObjCClass,
28 const ObjCPropertyDecl *ObjCProperty,
30 bool ObjCPropertyAccess) {
32 DD.Kind = Availability;
35 DD.AvailabilityData.ReferringDecl = ReferringDecl;
36 DD.AvailabilityData.OffendingDecl = OffendingDecl;
37 DD.AvailabilityData.UnknownObjCClass = UnknownObjCClass;
38 DD.AvailabilityData.ObjCProperty = ObjCProperty;
39 char *MessageData = nullptr;
41 MessageData = new char [Msg.size()];
42 memcpy(MessageData, Msg.data(), Msg.size());
45 DD.AvailabilityData.Message = MessageData;
46 DD.AvailabilityData.MessageLen = Msg.size();
47 DD.AvailabilityData.AR = AR;
48 DD.AvailabilityData.ObjCPropertyAccess = ObjCPropertyAccess;
52 void DelayedDiagnostic::Destroy() {
55 getAccessData().~AccessedEntity();
59 delete[] AvailabilityData.Message;