clang
6.0.0
|
The collection of all-type qualifiers we support. More...
#include "clang/AST/Type.h"
Public Types | |
enum | TQ { Const = 0x1, Restrict = 0x2, Volatile = 0x4, CVRMask = Const | Volatile | Restrict } |
enum | GC { GCNone = 0, Weak, Strong } |
enum | ObjCLifetime { OCL_None, OCL_ExplicitNone, OCL_Strong, OCL_Weak, OCL_Autoreleasing } |
enum | { MaxAddressSpace = 0x7fffffu, FastWidth = 3, FastMask = (1 << FastWidth) - 1 } |
Public Member Functions | |
unsigned | getAsOpaqueValue () const |
bool | hasConst () const |
void | setConst (bool flag) |
void | removeConst () |
void | addConst () |
bool | hasVolatile () const |
void | setVolatile (bool flag) |
void | removeVolatile () |
void | addVolatile () |
bool | hasRestrict () const |
void | setRestrict (bool flag) |
void | removeRestrict () |
void | addRestrict () |
bool | hasCVRQualifiers () const |
unsigned | getCVRQualifiers () const |
void | setCVRQualifiers (unsigned mask) |
void | removeCVRQualifiers (unsigned mask) |
void | removeCVRQualifiers () |
void | addCVRQualifiers (unsigned mask) |
void | addCVRUQualifiers (unsigned mask) |
bool | hasUnaligned () const |
void | setUnaligned (bool flag) |
void | removeUnaligned () |
void | addUnaligned () |
bool | hasObjCGCAttr () const |
GC | getObjCGCAttr () const |
void | setObjCGCAttr (GC type) |
void | removeObjCGCAttr () |
void | addObjCGCAttr (GC type) |
Qualifiers | withoutObjCGCAttr () const |
Qualifiers | withoutObjCLifetime () const |
bool | hasObjCLifetime () const |
ObjCLifetime | getObjCLifetime () const |
void | setObjCLifetime (ObjCLifetime type) |
void | removeObjCLifetime () |
void | addObjCLifetime (ObjCLifetime type) |
bool | hasNonTrivialObjCLifetime () const |
True if the lifetime is neither None or ExplicitNone. More... | |
bool | hasStrongOrWeakObjCLifetime () const |
True if the lifetime is either strong or weak. More... | |
bool | hasAddressSpace () const |
LangAS | getAddressSpace () const |
bool | hasTargetSpecificAddressSpace () const |
unsigned | getAddressSpaceAttributePrintValue () const |
Get the address space attribute value to be printed by diagnostics. More... | |
void | setAddressSpace (LangAS space) |
void | removeAddressSpace () |
void | addAddressSpace (LangAS space) |
bool | hasFastQualifiers () const |
unsigned | getFastQualifiers () const |
void | setFastQualifiers (unsigned mask) |
void | removeFastQualifiers (unsigned mask) |
void | removeFastQualifiers () |
void | addFastQualifiers (unsigned mask) |
bool | hasNonFastQualifiers () const |
Return true if the set contains any qualifiers which require an ExtQuals node to be allocated. More... | |
Qualifiers | getNonFastQualifiers () const |
bool | hasQualifiers () const |
Return true if the set contains any qualifiers. More... | |
bool | empty () const |
void | addQualifiers (Qualifiers Q) |
Add the qualifiers from the given set to this set. More... | |
void | removeQualifiers (Qualifiers Q) |
Remove the qualifiers from the given set from this set. More... | |
void | addConsistentQualifiers (Qualifiers qs) |
Add the qualifiers from the given set to this set, given that they don't conflict. More... | |
bool | isAddressSpaceSupersetOf (Qualifiers other) const |
Returns true if this address space is a superset of the other one. More... | |
bool | compatiblyIncludes (Qualifiers other) const |
Determines if these qualifiers compatibly include another set. More... | |
bool | compatiblyIncludesObjCLifetime (Qualifiers other) const |
Determines if these qualifiers compatibly include another set of qualifiers from the narrow perspective of Objective-C ARC lifetime. More... | |
bool | isStrictSupersetOf (Qualifiers Other) const |
Determine whether this set of qualifiers is a strict superset of another set of qualifiers, not considering qualifier compatibility. More... | |
bool | operator== (Qualifiers Other) const |
bool | operator!= (Qualifiers Other) const |
operator bool () const | |
Qualifiers & | operator+= (Qualifiers R) |
Qualifiers & | operator-= (Qualifiers R) |
std::string | getAsString () const |
std::string | getAsString (const PrintingPolicy &Policy) const |
bool | isEmptyWhenPrinted (const PrintingPolicy &Policy) const |
void | print (raw_ostream &OS, const PrintingPolicy &Policy, bool appendSpaceIfNonEmpty=false) const |
void | Profile (llvm::FoldingSetNodeID &ID) const |
Static Public Member Functions | |
static Qualifiers | removeCommonQualifiers (Qualifiers &L, Qualifiers &R) |
Returns the common set of qualifiers while removing them from the given sets. More... | |
static Qualifiers | fromFastMask (unsigned Mask) |
static Qualifiers | fromCVRMask (unsigned CVR) |
static Qualifiers | fromCVRUMask (unsigned CVRU) |
static Qualifiers | fromOpaqueValue (unsigned opaque) |
Friends | |
Qualifiers | operator+ (Qualifiers L, Qualifiers R) |
Qualifiers | operator- (Qualifiers L, Qualifiers R) |
Compute the difference between two qualifier sets. More... | |
The collection of all-type qualifiers we support.
Clang supports five independent qualifiers:
anonymous enum |
|
inline |
Definition at line 393 of file Type.h.
References clang::Default.
Referenced by clang::ASTContext::getAddrSpaceQualType(), and clang::CodeGen::CGOpenMPRuntimeNVPTX::translateParameter().
|
inline |
Add the qualifiers from the given set to this set, given that they don't conflict.
Definition at line 467 of file Type.h.
References getAddressSpace(), getObjCGCAttr(), getObjCLifetime(), hasAddressSpace(), hasObjCGCAttr(), and hasObjCLifetime().
Referenced by clang::ASTContext::getASTObjCImplementationLayout(), clang::ASTContext::getBaseElementType(), clang::Type::getLocallyUnqualifiedSingleStepDesugaredType(), clang::SplitQualType::getSingleStepDesugaredType(), and clang::ASTContext::getUnqualifiedArrayType().
|
inline |
Definition at line 274 of file Type.h.
Referenced by clang::Sema::AddBuiltinOperatorCandidates().
|
inline |
Definition at line 303 of file Type.h.
Referenced by clang::Sema::BuildQualifiedType(), clang::CodeGen::CodeGenFunction::EmitLValueForField(), fromCVRMask(), and removeCommonQualifiers().
|
inline |
Definition at line 307 of file Type.h.
Referenced by fromCVRUMask().
|
inline |
Definition at line 413 of file Type.h.
Referenced by fromFastMask(), clang::QualType::getLocalQualifiers(), clang::QualType::getQualifiers(), and clang::QualType::split().
|
inline |
Definition at line 325 of file Type.h.
Referenced by clang::ASTContext::getObjCGCQualType().
|
inline |
Definition at line 348 of file Type.h.
Referenced by clang::ASTContext::getLifetimeQualifiedType(), handleObjCOwnershipTypeAttr(), inferARCWriteback(), and transferARCOwnershipToDeclSpec().
|
inline |
Add the qualifiers from the given set to this set.
Definition at line 432 of file Type.h.
References getAddressSpace(), getObjCGCAttr(), getObjCLifetime(), hasAddressSpace(), hasObjCGCAttr(), and hasObjCLifetime().
|
inline |
Definition at line 288 of file Type.h.
Referenced by clang::CodeGen::CGOpenMPRuntimeNVPTX::translateParameter().
|
inline |
Determines if these qualifiers compatibly include another set.
Generally this answers the question of whether an object with the other qualifiers can be safely used as an object with these qualifiers.
Definition at line 497 of file Type.h.
References getObjCGCAttr(), getObjCLifetime(), hasObjCGCAttr(), and hasUnaligned().
Referenced by checkPointerTypesForAssignment(), clang::QualType::isAtLeastAsQualifiedAs(), clang::QualType::isMoreQualifiedThan(), TryReferenceInit(), and TryStaticCast().
|
inline |
Determines if these qualifiers compatibly include another set of qualifiers from the narrow perspective of Objective-C ARC lifetime.
One set of Objective-C lifetime qualifiers compatibly includes the other if the lifetime qualifiers match, or if both are non-__weak and the including set also contains the 'const' qualifier, or both are non-__weak and one is None (which can only happen in non-ARC modes).
Definition at line 518 of file Type.h.
References getObjCLifetime().
Referenced by CastsAwayConstness(), checkPointerTypesForAssignment(), and DiagnoseBadFunctionCast().
|
inline |
Definition at line 429 of file Type.h.
Referenced by AppendTypeQualList(), clang::ASTContext::getAsArrayType(), clang::Type::getLocallyUnqualifiedSingleStepDesugaredType(), clang::ASTContext::getUnqualifiedArrayType(), isValidSwiftErrorResultType(), and TypeInfoIsInStandardLibrary().
|
inlinestatic |
Definition at line 245 of file Type.h.
References addCVRQualifiers().
Referenced by clang::Sema::BuildQualifiedType(), getFunctionQualifiersAsString(), and clang::ArrayType::getIndexTypeQualifiers().
|
inlinestatic |
Definition at line 251 of file Type.h.
References addCVRUQualifiers().
Referenced by clang::CXXMethodDecl::getThisType().
|
inlinestatic |
Definition at line 239 of file Type.h.
References addFastQualifiers().
Referenced by clang::QualType::split().
|
inlinestatic |
|
inline |
Definition at line 367 of file Type.h.
Referenced by addConsistentQualifiers(), addQualifiers(), checkConditionalPointerCompatibility(), clang::CodeGen::LValue::getAddressSpace(), clang::QualType::getAddressSpace(), clang::ExtQuals::getAddressSpace(), clang::ASTContext::getTargetAddressSpace(), hasInconsistentOrSupersetQualifiersOf(), isAddressSpaceSupersetOf(), isStrictSupersetOf(), clang::ASTContext::mergeObjCGCQualifiers(), clang::ASTContext::mergeTypes(), clang::InitializationSequence::Perform(), removeCommonQualifiers(), and removeQualifiers().
|
inline |
Get the address space attribute value to be printed by diagnostics.
Definition at line 374 of file Type.h.
References clang::Default, and clang::toTargetAddressSpace().
Referenced by clang::Sema::ActOnCXXDelete(), and clang::Sema::CheckAllocatedType().
|
inline |
Definition at line 265 of file Type.h.
Referenced by clang::ODRHash::AddQualType(), clang::ASTContext::mergeTypes(), and clang::ASTTypeWriter::Visit().
std::string Qualifiers::getAsString | ( | ) | const |
Definition at line 1597 of file TypePrinter.cpp.
std::string Qualifiers::getAsString | ( | const PrintingPolicy & | Policy | ) | const |
Definition at line 1605 of file TypePrinter.cpp.
|
inline |
Definition at line 291 of file Type.h.
Referenced by CastsAwayConstness(), checkConditionalPointerCompatibility(), DeduceTemplateArgumentsByTypeMatch(), clang::InitializationSequence::Diagnose(), clang::CodeGen::LValue::getVRQualifiers(), hasInconsistentOrSupersetQualifiersOf(), hasMangledSubstitutionQualifiers(), clang::ASTContext::mergeObjCGCQualifiers(), clang::ASTContext::mergeTypes(), removeCommonQualifiers(), and TryReferenceInitializationCore().
|
inline |
Definition at line 401 of file Type.h.
Referenced by clang::ASTContext::getASTObjCImplementationLayout(), clang::ASTContext::getQualifiedType(), and clang::ASTContext::removeAddrSpaceQualType().
|
inline |
Definition at line 421 of file Type.h.
References setFastQualifiers().
|
inline |
Definition at line 320 of file Type.h.
Referenced by addConsistentQualifiers(), addQualifiers(), compatiblyIncludes(), clang::CodeGen::CodeGenFunction::EmitLValueForField(), clang::QualType::getObjCGCAttr(), clang::ExtQuals::getObjCGCAttr(), hasInconsistentOrSupersetQualifiersOf(), clang::CodeGen::LValue::isObjCStrong(), clang::CodeGen::LValue::isObjCWeak(), isStrictSupersetOf(), clang::ASTContext::mergeObjCGCQualifiers(), clang::ASTContext::mergeTypes(), removeCommonQualifiers(), and removeQualifiers().
|
inline |
Definition at line 341 of file Type.h.
Referenced by clang::Sema::ActOnForEachDeclStmt(), addConsistentQualifiers(), addQualifiers(), clang::ASTContext::BlockRequiresCopying(), buildByrefHelpers(), checkPointerTypesForAssignment(), compatiblyIncludes(), compatiblyIncludesObjCLifetime(), computeCopyInfoForBlockCapture(), computeDestroyInfoForBlockCapture(), DeduceTemplateArgumentsByTypeMatch(), clang::CodeGen::CGObjCRuntime::EmitInitOfCatchParam(), clang::CodeGen::CodeGenFunction::EmitLoadOfLValue(), clang::CodeGen::CodeGenFunction::EmitParmDecl(), clang::CodeGen::CodeGenFunction::EmitStoreThroughLValue(), clang::CodeGen::CodeGenFunction::generateObjCGetterBody(), clang::CodeGen::LValue::getObjCLifetime(), clang::CodeGen::AggValueSlot::getObjCLifetime(), clang::QualType::getObjCLifetime(), clang::ExtQuals::getObjCLifetime(), handleObjCOwnershipTypeAttr(), hasInconsistentOrSupersetQualifiersOf(), InitCatchParam(), isNonTrivialObjCLifetimeConversion(), isStrictSupersetOf(), clang::ASTContext::mergeTypes(), removeCommonQualifiers(), and removeQualifiers().
|
inline |
Definition at line 366 of file Type.h.
Referenced by addConsistentQualifiers(), addQualifiers(), DeduceTemplateArgumentsByTypeMatch(), clang::ASTContext::getAddrSpaceQualType(), clang::ExtQuals::hasAddressSpace(), hasInconsistentOrSupersetQualifiersOf(), hasMangledSubstitutionQualifiers(), isStrictSupersetOf(), clang::InitializationSequence::Perform(), and clang::ASTContext::removeAddrSpaceQualType().
|
inline |
Definition at line 269 of file Type.h.
Referenced by DiagnoseCastQual(), clang::CodeGen::CodeGenFunction::EmitParmDecl(), IsConstNonVolatile(), isNonTrivialObjCLifetimeConversion(), TryReferenceInitializationCore(), and TryReferenceListInitialization().
|
inline |
Definition at line 290 of file Type.h.
Referenced by clang::Sema::ActOnCXXDelete().
|
inline |
Definition at line 400 of file Type.h.
Referenced by clang::ExtQuals::ExtQuals(), and clang::ExtQuals::Profile().
|
inline |
Return true if the set contains any qualifiers which require an ExtQuals node to be allocated.
Definition at line 420 of file Type.h.
Referenced by clang::ExtQuals::ExtQuals(), clang::ASTContext::getQualifiedType(), and clang::ASTContext::removeAddrSpaceQualType().
|
inline |
True if the lifetime is neither None or ExplicitNone.
Definition at line 355 of file Type.h.
Referenced by DeduceTemplateArgumentsByTypeMatch(), and clang::QualType::hasNonTrivialObjCLifetime().
|
inline |
Definition at line 319 of file Type.h.
Referenced by addConsistentQualifiers(), addQualifiers(), compatiblyIncludes(), DeduceTemplateArgumentsByTypeMatch(), clang::ASTContext::getObjCGCQualType(), hasInconsistentOrSupersetQualifiersOf(), clang::ExtQuals::hasObjCGCAttr(), and isStrictSupersetOf().
|
inline |
Definition at line 340 of file Type.h.
Referenced by addConsistentQualifiers(), addQualifiers(), computeDestroyInfoForBlockCapture(), DeduceTemplateArgumentsByTypeMatch(), clang::CodeGen::CodeGenFunction::EmitConstructorBody(), clang::ASTContext::getCanonicalFunctionResultType(), clang::ASTContext::getUnqualifiedObjCPointerType(), hasDirectOwnershipQualifier(), hasInconsistentOrSupersetQualifiersOf(), clang::ExtQuals::hasObjCLifetime(), isStrictSupersetOf(), clang::TreeTransform< Derived >::RebuildQualifiedType(), and rewriteToObjCProperty().
|
inline |
Return true if the set contains any qualifiers.
Definition at line 428 of file Type.h.
Referenced by AppendTypeQualList().
|
inline |
Definition at line 283 of file Type.h.
Referenced by clang::Sema::BuildQualifiedType(), and clang::CodeGen::LValue::isRestrictQualified().
|
inline |
True if the lifetime is either strong or weak.
Definition at line 361 of file Type.h.
Referenced by clang::QualType::hasStrongOrWeakObjCLifetime().
|
inline |
Definition at line 370 of file Type.h.
References clang::isTargetAddressSpace().
|
inline |
Definition at line 312 of file Type.h.
Referenced by compatiblyIncludes(), decomposeTypeForEH(), GetAlignOfType(), clang::CodeGen::CodeGenFunction::getNaturalTypeAlignment(), hasMangledSubstitutionQualifiers(), and clang::ASTContext::mergeTypes().
|
inline |
Definition at line 276 of file Type.h.
Referenced by DiagnoseCastQual(), clang::CodeGen::CodeGenFunction::EmitConstructorBody(), IsConstNonVolatile(), clang::CodeGen::LValue::isVolatile(), clang::CodeGen::AggValueSlot::isVolatile(), clang::CodeGen::LValue::isVolatileQualified(), TryReferenceInitializationCore(), and TryReferenceListInitialization().
|
inline |
Returns true if this address space is a superset of the other one.
OpenCL v2.0 defines conversion rules (OpenCLC v2.0 s6.5.5) and notion of overlapping address spaces. CL1.1 or CL1.2: every address space is a superset of itself. CL2.0 adds: __generic is a superset of any address space except for __constant.
Definition at line 484 of file Type.h.
References getAddressSpace(), clang::opencl_constant, and clang::opencl_generic.
Referenced by checkConditionalPointerCompatibility(), checkPointerTypesForAssignment(), clang::PointerType::isAddressSpaceOverlapping(), and clang::ASTContext::mergeTypes().
bool Qualifiers::isEmptyWhenPrinted | ( | const PrintingPolicy & | Policy | ) | const |
Definition at line 1612 of file TypePrinter.cpp.
Referenced by AppendTypeQualList().
bool Qualifiers::isStrictSupersetOf | ( | Qualifiers | Other | ) | const |
Determine whether this set of qualifiers is a strict superset of another set of qualifiers, not considering qualifier compatibility.
Definition at line 55 of file Type.cpp.
References CVRMask, getAddressSpace(), getObjCGCAttr(), getObjCLifetime(), hasAddressSpace(), hasObjCGCAttr(), and hasObjCLifetime().
Referenced by DeduceTemplateArgumentsByTypeMatch().
|
inline |
|
inline |
|
inline |
|
inline |
void Qualifiers::print | ( | raw_ostream & | OS, |
const PrintingPolicy & | Policy, | ||
bool | appendSpaceIfNonEmpty = false |
||
) | const |
Definition at line 1632 of file TypePrinter.cpp.
Referenced by AppendTypeQualList().
|
inline |
Definition at line 570 of file Type.h.
Referenced by clang::ExtQuals::Profile().
|
inline |
Definition at line 392 of file Type.h.
References clang::Default.
Referenced by checkBlockPointerTypesForAssignment(), checkConditionalPointerCompatibility(), DeduceTemplateArgumentsByTypeMatch(), clang::ASTContext::mergeTypes(), clang::ASTContext::removeAddrSpaceQualType(), and removeCommonQualifiers().
|
inlinestatic |
Returns the common set of qualifiers while removing them from the given sets.
Definition at line 203 of file Type.h.
References addCVRQualifiers(), getAddressSpace(), getCVRQualifiers(), getObjCGCAttr(), getObjCLifetime(), removeAddressSpace(), removeCVRQualifiers(), removeObjCGCAttr(), removeObjCLifetime(), setAddressSpace(), setObjCGCAttr(), and setObjCLifetime().
Referenced by UnwrapTypeForDebugInfo().
|
inline |
Definition at line 273 of file Type.h.
Referenced by clang::Sema::BuildQualifiedType(), CastsAwayConstness(), and TypeInfoIsInStandardLibrary().
|
inline |
Definition at line 296 of file Type.h.
Referenced by clang::Sema::ActOnCXXDelete(), checkConditionalPointerCompatibility(), DeduceTemplateArgumentsByTypeMatch(), removeCommonQualifiers(), shouldBeModeledWithNoOp(), and TryConstCast().
|
inline |
Definition at line 406 of file Type.h.
Referenced by clang::ASTContext::getASTObjCImplementationLayout().
|
inline |
Definition at line 324 of file Type.h.
Referenced by DeduceTemplateArgumentsByTypeMatch(), clang::CodeGen::CodeGenFunction::EmitLValueForField(), removeCommonQualifiers(), TryReferenceInit(), TryStaticCast(), and withoutObjCGCAttr().
|
inline |
Definition at line 347 of file Type.h.
Referenced by checkPointerTypesForAssignment(), DeduceTemplateArgumentsByTypeMatch(), clang::ASTContext::getCanonicalFunctionResultType(), clang::ASTContext::getUnqualifiedObjCPointerType(), handleObjCOwnershipTypeAttr(), clang::TreeTransform< Derived >::RebuildQualifiedType(), removeCommonQualifiers(), rewriteToObjCProperty(), TryReferenceInit(), TryStaticCast(), and withoutObjCLifetime().
|
inline |
Remove the qualifiers from the given set from this set.
Definition at line 449 of file Type.h.
References getAddressSpace(), getObjCGCAttr(), and getObjCLifetime().
|
inline |
Definition at line 287 of file Type.h.
Referenced by clang::Sema::BuildQualifiedType().
|
inline |
Definition at line 316 of file Type.h.
Referenced by clang::QualType::isAtLeastAsQualifiedAs(), and TryReferenceInit().
|
inline |
Definition at line 280 of file Type.h.
Referenced by clang::Sema::BuildQualifiedType().
|
inline |
Definition at line 387 of file Type.h.
Referenced by checkConditionalPointerCompatibility(), clang::ASTContext::InitBuiltinTypes(), and removeCommonQualifiers().
|
inline |
Definition at line 292 of file Type.h.
Referenced by CastsAwayConstness(), and DeduceTemplateArgumentsByTypeMatch().
|
inline |
Definition at line 402 of file Type.h.
Referenced by getNonFastQualifiers().
|
inline |
Definition at line 321 of file Type.h.
Referenced by removeCommonQualifiers().
|
inline |
Definition at line 344 of file Type.h.
Referenced by DeduceTemplateArgumentsByTypeMatch(), and removeCommonQualifiers().
|
inline |
Definition at line 313 of file Type.h.
Referenced by clang::Sema::BuildQualifiedType().
|
inline |
Definition at line 277 of file Type.h.
Referenced by clang::CodeGen::CodeGenFunction::EmitLValueForField(), and clang::CodeGen::AggValueSlot::setVolatile().
|
inline |
Definition at line 329 of file Type.h.
References removeObjCGCAttr().
Referenced by checkPointerTypesForAssignment().
|
inline |
Definition at line 334 of file Type.h.
References removeObjCLifetime().
Referenced by checkPointerTypesForAssignment(), and DeduceTemplateArgumentsByTypeMatch().
|
friend |
|
friend |