clang: clang::Qualifiers Class Reference (original ) (raw )The collection of all-type qualifiers we support. More...
#include "[clang/AST/Type.h](Type%5F8h%5Fsource.html)"
Public Types
enum
TQ : uint64_t { 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
: uint64_t { MaxAddressSpace = 0x7fffffu , FastWidth = 3 , FastMask = (1 << FastWidth) - 1 }
The collection of all-type qualifiers we support.
Clang supports five independent qualifiers:
C99: const, volatile, and restrict
MS: __unaligned
Embedded C (TR18037): address spaces
Objective C: the GC attributes (none, weak, or strong)
Definition at line 324 of file Type.h .
◆ anonymous enumanonymous enum : uint64_t
Enumerator
MaxAddressSpace
The maximum supported address space number. 23 bits should be enough for anyone.
FastWidth
The width of the "fast" qualifier mask.
FastMask
The fast qualifier mask.
Definition at line 363 of file Type.h .
◆ GC
Enumerator
GCNone
Weak
Strong
Definition at line 335 of file Type.h .
◆ ObjCLifetime
Enumerator
OCL_None
There is no lifetime qualification on this type.
OCL_ExplicitNone
This object can be modified without requiring retains or releases.
OCL_Strong
Assigning into this object requires the old value to be released and the new value to be retained. The timing of the release of the old value is inexact: it may be moved to immediately after the last known point where the value is live.
OCL_Weak
Reading or writing from this object requires a barrier call.
OCL_Autoreleasing
Assigning into this object requires a lifetime extension.
Definition at line 341 of file Type.h .
◆ TQ
Enumerator
Const
Restrict
Volatile
CVRMask
Definition at line 327 of file Type.h .
clang::Qualifiers::Qualifiers ( )
default
◆ addAddressSpace()
void clang::Qualifiers::addAddressSpace ( LangAS space )
inline
◆ addConsistentQualifiers()
void clang::Qualifiers::addConsistentQualifiers ( Qualifiers qs )
inline
Add the qualifiers from the given set to this set, given that they don't conflict.
Definition at line 682 of file Type.h .
References getAddressSpace() , getObjCGCAttr() , getObjCLifetime() , getPointerAuth() , hasAddressSpace() , hasObjCGCAttr() , hasObjCLifetime() , and hasPointerAuth() .
Referenced by clang::ASTContext::getBaseElementType() , clang::SplitQualType::getSingleStepDesugaredType() , clang::ASTContext::getUnqualifiedArrayType() , and unwrapSugar() .
◆ addConst()
void clang::Qualifiers::addConst ( )
inline
◆ addCVRQualifiers()
void clang::Qualifiers::addCVRQualifiers ( unsigned mask )
inline
◆ addCVRUQualifiers()
void clang::Qualifiers::addCVRUQualifiers ( unsigned mask )
inline
◆ addFastQualifiers()
void clang::Qualifiers::addFastQualifiers ( unsigned mask )
inline
◆ addObjCGCAttr()
void clang::Qualifiers::addObjCGCAttr ( GC type )
inline
◆ addObjCLifetime()
void clang::Qualifiers::addObjCLifetime ( ObjCLifetime type )
inline
◆ addPointerAuth()◆ addQualifiers()
void clang::Qualifiers::addQualifiers ( Qualifiers Q )
inline
Add the qualifiers from the given set to this set.
Definition at line 643 of file Type.h .
References addAddressSpace() , addObjCGCAttr() , addObjCLifetime() , addPointerAuth() , CVRMask , getAddressSpace() , getObjCGCAttr() , getObjCLifetime() , getPointerAuth() , hasAddressSpace() , hasObjCGCAttr() , hasObjCLifetime() , and hasPointerAuth() .
Referenced by operator+=() .
◆ addRestrict()
void clang::Qualifiers::addRestrict ( )
inline
◆ addUnaligned()
void clang::Qualifiers::addUnaligned ( )
inline
Definition at line 509 of file Type.h .
◆ addVolatile()
void clang::Qualifiers::addVolatile ( )
inline
◆ compatiblyIncludes()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 720 of file Type.h .
References CVRMask , getObjCGCAttr() , getObjCLifetime() , getPointerAuth() , hasObjCGCAttr() , hasUnaligned() , and isAddressSpaceSupersetOf() .
Referenced by AdoptQualifiers() , CheckOriginalCallArgDeduction() , checkPointerTypesForAssignment() , compareOverloads() , DeduceTemplateArgumentsByTypeMatch() , emitBadConversionNotes() , clang::Sema::handlerCanCatch() , clang::QualType::isMoreQualifiedThan() , clang::SemaObjC::isObjCWritebackConversion() , isQualificationConversionStep() , TryReferenceInit() , and TryStaticCast() .
◆ compatiblyIncludesObjCLifetime()
bool clang::Qualifiers::compatiblyIncludesObjCLifetime ( Qualifiers other ) const
inline
◆ empty()
bool clang::Qualifiers::empty ( ) const
inline
Definition at line 640 of file Type.h .
Referenced by clang::SemaObjC::actOnObjCTypeParam() , clang::Sema::CheckMain() , checkQualifiedFunction() , clang::Sema::CheckQualifiedFunctionForTypeId() , clang::ASTContext::getAsArrayType() , clang::ASTContext::getUnqualifiedArrayType() , clang::Expr::isNullPointerConstant() , clang::SemaObjC::isObjCWritebackConversion() , clang::isValidSwiftErrorResultType() , clang::TreeTransform< Derived >::TransformNestedNameSpecifierLoc() , and TypeInfoIsInStandardLibrary() .
◆ fromCVRMask()◆ fromCVRUMask()◆ fromFastMask()◆ fromOpaqueValue()
static Qualifiers clang::Qualifiers::fromOpaqueValue ( uint64_t opaque )
inlinestatic
◆ getAddressSpace()
LangAS clang::Qualifiers::getAddressSpace ( ) const
inline
Definition at line 564 of file Type.h .
Referenced by addConsistentQualifiers() , addQualifiers() , checkConditionalPointerCompatibility() , clang::Sema::CheckExplicitlyDefaultedSpecialMember() , checkPointerTypesForAssignment() , clang::CodeGen::CodeGenTypes::DeriveThisType() , clang::Sema::DiagnoseAssignmentResult() , DiagnoseBadConversion() , clang::Sema::FindCompositePointerType() , clang::CodeGen::LValue::getAddressSpace() , getAddressSpaceAttributePrintValue() , hasInconsistentOrSupersetQualifiersOf() , hasTargetSpecificAddressSpace() , isAddressSpaceSupersetOf() , isEmptyWhenPrinted() , IsModifiable() , isQualificationConversionStep() , isStrictSupersetOf() , clang::ASTContext::mergeObjCGCQualifiers() , clang::ASTContext::mergeTypes() , print() , clang::TreeTransform< Derived >::RebuildQualifiedType() , removeCommonQualifiers() , removeQualifiers() , ResolveConstructorOverload() , TryReferenceInitializationCore() , and TryUserDefinedConversion() .
◆ getAddressSpaceAttributePrintValue()
unsigned clang::Qualifiers::getAddressSpaceAttributePrintValue ( ) const
inline
◆ getAddrSpaceAsString()
std::string Qualifiers::getAddrSpaceAsString ( LangAS AS )
static
Definition at line 2520 of file TypePrinter.cpp .
References clang::cuda_constant , clang::cuda_device , clang::cuda_shared , clang::Default , clang::hlsl_groupshared , clang::opencl_constant , clang::opencl_generic , clang::opencl_global , clang::opencl_global_device , clang::opencl_global_host , clang::opencl_local , clang::opencl_private , clang::ptr32_sptr , clang::ptr32_uptr , clang::ptr64 , clang::sycl_global , clang::sycl_global_device , clang::sycl_global_host , clang::sycl_local , clang::sycl_private , clang::toTargetAddressSpace() , and clang::wasm_funcref .
Referenced by clang::FormatASTNodeDiagnosticArgument() , and print() .
◆ getAsOpaqueValue()
uint64_t clang::Qualifiers::getAsOpaqueValue ( ) const
inline
◆ getAsString() [1/2]
std::string Qualifiers::getAsString
(
)
const
◆ getAsString() [2/2]
std::string Qualifiers::getAsString
(
const PrintingPolicy &
Policy
)
const
◆ getCVRQualifiers()
unsigned clang::Qualifiers::getCVRQualifiers ( ) const
inline
Definition at line 481 of file Type.h .
References CVRMask .
Referenced by CastsAwayConstness() , checkConditionalPointerCompatibility() , DeduceTemplateArgumentsByTypeMatch() , clang::InitializationSequence::Diagnose() , DiagnoseBadConversion() , clang::CodeGen::LValue::getVRQualifiers() , hasCVRQualifiers() , hasInconsistentOrSupersetQualifiersOf() , hasMangledSubstitutionQualifiers() , isEmptyWhenPrinted() , isQualificationConversionStep() , clang::ASTContext::mergeObjCGCQualifiers() , clang::ASTContext::mergeTypes() , clang::Sema::PerformImplicitObjectArgumentInitialization() , print() , removeCommonQualifiers() , and TryReferenceInitializationCore() .
◆ getCVRUQualifiers()
unsigned clang::Qualifiers::getCVRUQualifiers ( ) const
inline
◆ getFastQualifiers()
unsigned clang::Qualifiers::getFastQualifiers ( ) const
inline
◆ getNonFastQualifiers()
Qualifiers clang::Qualifiers::getNonFastQualifiers ( ) const
inline
◆ getObjCGCAttr()
GC clang::Qualifiers::getObjCGCAttr ( ) const
inline
Definition at line 512 of file Type.h .
Referenced by addConsistentQualifiers() , addQualifiers() , compatiblyIncludes() , DiagnoseBadConversion() , clang::Sema::FindCompositePointerType() , hasInconsistentOrSupersetQualifiersOf() , isEmptyWhenPrinted() , clang::CodeGen::LValue::isObjCStrong() , clang::CodeGen::LValue::isObjCWeak() , isQualificationConversionStep() , isStrictSupersetOf() , clang::ASTContext::mergeObjCGCQualifiers() , clang::ASTContext::mergeTypes() , print() , removeCommonQualifiers() , and removeQualifiers() .
◆ getObjCLifetime()
ObjCLifetime clang::Qualifiers::getObjCLifetime ( ) const
inline
Definition at line 538 of file Type.h .
Referenced by clang::Sema::ActOnFields() , addConsistentQualifiers() , addQualifiers() , clang::ASTContext::BlockRequiresCopying() , CheckOriginalCallArgDeduction() , checkPointerTypesForAssignment() , compatiblyIncludes() , compatiblyIncludesObjCLifetime() , computeCopyInfoForBlockCapture() , clang::Sema::DiagnoseAssignmentResult() , DiagnoseBadConversion() , clang::CodeGen::CGObjCRuntime::EmitInitOfCatchParam() , clang::Sema::FindCompositePointerType() , clang::QualType::getObjCLifetime() , clang::CodeGen::LValue::getObjCLifetime() , clang::CodeGen::AggValueSlot::getObjCLifetime() , clang::SemaObjC::handleExternallyRetainedAttr() , hasInconsistentOrSupersetQualifiersOf() , hasNonTrivialObjCLifetime() , hasStrongOrWeakObjCLifetime() , InitCatchParam() , isEmptyWhenPrinted() , isNonTrivialObjCLifetimeConversion() , clang::QualType::isNonTrivialToPrimitiveCopy() , clang::SemaObjC::isObjCWritebackConversion() , isQualificationConversionStep() , isStrictSupersetOf() , clang::ASTContext::mergeTypes() , print() , removeCommonQualifiers() , removeQualifiers() , and clang::tryMakeVariablePseudoStrong() .
◆ getPointerAuth()◆ hasAddressSpace()
bool clang::Qualifiers::hasAddressSpace ( ) const
inline
◆ hasConst()
bool clang::Qualifiers::hasConst ( ) const
inline
Definition at line 450 of file Type.h .
References Const .
Referenced by CastsAwayConstness() , clang::Sema::CheckFunctionDeclaration() , CheckOriginalCallArgDeduction() , compatiblyIncludesObjCLifetime() , DiagnoseCastQual() , getNextQualifier() , clang::QualifiersAndAtomic::hasConst() , isConstantEmittableObjectType() , isNonTrivialObjCLifetimeConversion() , isQualificationConversionStep() , TryReferenceInitializationCore() , and TryReferenceListInitialization() .
◆ hasCVRQualifiers()
bool clang::Qualifiers::hasCVRQualifiers ( ) const
inline
◆ hasFastQualifiers()
bool clang::Qualifiers::hasFastQualifiers ( ) const
inline
◆ hasNonFastQualifiers()
bool clang::Qualifiers::hasNonFastQualifiers ( ) const
inline
◆ hasNonTrivialObjCLifetime()
bool clang::Qualifiers::hasNonTrivialObjCLifetime ( ) const
inline
◆ hasObjCGCAttr()
bool clang::Qualifiers::hasObjCGCAttr ( ) const
inline
◆ hasObjCLifetime()
bool clang::Qualifiers::hasObjCLifetime ( ) const
inline
Definition at line 537 of file Type.h .
Referenced by addConsistentQualifiers() , addObjCLifetime() , addQualifiers() , checkARCPropertyImpl() , DeduceTemplateArgumentsByTypeMatch() , DiagnoseUninitializedUse() , clang::ASTContext::getCanonicalFunctionResultType() , hasInconsistentOrSupersetQualifiersOf() , isStrictSupersetOf() , clang::TreeTransform< Derived >::RebuildQualifiedType() , rewriteToObjCProperty() , and TryDefaultInitialization() .
◆ hasOnlyConst()
bool clang::Qualifiers::hasOnlyConst ( ) const
inline
◆ hasOnlyRestrict()
bool clang::Qualifiers::hasOnlyRestrict ( ) const
inline
◆ hasOnlyVolatile()
bool clang::Qualifiers::hasOnlyVolatile ( ) const
inline
◆ hasPointerAuth()
bool clang::Qualifiers::hasPointerAuth ( ) const
inline
◆ hasQualifiers()
bool clang::Qualifiers::hasQualifiers ( ) const
inline
◆ hasRestrict()
bool clang::Qualifiers::hasRestrict ( ) const
inline
◆ hasStrongOrWeakObjCLifetime()
bool clang::Qualifiers::hasStrongOrWeakObjCLifetime ( ) const
inline
◆ hasTargetSpecificAddressSpace()
bool clang::Qualifiers::hasTargetSpecificAddressSpace ( ) const
inline
◆ hasUnaligned()
bool clang::Qualifiers::hasUnaligned ( ) const
inline
◆ hasVolatile()
bool clang::Qualifiers::hasVolatile ( ) const
inline
Definition at line 460 of file Type.h .
References Volatile .
Referenced by CollectVRQualifiers() , DiagnoseCastQual() , getNextQualifier() , clang::QualifiersAndAtomic::hasVolatile() , isConstantEmittableObjectType() , clang::QualType::isNonTrivialToPrimitiveCopy() , clang::CodeGen::LValue::isVolatile() , clang::CodeGen::AggValueSlot::isVolatile() , clang::CodeGen::LValue::isVolatileQualified() , TryReferenceInitializationCore() , and TryReferenceListInitialization() .
◆ isAddressSpaceSupersetOf() [1/2]Returns true if address space A is equal to or a superset of B.
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 701 of file Type.h .
References isTargetAddressSpaceSupersetOf() .
Referenced by clang::Sema::AddOverloadCandidate() , checkConditionalPointerCompatibility() , checkPointerTypesForAssignment() , compatiblyIncludes() , clang::InitializationSequence::Diagnose() , clang::Sema::FindCompositePointerType() , clang::QualType::isAddressSpaceOverlapping() , isAddressSpaceSupersetOf() , clang::isBetterOverloadCandidate() , isQualificationConversionStep() , clang::ASTContext::mergeTypes() , clang::Sema::PerformImplicitConversion() , TryObjectArgumentInitialization() , TryReferenceInitializationCore() , TryReferenceListInitialization() , and TryReinterpretCast() .
◆ isAddressSpaceSupersetOf() [2/2]◆ isEmptyWhenPrinted()◆ isStrictSupersetOf()◆ isTargetAddressSpaceSupersetOf()Definition at line 72 of file Type.cpp .
References clang::cuda_constant , clang::cuda_device , clang::cuda_shared , clang::Default , clang::ASTContext::getTargetInfo() , clang::TargetInfo::isAddressSpaceSupersetOf() , clang::isPtrSizeAddressSpace() , clang::opencl_constant , clang::opencl_generic , clang::opencl_global , clang::opencl_global_device , clang::opencl_global_host , clang::sycl_global , clang::sycl_global_device , clang::sycl_global_host , clang::sycl_local , and clang::sycl_private .
Referenced by isAddressSpaceSupersetOf() .
◆ operator bool()
clang::Qualifiers::operator bool ( ) const
inlineexplicit
◆ operator!=()◆ operator+=()◆ operator-=()◆ operator==()◆ print()
void Qualifiers::print
(
raw_ostream &
OS ,
const PrintingPolicy &
Policy ,
bool
appendSpaceIfNonEmpty = false
)
const
Definition at line 2567 of file TypePrinter.cpp .
References AppendTypeQualList() , getAddressSpace() , getAddrSpaceAsString() , getCVRQualifiers() , getObjCGCAttr() , getObjCLifetime() , hasUnaligned() , clang::isTargetAddressSpace() , OCL_Autoreleasing , OCL_ExplicitNone , OCL_None , OCL_Strong , OCL_Weak , clang::PrintingPolicy::Restrict , clang::PrintingPolicy::SuppressStrongLifetime , and Weak .
Referenced by getAsString() .
◆ Profile()
void clang::Qualifiers::Profile ( llvm::FoldingSetNodeID & ID ) const
inline
◆ removeAddressSpace()
void clang::Qualifiers::removeAddressSpace ( )
inline
Definition at line 589 of file Type.h .
References clang::Default , and setAddressSpace() .
Referenced by clang::Sema::BuildCallToMemberFunction() , checkBlockPointerTypesForAssignment() , checkConditionalPointerCompatibility() , DeduceTemplateArgumentsByTypeMatch() , clang::Expr::isNullPointerConstant() , clang::ASTContext::mergeTypes() , RemoveAddressSpaceFromPtr() , clang::ASTContext::removeAddrSpaceQualType() , removeCommonQualifiers() , removeQualifiers() , stripUnusedQualifiers() , TryReferenceInitializationCore() , and withoutAddressSpace() .
◆ removeCommonQualifiers()Returns the common set of qualifiers while removing them from the given sets.
Definition at line 377 of file Type.h .
References addCVRQualifiers() , CVRMask , clang::Empty , getAddressSpace() , getCVRQualifiers() , clang::PointerAuthQualifier::getKey() , getObjCGCAttr() , getObjCLifetime() , getPointerAuth() , clang::PointerAuthQualifier::isPresent() , clang::PointerAuthQualifier::KeyNoneInternal , removeAddressSpace() , removeCVRQualifiers() , removeObjCGCAttr() , removeObjCLifetime() , setAddressSpace() , setObjCGCAttr() , setObjCLifetime() , and setPointerAuth() .
Referenced by clang::ASTContext::getCommonSugaredType() , and UnwrapTypeForDebugInfo() .
◆ removeConst()
void clang::Qualifiers::removeConst ( )
inline
◆ removeCVRQualifiers() [1/2]
void clang::Qualifiers::removeCVRQualifiers ( )
inline
◆ removeCVRQualifiers() [2/2]
void clang::Qualifiers::removeCVRQualifiers ( unsigned mask )
inline
◆ removeFastQualifiers() [1/2]
void clang::Qualifiers::removeFastQualifiers ( )
inline
◆ removeFastQualifiers() [2/2]
void clang::Qualifiers::removeFastQualifiers ( unsigned mask )
inline
◆ removeObjCGCAttr()
void clang::Qualifiers::removeObjCGCAttr ( )
inline
Definition at line 516 of file Type.h .
References GCNone , and setObjCGCAttr() .
Referenced by clang::Sema::BuildCallToMemberFunction() , clang::Sema::BuildFieldReferenceExpr() , DeduceTemplateArgumentsByTypeMatch() , isQualificationConversionStep() , removeCommonQualifiers() , removeQualifiers() , stripUnusedQualifiers() , TryReferenceInit() , TryStaticCast() , and withoutObjCGCAttr() .
◆ removeObjCLifetime()
void clang::Qualifiers::removeObjCLifetime ( )
inline
Definition at line 544 of file Type.h .
References OCL_None , and setObjCLifetime() .
Referenced by BuildSimilarlyQualifiedPointerType() , checkPointerTypesForAssignment() , DeduceTemplateArgumentsByTypeMatch() , clang::ASTContext::getCanonicalFunctionResultType() , clang::ASTContext::getUnqualifiedObjCPointerType() , handleObjCOwnershipTypeAttr() , isQualificationConversionStep() , clang::TreeTransform< Derived >::RebuildQualifiedType() , removeCommonQualifiers() , removeQualifiers() , rewriteToObjCProperty() , stripUnusedQualifiers() , TryReferenceInit() , TryStaticCast() , and withoutObjCLifetime() .
◆ removePointerAuth()
void clang::Qualifiers::removePointerAuth ( )
inline
◆ removeQualifiers()
void clang::Qualifiers::removeQualifiers ( Qualifiers Q )
inline
◆ removeRestrict()
void clang::Qualifiers::removeRestrict ( )
inline
◆ removeUnaligned()
void clang::Qualifiers::removeUnaligned ( )
inline
◆ removeVolatile()
void clang::Qualifiers::removeVolatile ( )
inline
◆ setAddressSpace()
void clang::Qualifiers::setAddressSpace ( LangAS space )
inline
◆ setCVRQualifiers()
void clang::Qualifiers::setCVRQualifiers ( unsigned mask )
inline
◆ setFastQualifiers()
void clang::Qualifiers::setFastQualifiers ( unsigned mask )
inline
◆ setObjCGCAttr()
void clang::Qualifiers::setObjCGCAttr ( GC type )
inline
◆ setObjCLifetime()
void clang::Qualifiers::setObjCLifetime ( ObjCLifetime type )
inline
◆ setPointerAuth()◆ setUnaligned()
void clang::Qualifiers::setUnaligned ( bool flag )
inline
◆ withConst()
Qualifiers clang::Qualifiers::withConst ( ) const
inline
◆ withoutAddressSpace()
Qualifiers clang::Qualifiers::withoutAddressSpace ( ) const
inline
◆ withoutObjCGCAttr()
Qualifiers clang::Qualifiers::withoutObjCGCAttr ( ) const
inline
◆ withoutObjCLifetime()
Qualifiers clang::Qualifiers::withoutObjCLifetime ( ) const
inline
◆ withRestrict()
Qualifiers clang::Qualifiers::withRestrict ( ) const
inline
◆ withVolatile()
Qualifiers clang::Qualifiers::withVolatile ( ) const
inline
◆ operator+◆ operator-Compute the difference between two qualifier sets.
Definition at line 783 of file Type.h .
The documentation for this class was generated from the following files: