diff options
Diffstat (limited to 'contrib/llvm-project/clang/include/clang/AST/TypeLoc.h')
-rw-r--r-- | contrib/llvm-project/clang/include/clang/AST/TypeLoc.h | 93 |
1 files changed, 71 insertions, 22 deletions
diff --git a/contrib/llvm-project/clang/include/clang/AST/TypeLoc.h b/contrib/llvm-project/clang/include/clang/AST/TypeLoc.h index 72cc8ef098e7..65e95d52c303 100644 --- a/contrib/llvm-project/clang/include/clang/AST/TypeLoc.h +++ b/contrib/llvm-project/clang/include/clang/AST/TypeLoc.h @@ -603,32 +603,32 @@ public: if (needsExtraLocalData()) return static_cast<TypeSpecifierSign>(getWrittenBuiltinSpecs().Sign); else - return TSS_unspecified; + return TypeSpecifierSign::Unspecified; } bool hasWrittenSignSpec() const { - return getWrittenSignSpec() != TSS_unspecified; + return getWrittenSignSpec() != TypeSpecifierSign::Unspecified; } void setWrittenSignSpec(TypeSpecifierSign written) { if (needsExtraLocalData()) - getWrittenBuiltinSpecs().Sign = written; + getWrittenBuiltinSpecs().Sign = static_cast<unsigned>(written); } TypeSpecifierWidth getWrittenWidthSpec() const { if (needsExtraLocalData()) return static_cast<TypeSpecifierWidth>(getWrittenBuiltinSpecs().Width); else - return TSW_unspecified; + return TypeSpecifierWidth::Unspecified; } bool hasWrittenWidthSpec() const { - return getWrittenWidthSpec() != TSW_unspecified; + return getWrittenWidthSpec() != TypeSpecifierWidth::Unspecified; } void setWrittenWidthSpec(TypeSpecifierWidth written) { if (needsExtraLocalData()) - getWrittenBuiltinSpecs().Width = written; + getWrittenBuiltinSpecs().Width = static_cast<unsigned>(written); } TypeSpecifierType getWrittenTypeSpec() const; @@ -658,8 +658,8 @@ public: setBuiltinLoc(Loc); if (needsExtraLocalData()) { WrittenBuiltinSpecs &wbs = getWrittenBuiltinSpecs(); - wbs.Sign = TSS_unspecified; - wbs.Width = TSW_unspecified; + wbs.Sign = static_cast<unsigned>(TypeSpecifierSign::Unspecified); + wbs.Width = static_cast<unsigned>(TypeSpecifierWidth::Unspecified); wbs.Type = TST_unspecified; wbs.ModeAttr = false; } @@ -1749,30 +1749,79 @@ public: // FIXME: size expression and attribute locations (or keyword if we // ever fully support altivec syntax). -class VectorTypeLoc : public InheritingConcreteTypeLoc<TypeSpecTypeLoc, - VectorTypeLoc, - VectorType> { +struct VectorTypeLocInfo { + SourceLocation NameLoc; +}; + +class VectorTypeLoc : public ConcreteTypeLoc<UnqualTypeLoc, VectorTypeLoc, + VectorType, VectorTypeLocInfo> { +public: + SourceLocation getNameLoc() const { return this->getLocalData()->NameLoc; } + + void setNameLoc(SourceLocation Loc) { this->getLocalData()->NameLoc = Loc; } + + SourceRange getLocalSourceRange() const { + return SourceRange(getNameLoc(), getNameLoc()); + } + + void initializeLocal(ASTContext &Context, SourceLocation Loc) { + setNameLoc(Loc); + } + + TypeLoc getElementLoc() const { return getInnerTypeLoc(); } + + QualType getInnerType() const { return this->getTypePtr()->getElementType(); } }; // FIXME: size expression and attribute locations (or keyword if we // ever fully support altivec syntax). class DependentVectorTypeLoc - : public InheritingConcreteTypeLoc<TypeSpecTypeLoc, - DependentVectorTypeLoc, - DependentVectorType> {}; + : public ConcreteTypeLoc<UnqualTypeLoc, DependentVectorTypeLoc, + DependentVectorType, VectorTypeLocInfo> { +public: + SourceLocation getNameLoc() const { return this->getLocalData()->NameLoc; } -// FIXME: size expression and attribute locations. -class ExtVectorTypeLoc : public InheritingConcreteTypeLoc<VectorTypeLoc, - ExtVectorTypeLoc, - ExtVectorType> { + void setNameLoc(SourceLocation Loc) { this->getLocalData()->NameLoc = Loc; } + + SourceRange getLocalSourceRange() const { + return SourceRange(getNameLoc(), getNameLoc()); + } + + void initializeLocal(ASTContext &Context, SourceLocation Loc) { + setNameLoc(Loc); + } + + TypeLoc getElementLoc() const { return getInnerTypeLoc(); } + + QualType getInnerType() const { return this->getTypePtr()->getElementType(); } }; +// FIXME: size expression and attribute locations. +class ExtVectorTypeLoc + : public InheritingConcreteTypeLoc<VectorTypeLoc, ExtVectorTypeLoc, + ExtVectorType> {}; + // FIXME: attribute locations. // For some reason, this isn't a subtype of VectorType. -class DependentSizedExtVectorTypeLoc : - public InheritingConcreteTypeLoc<TypeSpecTypeLoc, - DependentSizedExtVectorTypeLoc, - DependentSizedExtVectorType> { +class DependentSizedExtVectorTypeLoc + : public ConcreteTypeLoc<UnqualTypeLoc, DependentSizedExtVectorTypeLoc, + DependentSizedExtVectorType, VectorTypeLocInfo> { +public: + SourceLocation getNameLoc() const { return this->getLocalData()->NameLoc; } + + void setNameLoc(SourceLocation Loc) { this->getLocalData()->NameLoc = Loc; } + + SourceRange getLocalSourceRange() const { + return SourceRange(getNameLoc(), getNameLoc()); + } + + void initializeLocal(ASTContext &Context, SourceLocation Loc) { + setNameLoc(Loc); + } + + TypeLoc getElementLoc() const { return getInnerTypeLoc(); } + + QualType getInnerType() const { return this->getTypePtr()->getElementType(); } }; struct MatrixTypeLocInfo { |