clang  3.7.0
Public Types | Public Member Functions | Static Public Member Functions | Friends | List of all members
clang::Qualifiers Class Reference

#include <Type.h>

Inheritance diagram for clang::Qualifiers:
[legend]

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 = 0xffffffu, FastWidth = 3, FastMask = (1 << FastWidth) - 1 }
 

Public Member Functions

 Qualifiers ()
 
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)
 
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
 
unsigned getAddressSpace () const
 
void setAddressSpace (unsigned space)
 
void removeAddressSpace ()
 
void addAddressSpace (unsigned space)
 
bool hasFastQualifiers () const
 
unsigned getFastQualifiers () const
 
void setFastQualifiers (unsigned mask)
 
void removeFastQualifiers (unsigned mask)
 
void removeFastQualifiers ()
 
void addFastQualifiers (unsigned mask)
 
bool hasNonFastQualifiers () const
 
Qualifiers getNonFastQualifiers () const
 
bool hasQualifiers () const
 hasQualifiers - 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. 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. More...
 
bool compatiblyIncludes (Qualifiers other) const
 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. 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
 
Qualifiersoperator+= (Qualifiers R)
 
Qualifiersoperator-= (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 fromOpaqueValue (unsigned opaque)
 

Friends

Qualifiers operator+ (Qualifiers L, Qualifiers R)
 
Qualifiers operator- (Qualifiers L, Qualifiers R)
 Compute the difference between two qualifier sets. More...
 

Detailed Description

Qualifiers - The collection of all-type qualifiers we support. Clang supports five independent qualifiers:

Definition at line 113 of file Type.h.

Member Enumeration Documentation

anonymous enum
Enumerator
MaxAddressSpace 

The maximum supported address space number. 24 bits should be enough for anyone.

FastWidth 

The width of the "fast" qualifier mask.

FastMask 

The fast qualifier mask.

Definition at line 150 of file Type.h.

Enumerator
GCNone 
Weak 
Strong 

Definition at line 122 of file Type.h.

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 128 of file Type.h.

Enumerator
Const 
Restrict 
Volatile 
CVRMask 

Definition at line 115 of file Type.h.

Constructor & Destructor Documentation

clang::Qualifiers::Qualifiers ( )
inline

Definition at line 162 of file Type.h.

Member Function Documentation

void clang::Qualifiers::addAddressSpace ( unsigned  space)
inline

Definition at line 320 of file Type.h.

References setAddressSpace().

Referenced by addQualifiers(), and clang::ASTContext::getAddrSpaceQualType().

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 394 of file Type.h.

References getAddressSpace(), getObjCGCAttr(), getObjCLifetime(), hasAddressSpace(), hasObjCGCAttr(), and hasObjCLifetime().

Referenced by clang::ASTContext::getBaseElementType(), clang::SplitQualType::getSingleStepDesugaredType(), and clang::ASTContext::getUnqualifiedArrayType().

void clang::Qualifiers::addConst ( )
inline

Definition at line 231 of file Type.h.

References Const.

Referenced by clang::Sema::AddBuiltinOperatorCandidates().

void clang::Qualifiers::addCVRQualifiers ( unsigned  mask)
inline
void clang::Qualifiers::addFastQualifiers ( unsigned  mask)
inline
void clang::Qualifiers::addObjCGCAttr ( GC  type)
inline

Definition at line 271 of file Type.h.

References setObjCGCAttr().

Referenced by addQualifiers(), and clang::ASTContext::getObjCGCQualType().

void clang::Qualifiers::addObjCLifetime ( ObjCLifetime  type)
inline
void clang::Qualifiers::addQualifiers ( Qualifiers  Q)
inline

Add the qualifiers from the given set to this set.

Definition at line 359 of file Type.h.

References addAddressSpace(), addObjCGCAttr(), addObjCLifetime(), CVRMask, getAddressSpace(), getObjCGCAttr(), getObjCLifetime(), hasAddressSpace(), hasObjCGCAttr(), and hasObjCLifetime().

Referenced by operator+=().

void clang::Qualifiers::addRestrict ( )
inline

Definition at line 245 of file Type.h.

References Restrict.

Referenced by CollectVRQualifiers().

void clang::Qualifiers::addVolatile ( )
inline

Definition at line 238 of file Type.h.

References Volatile.

Referenced by CollectVRQualifiers().

bool clang::Qualifiers::compatiblyIncludes ( Qualifiers  other) const
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 424 of file Type.h.

References CVRMask, getObjCGCAttr(), getObjCLifetime(), hasObjCGCAttr(), and isAddressSpaceSupersetOf().

Referenced by AdoptQualifiers(), CheckOriginalCallArgDeduction(), checkPointerTypesForAssignment(), clang::Sema::CompareReferenceRelationship(), clang::QualType::isMoreQualifiedThan(), clang::Sema::isObjCWritebackConversion(), clang::Sema::IsQualificationConversion(), TryReferenceInit(), and TryStaticCast().

bool clang::Qualifiers::compatiblyIncludesObjCLifetime ( Qualifiers  other) const
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.

Definition at line 442 of file Type.h.

References getObjCLifetime(), hasConst(), and OCL_Weak.

Referenced by CastsAwayConstness(), checkPointerTypesForAssignment(), clang::Sema::CompareReferenceRelationship(), and clang::Sema::IsQualificationConversion().

bool clang::Qualifiers::empty ( ) const
inline
static Qualifiers clang::Qualifiers::fromCVRMask ( unsigned  CVR)
inlinestatic
static Qualifiers clang::Qualifiers::fromFastMask ( unsigned  Mask)
inlinestatic

Definition at line 202 of file Type.h.

References addFastQualifiers().

Referenced by clang::QualType::split().

static Qualifiers clang::Qualifiers::fromOpaqueValue ( unsigned  opaque)
inlinestatic

Definition at line 215 of file Type.h.

unsigned clang::Qualifiers::getAddressSpace ( ) const
inline
unsigned clang::Qualifiers::getAsOpaqueValue ( ) const
inline

Definition at line 222 of file Type.h.

std::string Qualifiers::getAsString ( ) const
std::string Qualifiers::getAsString ( const PrintingPolicy Policy) const

Definition at line 1492 of file TypePrinter.cpp.

unsigned clang::Qualifiers::getCVRQualifiers ( ) const
inline
unsigned clang::Qualifiers::getFastQualifiers ( ) const
inline
Qualifiers clang::Qualifiers::getNonFastQualifiers ( ) const
inline

Definition at line 348 of file Type.h.

References setFastQualifiers().

GC clang::Qualifiers::getObjCGCAttr ( ) const
inline
ObjCLifetime clang::Qualifiers::getObjCLifetime ( ) const
inline
bool clang::Qualifiers::hasAddressSpace ( ) const
inline
bool clang::Qualifiers::hasConst ( ) const
inline
bool clang::Qualifiers::hasCVRQualifiers ( ) const
inline

Definition at line 247 of file Type.h.

References getCVRQualifiers().

bool clang::Qualifiers::hasFastQualifiers ( ) const
inline

Definition at line 327 of file Type.h.

References getFastQualifiers().

Referenced by clang::ExtQuals::ExtQuals(), and clang::ExtQuals::Profile().

bool clang::Qualifiers::hasNonFastQualifiers ( ) const
inline

hasNonFastQualifiers - Return true if the set contains any qualifiers which require an ExtQuals node to be allocated.

Definition at line 347 of file Type.h.

References FastMask.

Referenced by clang::QualifierCollector::apply(), clang::ExtQuals::ExtQuals(), and clang::ASTContext::getQualifiedType().

bool clang::Qualifiers::hasNonTrivialObjCLifetime ( ) const
inline

True if the lifetime is neither None or ExplicitNone.

Definition at line 301 of file Type.h.

References getObjCLifetime(), and OCL_ExplicitNone.

Referenced by DeduceTemplateArgumentsByTypeMatch().

bool clang::Qualifiers::hasObjCGCAttr ( ) const
inline
bool clang::Qualifiers::hasObjCLifetime ( ) const
inline
bool clang::Qualifiers::hasQualifiers ( ) const
inline

hasQualifiers - Return true if the set contains any qualifiers.

Definition at line 355 of file Type.h.

Referenced by operator bool().

bool clang::Qualifiers::hasRestrict ( ) const
inline
bool clang::Qualifiers::hasStrongOrWeakObjCLifetime ( ) const
inline

True if the lifetime is either strong or weak.

Definition at line 307 of file Type.h.

References getObjCLifetime(), OCL_Strong, and OCL_Weak.

Referenced by clang::CodeGen::CodeGenFunction::GenerateDestroyHelperFunction().

bool clang::Qualifiers::hasVolatile ( ) const
inline
bool clang::Qualifiers::isAddressSpaceSupersetOf ( Qualifiers  other) const
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 411 of file Type.h.

References getAddressSpace(), clang::LangAS::opencl_constant, and clang::LangAS::opencl_generic.

Referenced by checkPointerTypesForAssignment(), compatiblyIncludes(), and clang::PointerType::isAddressSpaceOverlapping().

bool Qualifiers::isEmptyWhenPrinted ( const PrintingPolicy Policy) const

Definition at line 1499 of file TypePrinter.cpp.

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 31 of file Type.cpp.

References CVRMask, getAddressSpace(), getObjCGCAttr(), getObjCLifetime(), hasAddressSpace(), hasObjCGCAttr(), and hasObjCLifetime().

Referenced by clang::Sema::CXXCheckConditionalOperands(), and DeduceTemplateArgumentsByTypeMatch().

clang::Qualifiers::operator bool ( ) const
inlineexplicit

Definition at line 459 of file Type.h.

References hasQualifiers().

bool clang::Qualifiers::operator!= ( Qualifiers  Other) const
inline

Definition at line 457 of file Type.h.

Qualifiers& clang::Qualifiers::operator+= ( Qualifiers  R)
inline

Definition at line 461 of file Type.h.

References addQualifiers().

Qualifiers& clang::Qualifiers::operator-= ( Qualifiers  R)
inline

Definition at line 473 of file Type.h.

References removeQualifiers().

bool clang::Qualifiers::operator== ( Qualifiers  Other) const
inline

Definition at line 456 of file Type.h.

void Qualifiers::print ( raw_ostream &  OS,
const PrintingPolicy Policy,
bool  appendSpaceIfNonEmpty = false 
) const

Definition at line 1519 of file TypePrinter.cpp.

Referenced by clang::QualType::print().

void clang::Qualifiers::Profile ( llvm::FoldingSetNodeID &  ID) const
inline

Definition at line 491 of file Type.h.

Referenced by clang::Sema::IsOverload(), and clang::ExtQuals::Profile().

void clang::Qualifiers::removeAddressSpace ( )
inline
static Qualifiers clang::Qualifiers::removeCommonQualifiers ( Qualifiers L,
Qualifiers R 
)
inlinestatic
void clang::Qualifiers::removeConst ( )
inline

Definition at line 230 of file Type.h.

References Const.

Referenced by BuildFieldReferenceExpr(), clang::Sema::CheckMain(), and TypeInfoIsInStandardLibrary().

void clang::Qualifiers::removeCVRQualifiers ( unsigned  mask)
inline
void clang::Qualifiers::removeCVRQualifiers ( )
inline

Definition at line 257 of file Type.h.

References CVRMask.

void clang::Qualifiers::removeFastQualifiers ( unsigned  mask)
inline

Definition at line 333 of file Type.h.

References FastMask.

void clang::Qualifiers::removeFastQualifiers ( )
inline

Definition at line 337 of file Type.h.

References FastMask.

void clang::Qualifiers::removeObjCGCAttr ( )
inline
void clang::Qualifiers::removeObjCLifetime ( )
inline
void clang::Qualifiers::removeQualifiers ( Qualifiers  Q)
inline

Remove the qualifiers from the given set from this set.

Definition at line 376 of file Type.h.

References CVRMask, getAddressSpace(), getObjCGCAttr(), getObjCLifetime(), removeAddressSpace(), removeObjCGCAttr(), and removeObjCLifetime().

Referenced by operator-=().

void clang::Qualifiers::removeRestrict ( )
inline

Definition at line 244 of file Type.h.

References Restrict.

Referenced by clang::Sema::BuildQualifiedType().

void clang::Qualifiers::removeVolatile ( )
inline

Definition at line 237 of file Type.h.

References Volatile.

void clang::Qualifiers::setAddressSpace ( unsigned  space)
inline

Definition at line 314 of file Type.h.

References MaxAddressSpace.

Referenced by addAddressSpace(), removeAddressSpace(), and removeCommonQualifiers().

void clang::Qualifiers::setConst ( bool  flag)
inline

Definition at line 227 of file Type.h.

References Const.

void clang::Qualifiers::setCVRQualifiers ( unsigned  mask)
inline

Definition at line 249 of file Type.h.

References CVRMask.

Referenced by CastsAwayConstness(), and DeduceTemplateArgumentsByTypeMatch().

void clang::Qualifiers::setFastQualifiers ( unsigned  mask)
inline

Definition at line 329 of file Type.h.

References FastMask.

Referenced by getNonFastQualifiers().

void clang::Qualifiers::setObjCGCAttr ( GC  type)
inline
void clang::Qualifiers::setObjCLifetime ( ObjCLifetime  type)
inline
void clang::Qualifiers::setRestrict ( bool  flag)
inline

Definition at line 241 of file Type.h.

References Restrict.

void clang::Qualifiers::setVolatile ( bool  flag)
inline

Definition at line 234 of file Type.h.

References Volatile.

Referenced by clang::CodeGen::AggValueSlot::setVolatile().

Qualifiers clang::Qualifiers::withoutObjCGCAttr ( ) const
inline

Definition at line 275 of file Type.h.

References removeObjCGCAttr().

Referenced by checkPointerTypesForAssignment().

Qualifiers clang::Qualifiers::withoutObjCLifetime ( ) const
inline

Friends And Related Function Documentation

Qualifiers operator+ ( Qualifiers  L,
Qualifiers  R 
)
friend

Definition at line 468 of file Type.h.

Qualifiers operator- ( Qualifiers  L,
Qualifiers  R 
)
friend

Compute the difference between two qualifier sets.

Definition at line 479 of file Type.h.


The documentation for this class was generated from the following files: