Go to the documentation of this file.
21 #ifndef LLVM_CLANG_SEMA_DELAYEDDIAGNOSTIC_H
22 #define LLVM_CLANG_SEMA_DELAYEDDIAGNOSTIC_H
33 #include "llvm/ADT/ArrayRef.h"
34 #include "llvm/ADT/SmallVector.h"
35 #include "llvm/ADT/StringRef.h"
36 #include "llvm/Support/Casting.h"
43 class ObjCInterfaceDecl;
44 class ObjCPropertyDecl;
64 Target(FoundDecl.getDecl()), NamingClass(NamingClass),
65 BaseObjectType(BaseObjectType), Diag(0, Allocator) {}
70 : Access(Access), IsMember(
false), Target(BaseClass),
71 NamingClass(DerivedClass), Diag(0, Allocator) {}
85 assert(!IsMember);
return cast<CXXRecordDecl>(Target);
100 assert(
isQuiet() &&
"partial diagnostic already defined");
104 assert(
isQuiet() &&
"partial diagnostic already defined");
105 assert(DiagID &&
"creating null diagnostic");
115 unsigned IsMember : 1;
142 bool ObjCPropertyAccess);
169 assert(
Kind ==
Access &&
"Not an access diagnostic.");
173 assert(
Kind ==
Access &&
"Not an access diagnostic.");
242 size_t NumSelectorLocs;
244 bool ObjCPropertyAccess;
275 Other.Diagnostics.clear();
280 Diagnostics = std::move(Other.Diagnostics);
281 Other.Diagnostics.clear();
287 i = Diagnostics.begin(), e = Diagnostics.end(); i != e; ++i)
295 return (Diagnostics.empty() && (!
Parent ||
Parent->empty()));
300 Diagnostics.push_back(diag);
305 if (pool.Diagnostics.empty())
return;
307 if (Diagnostics.empty()) {
308 Diagnostics = std::move(pool.Diagnostics);
312 pool.Diagnostics.clear();
332 #endif // LLVM_CLANG_SEMA_DELAYEDDIAGNOSTIC_H
Represents an ObjC class declaration.
void setDiag(const PartialDiagnostic &PDiag)
Sets a diagnostic to be performed.
const ObjCPropertyDecl * getObjCProperty() const
const NamedDecl * getAvailabilityReferringDecl() const
CXXRecordDecl * getBaseClass() const
pool_iterator pool_begin() const
CXXRecordDecl * getNamingClass() const
AccessedEntity & getAccessData()
AccessedEntity(PartialDiagnostic::DiagStorageAllocator &Allocator, BaseNonce _, CXXRecordDecl *BaseClass, CXXRecordDecl *DerivedClass, AccessSpecifier Access)
Encodes a location in the source.
This represents a decl that may have a name.
A (possibly-)qualified type.
AccessedEntity(PartialDiagnostic::DiagStorageAllocator &Allocator, MemberNonce _, CXXRecordDecl *NamingClass, DeclAccessPair FoundDecl, QualType BaseObjectType)
A declaration being accessed, together with information about how it was accessed.
static DelayedDiagnostic makeForbiddenType(SourceLocation loc, unsigned diagnostic, QualType type, unsigned argument)
static DelayedDiagnostic makeAccess(SourceLocation Loc, const AccessedEntity &Entity)
unsigned getForbiddenTypeDiagnostic() const
The diagnostic ID to emit.
A diagnostic message which has been conditionally emitted pending the complete parsing of the current...
char AccessData[sizeof(AccessedEntity)]
Access control.
A collection of diagnostics which were delayed.
A little helper class (which is basically a smart pointer that forwards info from DiagnosticsEngine) ...
void Reset(unsigned DiagID=0)
Clear out this partial diagnostic, giving it a new diagnostic ID and removing all of its arguments,...
AccessSpecifier getAccess() const
bool getObjCPropertyAccess() const
void steal(DelayedDiagnosticPool &pool)
Steal the diagnostics from the given pool.
NamedDecl * getTargetDecl() const
unsigned getForbiddenTypeArgument() const
A POD class for pairing a NamedDecl* with an access specifier.
DelayedDiagnosticPool & operator=(const DelayedDiagnosticPool &)=delete
bool empty() const
Does this pool, or any of its ancestors, contain any diagnostics?
BaseNonce
A hierarchy (base-to-derived or derived-to-base) conversion.
void add(const DelayedDiagnostic &diag)
Add a diagnostic to this pool.
SmallVectorImpl< DelayedDiagnostic >::const_iterator pool_iterator
DelayedDiagnosticPool(const DelayedDiagnosticPool *parent)
bool shouldDelayDiagnostics()
Determines whether diagnostics should be delayed.
CXXRecordDecl * getDerivedClass() const
const AccessedEntity & getAccessData() const
pool_iterator pool_end() const
AccessSpecifier
A C++ access specifier (public, private, protected), plus the special value "none" which means differ...
Represents a C++ struct/union/class.
QualType getForbiddenTypeOperand() const
struct AD AvailabilityData
const NamedDecl * getAvailabilityOffendingDecl() const
MemberNonce
A member declaration found through lookup.
const ObjCInterfaceDecl * getUnknownObjCClass() const
Represents one property declaration in an Objective-C interface.
DelayedDiagnosticPool & operator=(DelayedDiagnosticPool &&Other)
static QualType getFromOpaquePtr(const void *Ptr)
unsigned getDiagID() const
const DelayedDiagnosticPool * getParent() const
ArrayRef< SourceLocation > getAvailabilitySelectorLocs() const
const PartialDiagnostic & getDiag() const
AvailabilityResult
Captures the result of checking the availability of a declaration.
StringRef getAvailabilityMessage() const
AvailabilityResult getAvailabilityResult() const
static DelayedDiagnostic makeAvailability(AvailabilityResult AR, ArrayRef< SourceLocation > Locs, const NamedDecl *ReferringDecl, const NamedDecl *OffendingDecl, const ObjCInterfaceDecl *UnknownObjCClass, const ObjCPropertyDecl *ObjCProperty, StringRef Msg, bool ObjCPropertyAccess)
PartialDiagnostic & setDiag(unsigned DiagID)
DelayedDiagnosticPool(DelayedDiagnosticPool &&Other)
bool isMemberAccess() const
struct FTD ForbiddenTypeData
void add(const sema::DelayedDiagnostic &diag)
Adds a delayed diagnostic.
An allocator for DiagnosticStorage objects, which uses a small cache to objects, used to reduce mallo...
QualType getBaseObjectType() const
Retrieves the base object type, important when accessing an instance member.