22 #ifndef LLVM_CLANG_SEMA_DELAYEDDIAGNOSTIC_H 23 #define LLVM_CLANG_SEMA_DELAYEDDIAGNOSTIC_H 50 Target(FoundDecl.getDecl()), NamingClass(NamingClass),
51 BaseObjectType(BaseObjectType), Diag(0, Allocator) {
59 : Access(Access), IsMember(
false),
61 NamingClass(DerivedClass),
75 assert(!IsMember);
return cast<CXXRecordDecl>(Target);
90 assert(
isQuiet() &&
"partial diagnostic already defined");
94 assert(
isQuiet() &&
"partial diagnostic already defined");
95 assert(DiagID &&
"creating null diagnostic");
105 unsigned IsMember : 1;
116 enum DDKind :
unsigned char { Availability, Access, ForbiddenType };
132 bool ObjCPropertyAccess);
150 DD.
Kind = ForbiddenType;
160 assert(Kind == Access &&
"Not an access diagnostic.");
164 assert(Kind == Access &&
"Not an access diagnostic.");
169 assert(Kind == Availability &&
"Not an availability diagnostic.");
170 return AvailabilityData.ReferringDecl;
174 return AvailabilityData.OffendingDecl;
178 assert(Kind == Availability &&
"Not an availability diagnostic.");
179 return StringRef(AvailabilityData.Message, AvailabilityData.MessageLen);
183 assert(Kind == Availability &&
"Not an availability diagnostic.");
184 return AvailabilityData.AR;
192 assert(Kind == ForbiddenType &&
"not a forbidden-type diagnostic");
193 return ForbiddenTypeData.Diagnostic;
197 assert(Kind == ForbiddenType &&
"not a forbidden-type diagnostic");
198 return ForbiddenTypeData.Argument;
202 assert(Kind == ForbiddenType &&
"not a forbidden-type diagnostic");
207 return AvailabilityData.UnknownObjCClass;
211 return AvailabilityData.ObjCProperty;
215 return AvailabilityData.ObjCPropertyAccess;
228 bool ObjCPropertyAccess;
238 struct AD AvailabilityData;
239 struct FTD ForbiddenTypeData;
257 i = Diagnostics.begin(), e = Diagnostics.end(); i != e; ++i)
262 : Parent(Other.Parent), Diagnostics(
std::move(Other.Diagnostics)) {
263 Other.Diagnostics.clear();
266 Parent = Other.Parent;
267 Diagnostics = std::move(Other.Diagnostics);
268 Other.Diagnostics.clear();
276 return (Diagnostics.empty() && (!Parent || Parent->
empty()));
281 Diagnostics.push_back(diag);
286 if (pool.Diagnostics.empty())
return;
288 if (Diagnostics.empty()) {
289 Diagnostics = std::move(pool.Diagnostics);
293 pool.Diagnostics.clear();
297 pool_iterator
pool_begin()
const {
return Diagnostics.begin(); }
298 pool_iterator
pool_end()
const {
return Diagnostics.end(); }
306 assert(shouldDelayDiagnostics() &&
"trying to delay without pool");
DelayedDiagnosticPool(const DelayedDiagnosticPool *parent)
DelayedDiagnosticPool(DelayedDiagnosticPool &&Other)
A (possibly-)qualified type.
NamedDecl * getTargetDecl() const
AccessSpecifier
A C++ access specifier (public, private, protected), plus the special value "none" which means differ...
unsigned getDiagID() const
pool_iterator pool_begin() const
const ObjCPropertyDecl * getObjCProperty() const
const NamedDecl * getAvailabilityReferringDecl() const
const AccessedEntity & getAccessData() const
AccessedEntity & getAccessData()
void add(const DelayedDiagnostic &diag)
Add a diagnostic to this pool.
void Reset(unsigned DiagID=0)
Clear out this partial diagnostic, giving it a new diagnostic ID and removing all of its arguments...
CXXRecordDecl * getBaseClass() const
const NamedDecl * getAvailabilityOffendingDecl() const
CXXRecordDecl * getNamingClass() const
CXXRecordDecl * getDerivedClass() const
void steal(DelayedDiagnosticPool &pool)
Steal the diagnostics from the given pool.
void * getAsOpaquePtr() const
Represents an ObjC class declaration.
bool getObjCPropertyAccess() const
AvailabilityResult
Captures the result of checking the availability of a declaration.
const ObjCInterfaceDecl * getUnknownObjCClass() const
A declaration being accessed, together with information about how it was accessed.
static DelayedDiagnostic makeForbiddenType(SourceLocation loc, unsigned diagnostic, QualType type, unsigned argument)
An allocator for Storage objects, which uses a small cache to objects, used to reduce malloc()/free()...
AccessedEntity(PartialDiagnostic::StorageAllocator &Allocator, BaseNonce _, CXXRecordDecl *BaseClass, CXXRecordDecl *DerivedClass, AccessSpecifier Access)
unsigned getForbiddenTypeDiagnostic() const
The diagnostic ID to emit.
Encodes a location in the source.
unsigned getForbiddenTypeArgument() const
MemberNonce
A member declaration found through lookup.
AccessSpecifier getAccess() const
PartialDiagnostic & setDiag(unsigned DiagID)
bool empty() const
Does this pool, or any of its ancestors, contain any diagnostics?
pool_iterator pool_end() const
AvailabilityResult getAvailabilityResult() const
Represents one property declaration in an Objective-C interface.
DelayedDiagnosticPool & operator=(DelayedDiagnosticPool &&Other)
bool isMemberAccess() const
static QualType getFromOpaquePtr(const void *Ptr)
BaseNonce
A hierarchy (base-to-derived or derived-to-base) conversion.
A POD class for pairing a NamedDecl* with an access specifier.
Dataflow Directional Tag Classes.
QualType getForbiddenTypeOperand() const
void setDiag(const PartialDiagnostic &PDiag)
Sets a diagnostic to be performed.
void add(const sema::DelayedDiagnostic &diag)
Adds a delayed diagnostic.
struct FTD ForbiddenTypeData
const DelayedDiagnosticPool * getParent() const
AccessedEntity(PartialDiagnostic::StorageAllocator &Allocator, MemberNonce _, CXXRecordDecl *NamingClass, DeclAccessPair FoundDecl, QualType BaseObjectType)
Represents a C++ struct/union/class.
A diagnostic message which has been conditionally emitted pending the complete parsing of the current...
A little helper class (which is basically a smart pointer that forwards info from DiagnosticsEngine) ...
A collection of diagnostics which were delayed.
QualType getBaseObjectType() const
Retrieves the base object type, important when accessing an instance member.
NamedDecl - This represents a decl with a name.
const PartialDiagnostic & getDiag() const
StringRef getAvailabilityMessage() const
static DelayedDiagnostic makeAccess(SourceLocation Loc, const AccessedEntity &Entity)
SmallVectorImpl< DelayedDiagnostic >::const_iterator pool_iterator