Changeset View
Changeset View
Standalone View
Standalone View
clang/include/clang/AST/Type.h
Show First 20 Lines • Show All 3,886 Lines • ▼ Show 20 Lines | ||||||||||||
protected: | protected: | |||||||||||
FunctionType(TypeClass tc, QualType res, QualType Canonical, | FunctionType(TypeClass tc, QualType res, QualType Canonical, | |||||||||||
TypeDependence Dependence, ExtInfo Info) | TypeDependence Dependence, ExtInfo Info) | |||||||||||
: Type(tc, Canonical, Dependence), ResultType(res) { | : Type(tc, Canonical, Dependence), ResultType(res) { | |||||||||||
FunctionTypeBits.ExtInfo = Info.Bits; | FunctionTypeBits.ExtInfo = Info.Bits; | |||||||||||
} | } | |||||||||||
Qualifiers getFastTypeQuals() const { | Qualifiers getFastTypeQuals() const { | |||||||||||
if (isFunctionProtoType()) | ||||||||||||
return Qualifiers::fromFastMask(FunctionTypeBits.FastTypeQuals); | return Qualifiers::fromFastMask(FunctionTypeBits.FastTypeQuals); | |||||||||||
return Qualifiers(); | ||||||||||||
aaron.ballmanUnsubmitted Not Done ReplyInline Actions
aaron.ballman: | ||||||||||||
} | } | |||||||||||
public: | public: | |||||||||||
QualType getReturnType() const { return ResultType; } | QualType getReturnType() const { return ResultType; } | |||||||||||
bool getHasRegParm() const { return getExtInfo().getHasRegParm(); } | bool getHasRegParm() const { return getExtInfo().getHasRegParm(); } | |||||||||||
unsigned getRegParmType() const { return getExtInfo().getRegParm(); } | unsigned getRegParmType() const { return getExtInfo().getRegParm(); } | |||||||||||
Show All 34 Lines | class FunctionNoProtoType : public FunctionType, public llvm::FoldingSetNode { | |||||||||||
friend class ASTContext; // ASTContext creates these. | friend class ASTContext; // ASTContext creates these. | |||||||||||
FunctionNoProtoType(QualType Result, QualType Canonical, ExtInfo Info) | FunctionNoProtoType(QualType Result, QualType Canonical, ExtInfo Info) | |||||||||||
: FunctionType(FunctionNoProto, Result, Canonical, | : FunctionType(FunctionNoProto, Result, Canonical, | |||||||||||
Result->getDependence() & | Result->getDependence() & | |||||||||||
~(TypeDependence::DependentInstantiation | | ~(TypeDependence::DependentInstantiation | | |||||||||||
TypeDependence::UnexpandedPack), | TypeDependence::UnexpandedPack), | |||||||||||
Info) {} | Info) {} | |||||||||||
Not Done ReplyInline ActionsIt seems a bit odd to me that we only want to initialize one member of the bits and none of the rest. aaron.ballman: It seems a bit odd to me that we only want to initialize one member of the bits and none of the… | ||||||||||||
The reason I only set the FastTypeQuals is because the rest of the FunctionTypeBits are not accessed in the base class or this class, except for ExtInfo which is initialized in the base class. rmaz: The reason I only set the `FastTypeQuals` is because the rest of the `FunctionTypeBits` are not… | ||||||||||||
This feels error-prone since any new classes derived from FunctionType will need to also have this. I think the safer change is to modify FunctionType::getFastTypeQuals(). If this is a FunctionProtoType, use FastTypeQuals to create a Qualifiers. If it is not, return a default created Qualifiers. This way, we won't need to increase the access to data members. rtrieu: This feels error-prone since any new classes derived from `FunctionType` will need to also have… | ||||||||||||
public: | public: | |||||||||||
// No additional state past what FunctionType provides. | // No additional state past what FunctionType provides. | |||||||||||
bool isSugared() const { return false; } | bool isSugared() const { return false; } | |||||||||||
QualType desugar() const { return QualType(this, 0); } | QualType desugar() const { return QualType(this, 0); } | |||||||||||
void Profile(llvm::FoldingSetNodeID &ID) { | void Profile(llvm::FoldingSetNodeID &ID) { | |||||||||||
Profile(ID, getReturnType(), getExtInfo()); | Profile(ID, getReturnType(), getExtInfo()); | |||||||||||
▲ Show 20 Lines • Show All 3,496 Lines • Show Last 20 Lines |