[clang] 624cc70 - [AST] Migrate away from PointerUnion::{is,get} (NFC) (#119523)
via cfe-commits
cfe-commits at lists.llvm.org
Wed Dec 11 08:35:45 PST 2024
Author: Kazu Hirata
Date: 2024-12-11T08:35:41-08:00
New Revision: 624cc7048f604ed1087f63fdbe4cbf40f1d35b69
URL: https://github.com/llvm/llvm-project/commit/624cc7048f604ed1087f63fdbe4cbf40f1d35b69
DIFF: https://github.com/llvm/llvm-project/commit/624cc7048f604ed1087f63fdbe4cbf40f1d35b69.diff
LOG: [AST] Migrate away from PointerUnion::{is,get} (NFC) (#119523)
Note that PointerUnion::{is,get} have been soft deprecated in
PointerUnion.h:
// FIXME: Replace the uses of is(), get() and dyn_cast() with
// isa<T>, cast<T> and the llvm::dyn_cast<T>
I'm not touching PointerUnion::dyn_cast for now because it's a bit
complicated; we could blindly migrate it to dyn_cast_if_present, but
we should probably use dyn_cast when the operand is known to be
non-null.
Added:
Modified:
clang/include/clang/AST/Decl.h
clang/include/clang/AST/DeclBase.h
clang/include/clang/AST/DeclCXX.h
clang/include/clang/AST/DeclTemplate.h
clang/include/clang/AST/ExprCXX.h
clang/include/clang/AST/ExprConcepts.h
clang/include/clang/AST/ExprObjC.h
clang/include/clang/AST/Redeclarable.h
clang/include/clang/AST/TemplateBase.h
Removed:
################################################################################
diff --git a/clang/include/clang/AST/Decl.h b/clang/include/clang/AST/Decl.h
index 8c39ef3d5a9fa6..88d93a79d00f8f 100644
--- a/clang/include/clang/AST/Decl.h
+++ b/clang/include/clang/AST/Decl.h
@@ -747,9 +747,9 @@ class DeclaratorDecl : public ValueDecl {
/// ignoring outer template declarations.
SourceLocation InnerLocStart;
- bool hasExtInfo() const { return DeclInfo.is<ExtInfo*>(); }
- ExtInfo *getExtInfo() { return DeclInfo.get<ExtInfo*>(); }
- const ExtInfo *getExtInfo() const { return DeclInfo.get<ExtInfo*>(); }
+ bool hasExtInfo() const { return isa<ExtInfo *>(DeclInfo); }
+ ExtInfo *getExtInfo() { return cast<ExtInfo *>(DeclInfo); }
+ const ExtInfo *getExtInfo() const { return cast<ExtInfo *>(DeclInfo); }
protected:
DeclaratorDecl(Kind DK, DeclContext *DC, SourceLocation L,
@@ -762,9 +762,8 @@ class DeclaratorDecl : public ValueDecl {
friend class ASTDeclWriter;
TypeSourceInfo *getTypeSourceInfo() const {
- return hasExtInfo()
- ? getExtInfo()->TInfo
- : DeclInfo.get<TypeSourceInfo*>();
+ return hasExtInfo() ? getExtInfo()->TInfo
+ : cast<TypeSourceInfo *>(DeclInfo);
}
void setTypeSourceInfo(TypeSourceInfo *TI) {
@@ -3587,10 +3586,10 @@ class TagDecl : public TypeDecl,
/// otherwise, it is a null (TypedefNameDecl) pointer.
llvm::PointerUnion<TypedefNameDecl *, ExtInfo *> TypedefNameDeclOrQualifier;
- bool hasExtInfo() const { return TypedefNameDeclOrQualifier.is<ExtInfo *>(); }
- ExtInfo *getExtInfo() { return TypedefNameDeclOrQualifier.get<ExtInfo *>(); }
+ bool hasExtInfo() const { return isa<ExtInfo *>(TypedefNameDeclOrQualifier); }
+ ExtInfo *getExtInfo() { return cast<ExtInfo *>(TypedefNameDeclOrQualifier); }
const ExtInfo *getExtInfo() const {
- return TypedefNameDeclOrQualifier.get<ExtInfo *>();
+ return cast<ExtInfo *>(TypedefNameDeclOrQualifier);
}
protected:
@@ -3793,7 +3792,7 @@ class TagDecl : public TypeDecl,
TypedefNameDecl *getTypedefNameForAnonDecl() const {
return hasExtInfo() ? nullptr
- : TypedefNameDeclOrQualifier.get<TypedefNameDecl *>();
+ : cast<TypedefNameDecl *>(TypedefNameDeclOrQualifier);
}
void setTypedefNameForAnonDecl(TypedefNameDecl *TDD);
@@ -4011,7 +4010,7 @@ class EnumDecl : public TagDecl {
return QualType();
if (const Type *T = IntegerType.dyn_cast<const Type*>())
return QualType(T, 0);
- return IntegerType.get<TypeSourceInfo*>()->getType().getUnqualifiedType();
+ return cast<TypeSourceInfo *>(IntegerType)->getType().getUnqualifiedType();
}
/// Set the underlying integer type.
diff --git a/clang/include/clang/AST/DeclBase.h b/clang/include/clang/AST/DeclBase.h
index a3447d19909752..82932e098c86f0 100644
--- a/clang/include/clang/AST/DeclBase.h
+++ b/clang/include/clang/AST/DeclBase.h
@@ -271,16 +271,12 @@ class alignas(8) Decl {
/// // LexicalDC == global namespace
llvm::PointerUnion<DeclContext*, MultipleDC*> DeclCtx;
- bool isInSemaDC() const { return DeclCtx.is<DeclContext*>(); }
- bool isOutOfSemaDC() const { return DeclCtx.is<MultipleDC*>(); }
+ bool isInSemaDC() const { return isa<DeclContext *>(DeclCtx); }
+ bool isOutOfSemaDC() const { return isa<MultipleDC *>(DeclCtx); }
- MultipleDC *getMultipleDC() const {
- return DeclCtx.get<MultipleDC*>();
- }
+ MultipleDC *getMultipleDC() const { return cast<MultipleDC *>(DeclCtx); }
- DeclContext *getSemanticDC() const {
- return DeclCtx.get<DeclContext*>();
- }
+ DeclContext *getSemanticDC() const { return cast<DeclContext *>(DeclCtx); }
/// Loc - The location of this decl.
SourceLocation Loc;
@@ -1340,7 +1336,7 @@ class DeclListNode {
assert(Ptr && "dereferencing end() iterator");
if (DeclListNode *CurNode = Ptr.dyn_cast<DeclListNode*>())
return CurNode->D;
- return Ptr.get<NamedDecl*>();
+ return cast<NamedDecl *>(Ptr);
}
void operator->() const { } // Unsupported.
bool operator==(const iterator &X) const { return Ptr == X.Ptr; }
diff --git a/clang/include/clang/AST/DeclCXX.h b/clang/include/clang/AST/DeclCXX.h
index e389b5cd6df5b9..c232556edeff70 100644
--- a/clang/include/clang/AST/DeclCXX.h
+++ b/clang/include/clang/AST/DeclCXX.h
@@ -2388,19 +2388,19 @@ class CXXCtorInitializer final {
/// Determine whether this initializer is initializing a base class.
bool isBaseInitializer() const {
- return Initializee.is<TypeSourceInfo*>() && !IsDelegating;
+ return isa<TypeSourceInfo *>(Initializee) && !IsDelegating;
}
/// Determine whether this initializer is initializing a non-static
/// data member.
- bool isMemberInitializer() const { return Initializee.is<FieldDecl*>(); }
+ bool isMemberInitializer() const { return isa<FieldDecl *>(Initializee); }
bool isAnyMemberInitializer() const {
return isMemberInitializer() || isIndirectMemberInitializer();
}
bool isIndirectMemberInitializer() const {
- return Initializee.is<IndirectFieldDecl*>();
+ return isa<IndirectFieldDecl *>(Initializee);
}
/// Determine whether this initializer is an implicit initializer
@@ -2416,7 +2416,7 @@ class CXXCtorInitializer final {
/// Determine whether this initializer is creating a delegating
/// constructor.
bool isDelegatingInitializer() const {
- return Initializee.is<TypeSourceInfo*>() && IsDelegating;
+ return isa<TypeSourceInfo *>(Initializee) && IsDelegating;
}
/// Determine whether this initializer is a pack expansion.
@@ -2457,21 +2457,21 @@ class CXXCtorInitializer final {
/// non-static data member being initialized. Otherwise, returns null.
FieldDecl *getMember() const {
if (isMemberInitializer())
- return Initializee.get<FieldDecl*>();
+ return cast<FieldDecl *>(Initializee);
return nullptr;
}
FieldDecl *getAnyMember() const {
if (isMemberInitializer())
- return Initializee.get<FieldDecl*>();
+ return cast<FieldDecl *>(Initializee);
if (isIndirectMemberInitializer())
- return Initializee.get<IndirectFieldDecl*>()->getAnonField();
+ return cast<IndirectFieldDecl *>(Initializee)->getAnonField();
return nullptr;
}
IndirectFieldDecl *getIndirectMember() const {
if (isIndirectMemberInitializer())
- return Initializee.get<IndirectFieldDecl*>();
+ return cast<IndirectFieldDecl *>(Initializee);
return nullptr;
}
diff --git a/clang/include/clang/AST/DeclTemplate.h b/clang/include/clang/AST/DeclTemplate.h
index dd92d40b804232..44ccf8932a1830 100644
--- a/clang/include/clang/AST/DeclTemplate.h
+++ b/clang/include/clang/AST/DeclTemplate.h
@@ -1965,7 +1965,7 @@ class ClassTemplateSpecializationDecl : public CXXRecordDecl,
SpecializedTemplate.dyn_cast<SpecializedPartialSpecialization *>())
return PartialSpec->PartialSpecialization;
- return SpecializedTemplate.get<ClassTemplateDecl*>();
+ return cast<ClassTemplateDecl *>(SpecializedTemplate);
}
/// Retrieve the set of template arguments that should be used
@@ -2013,7 +2013,7 @@ class ClassTemplateSpecializationDecl : public CXXRecordDecl,
const ASTTemplateArgumentListInfo *getTemplateArgsAsWritten() const {
if (auto *Info = ExplicitInfo.dyn_cast<ExplicitInstantiationInfo *>())
return Info->TemplateArgsAsWritten;
- return ExplicitInfo.get<const ASTTemplateArgumentListInfo *>();
+ return cast<const ASTTemplateArgumentListInfo *>(ExplicitInfo);
}
/// Set the template argument list as written in the sources.
@@ -2734,7 +2734,7 @@ class VarTemplateSpecializationDecl : public VarDecl,
SpecializedTemplate.dyn_cast<SpecializedPartialSpecialization *>())
return PartialSpec->PartialSpecialization;
- return SpecializedTemplate.get<VarTemplateDecl *>();
+ return cast<VarTemplateDecl *>(SpecializedTemplate);
}
/// Retrieve the set of template arguments that should be used
@@ -2782,7 +2782,7 @@ class VarTemplateSpecializationDecl : public VarDecl,
const ASTTemplateArgumentListInfo *getTemplateArgsAsWritten() const {
if (auto *Info = ExplicitInfo.dyn_cast<ExplicitInstantiationInfo *>())
return Info->TemplateArgsAsWritten;
- return ExplicitInfo.get<const ASTTemplateArgumentListInfo *>();
+ return cast<const ASTTemplateArgumentListInfo *>(ExplicitInfo);
}
/// Set the template argument list as written in the sources.
@@ -3309,7 +3309,7 @@ inline NamedDecl *getAsNamedDecl(TemplateParameter P) {
return PD;
if (auto *PD = P.dyn_cast<NonTypeTemplateParmDecl *>())
return PD;
- return P.get<TemplateTemplateParmDecl *>();
+ return cast<TemplateTemplateParmDecl *>(P);
}
inline TemplateDecl *getAsTypeTemplateDecl(Decl *D) {
diff --git a/clang/include/clang/AST/ExprCXX.h b/clang/include/clang/AST/ExprCXX.h
index 1a24b8857674ca..4cec89c979f775 100644
--- a/clang/include/clang/AST/ExprCXX.h
+++ b/clang/include/clang/AST/ExprCXX.h
@@ -878,7 +878,7 @@ class CXXTypeidExpr : public Expr {
/// object. This is not a strong guarantee.
bool isMostDerived(const ASTContext &Context) const;
- bool isTypeOperand() const { return Operand.is<TypeSourceInfo *>(); }
+ bool isTypeOperand() const { return isa<TypeSourceInfo *>(Operand); }
/// Retrieves the type operand of this typeid() expression after
/// various required adjustments (removing reference types, cv-qualifiers).
@@ -887,11 +887,11 @@ class CXXTypeidExpr : public Expr {
/// Retrieve source information for the type operand.
TypeSourceInfo *getTypeOperandSourceInfo() const {
assert(isTypeOperand() && "Cannot call getTypeOperand for typeid(expr)");
- return Operand.get<TypeSourceInfo *>();
+ return cast<TypeSourceInfo *>(Operand);
}
Expr *getExprOperand() const {
assert(!isTypeOperand() && "Cannot call getExprOperand for typeid(type)");
- return static_cast<Expr*>(Operand.get<Stmt *>());
+ return static_cast<Expr *>(cast<Stmt *>(Operand));
}
SourceLocation getBeginLoc() const LLVM_READONLY { return Range.getBegin(); }
@@ -1093,7 +1093,7 @@ class CXXUuidofExpr : public Expr {
Operand = (TypeSourceInfo*)nullptr;
}
- bool isTypeOperand() const { return Operand.is<TypeSourceInfo *>(); }
+ bool isTypeOperand() const { return isa<TypeSourceInfo *>(Operand); }
/// Retrieves the type operand of this __uuidof() expression after
/// various required adjustments (removing reference types, cv-qualifiers).
@@ -1102,11 +1102,11 @@ class CXXUuidofExpr : public Expr {
/// Retrieve source information for the type operand.
TypeSourceInfo *getTypeOperandSourceInfo() const {
assert(isTypeOperand() && "Cannot call getTypeOperand for __uuidof(expr)");
- return Operand.get<TypeSourceInfo *>();
+ return cast<TypeSourceInfo *>(Operand);
}
Expr *getExprOperand() const {
assert(!isTypeOperand() && "Cannot call getExprOperand for __uuidof(type)");
- return static_cast<Expr*>(Operand.get<Stmt *>());
+ return static_cast<Expr *>(cast<Stmt *>(Operand));
}
MSGuidDecl *getGuidDecl() const { return Guid; }
@@ -4750,24 +4750,24 @@ class MaterializeTemporaryExpr : public Expr {
/// be materialized into a glvalue.
Expr *getSubExpr() const {
return cast<Expr>(
- State.is<Stmt *>()
- ? State.get<Stmt *>()
- : State.get<LifetimeExtendedTemporaryDecl *>()->getTemporaryExpr());
+ isa<Stmt *>(State)
+ ? cast<Stmt *>(State)
+ : cast<LifetimeExtendedTemporaryDecl *>(State)->getTemporaryExpr());
}
/// Retrieve the storage duration for the materialized temporary.
StorageDuration getStorageDuration() const {
- return State.is<Stmt *>() ? SD_FullExpression
- : State.get<LifetimeExtendedTemporaryDecl *>()
+ return isa<Stmt *>(State) ? SD_FullExpression
+ : cast<LifetimeExtendedTemporaryDecl *>(State)
->getStorageDuration();
}
/// Get the storage for the constant value of a materialized temporary
/// of static storage duration.
APValue *getOrCreateValue(bool MayCreate) const {
- assert(State.is<LifetimeExtendedTemporaryDecl *>() &&
+ assert(isa<LifetimeExtendedTemporaryDecl *>(State) &&
"the temporary has not been lifetime extended");
- return State.get<LifetimeExtendedTemporaryDecl *>()->getOrCreateValue(
+ return cast<LifetimeExtendedTemporaryDecl *>(State)->getOrCreateValue(
MayCreate);
}
@@ -4782,8 +4782,8 @@ class MaterializeTemporaryExpr : public Expr {
/// Get the declaration which triggered the lifetime-extension of this
/// temporary, if any.
ValueDecl *getExtendingDecl() {
- return State.is<Stmt *>() ? nullptr
- : State.get<LifetimeExtendedTemporaryDecl *>()
+ return isa<Stmt *>(State) ? nullptr
+ : cast<LifetimeExtendedTemporaryDecl *>(State)
->getExtendingDecl();
}
const ValueDecl *getExtendingDecl() const {
@@ -4793,8 +4793,8 @@ class MaterializeTemporaryExpr : public Expr {
void setExtendingDecl(ValueDecl *ExtendedBy, unsigned ManglingNumber);
unsigned getManglingNumber() const {
- return State.is<Stmt *>() ? 0
- : State.get<LifetimeExtendedTemporaryDecl *>()
+ return isa<Stmt *>(State) ? 0
+ : cast<LifetimeExtendedTemporaryDecl *>(State)
->getManglingNumber();
}
@@ -4820,17 +4820,17 @@ class MaterializeTemporaryExpr : public Expr {
// Iterators
child_range children() {
- return State.is<Stmt *>()
+ return isa<Stmt *>(State)
? child_range(State.getAddrOfPtr1(), State.getAddrOfPtr1() + 1)
- : State.get<LifetimeExtendedTemporaryDecl *>()->childrenExpr();
+ : cast<LifetimeExtendedTemporaryDecl *>(State)->childrenExpr();
}
const_child_range children() const {
- return State.is<Stmt *>()
+ return isa<Stmt *>(State)
? const_child_range(State.getAddrOfPtr1(),
State.getAddrOfPtr1() + 1)
: const_cast<const LifetimeExtendedTemporaryDecl *>(
- State.get<LifetimeExtendedTemporaryDecl *>())
+ cast<LifetimeExtendedTemporaryDecl *>(State))
->childrenExpr();
}
};
diff --git a/clang/include/clang/AST/ExprConcepts.h b/clang/include/clang/AST/ExprConcepts.h
index f3e32ce3961981..86c4155b6a853e 100644
--- a/clang/include/clang/AST/ExprConcepts.h
+++ b/clang/include/clang/AST/ExprConcepts.h
@@ -261,13 +261,13 @@ class TypeRequirement : public Requirement {
assert(Status == SS_SubstitutionFailure &&
"Attempted to get substitution diagnostic when there has been no "
"substitution failure.");
- return Value.get<SubstitutionDiagnostic *>();
+ return cast<SubstitutionDiagnostic *>(Value);
}
TypeSourceInfo *getType() const {
assert(!isSubstitutionFailure() &&
"Attempted to get type when there has been a substitution failure.");
- return Value.get<TypeSourceInfo *>();
+ return cast<TypeSourceInfo *>(Value);
}
static bool classof(const Requirement *R) {
@@ -409,14 +409,14 @@ class ExprRequirement : public Requirement {
assert(isExprSubstitutionFailure() &&
"Attempted to get expression substitution diagnostic when there has "
"been no expression substitution failure");
- return Value.get<SubstitutionDiagnostic *>();
+ return cast<SubstitutionDiagnostic *>(Value);
}
Expr *getExpr() const {
assert(!isExprSubstitutionFailure() &&
"ExprRequirement has no expression because there has been a "
"substitution failure.");
- return Value.get<Expr *>();
+ return cast<Expr *>(Value);
}
static bool classof(const Requirement *R) {
diff --git a/clang/include/clang/AST/ExprObjC.h b/clang/include/clang/AST/ExprObjC.h
index f833916c91aa54..1fccc260695820 100644
--- a/clang/include/clang/AST/ExprObjC.h
+++ b/clang/include/clang/AST/ExprObjC.h
@@ -752,28 +752,24 @@ class ObjCPropertyRefExpr : public Expr {
setMethodRefFlag(MethodRef_Setter, val);
}
- const Expr *getBase() const {
- return cast<Expr>(Receiver.get<Stmt*>());
- }
- Expr *getBase() {
- return cast<Expr>(Receiver.get<Stmt*>());
- }
+ const Expr *getBase() const { return cast<Expr>(cast<Stmt *>(Receiver)); }
+ Expr *getBase() { return cast<Expr>(cast<Stmt *>(Receiver)); }
SourceLocation getLocation() const { return IdLoc; }
SourceLocation getReceiverLocation() const { return ReceiverLoc; }
QualType getSuperReceiverType() const {
- return QualType(Receiver.get<const Type*>(), 0);
+ return QualType(cast<const Type *>(Receiver), 0);
}
ObjCInterfaceDecl *getClassReceiver() const {
- return Receiver.get<ObjCInterfaceDecl*>();
+ return cast<ObjCInterfaceDecl *>(Receiver);
}
- bool isObjectReceiver() const { return Receiver.is<Stmt*>(); }
- bool isSuperReceiver() const { return Receiver.is<const Type*>(); }
- bool isClassReceiver() const { return Receiver.is<ObjCInterfaceDecl*>(); }
+ bool isObjectReceiver() const { return isa<Stmt *>(Receiver); }
+ bool isSuperReceiver() const { return isa<const Type *>(Receiver); }
+ bool isClassReceiver() const { return isa<ObjCInterfaceDecl *>(Receiver); }
/// Determine the type of the base, regardless of the kind of receiver.
QualType getReceiverType(const ASTContext &ctx) const;
@@ -787,7 +783,7 @@ class ObjCPropertyRefExpr : public Expr {
// Iterators
child_range children() {
- if (Receiver.is<Stmt*>()) {
+ if (isa<Stmt *>(Receiver)) {
Stmt **begin = reinterpret_cast<Stmt**>(&Receiver); // hack!
return child_range(begin, begin+1);
}
diff --git a/clang/include/clang/AST/Redeclarable.h b/clang/include/clang/AST/Redeclarable.h
index 8d320a9ced2792..bba789375cb6ed 100644
--- a/clang/include/clang/AST/Redeclarable.h
+++ b/clang/include/clang/AST/Redeclarable.h
@@ -113,25 +113,24 @@ class Redeclarable {
DeclLink(PreviousTag, decl_type *D) : Link(NotKnownLatest(Previous(D))) {}
bool isFirst() const {
- return Link.is<KnownLatest>() ||
+ return isa<KnownLatest>(Link) ||
// FIXME: 'template' is required on the next line due to an
// apparent clang bug.
- Link.get<NotKnownLatest>().template is<UninitializedLatest>();
+ cast<NotKnownLatest>(Link).template is<UninitializedLatest>();
}
decl_type *getPrevious(const decl_type *D) const {
- if (Link.is<NotKnownLatest>()) {
- NotKnownLatest NKL = Link.get<NotKnownLatest>();
- if (NKL.is<Previous>())
- return static_cast<decl_type*>(NKL.get<Previous>());
+ if (NotKnownLatest NKL = dyn_cast<NotKnownLatest>(Link)) {
+ if (auto *Prev = dyn_cast<Previous>(NKL))
+ return static_cast<decl_type *>(Prev);
// Allocate the generational 'most recent' cache now, if needed.
Link = KnownLatest(*reinterpret_cast<const ASTContext *>(
- NKL.get<UninitializedLatest>()),
+ cast<UninitializedLatest>(NKL)),
const_cast<decl_type *>(D));
}
- return static_cast<decl_type*>(Link.get<KnownLatest>().get(D));
+ return static_cast<decl_type *>(cast<KnownLatest>(Link).get(D));
}
void setPrevious(decl_type *D) {
@@ -141,25 +140,24 @@ class Redeclarable {
void setLatest(decl_type *D) {
assert(isFirst() && "decl became canonical unexpectedly");
- if (Link.is<NotKnownLatest>()) {
- NotKnownLatest NKL = Link.get<NotKnownLatest>();
+ if (NotKnownLatest NKL = dyn_cast<NotKnownLatest>(Link)) {
Link = KnownLatest(*reinterpret_cast<const ASTContext *>(
- NKL.get<UninitializedLatest>()),
+ cast<UninitializedLatest>(NKL)),
D);
} else {
- auto Latest = Link.get<KnownLatest>();
+ auto Latest = cast<KnownLatest>(Link);
Latest.set(D);
Link = Latest;
}
}
- void markIncomplete() { Link.get<KnownLatest>().markIncomplete(); }
+ void markIncomplete() { cast<KnownLatest>(Link).markIncomplete(); }
Decl *getLatestNotUpdated() const {
assert(isFirst() && "expected a canonical decl");
- if (Link.is<NotKnownLatest>())
+ if (isa<NotKnownLatest>(Link))
return nullptr;
- return Link.get<KnownLatest>().getNotUpdated();
+ return cast<KnownLatest>(Link).getNotUpdated();
}
};
diff --git a/clang/include/clang/AST/TemplateBase.h b/clang/include/clang/AST/TemplateBase.h
index a8f0263d5505ac..9d0ee24a4f5e35 100644
--- a/clang/include/clang/AST/TemplateBase.h
+++ b/clang/include/clang/AST/TemplateBase.h
@@ -484,7 +484,7 @@ struct TemplateArgumentLocInfo {
Pointer;
TemplateTemplateArgLocInfo *getTemplate() const {
- return Pointer.get<TemplateTemplateArgLocInfo *>();
+ return cast<TemplateTemplateArgLocInfo *>(Pointer);
}
public:
@@ -499,10 +499,10 @@ struct TemplateArgumentLocInfo {
SourceLocation EllipsisLoc);
TypeSourceInfo *getAsTypeSourceInfo() const {
- return Pointer.get<TypeSourceInfo *>();
+ return cast<TypeSourceInfo *>(Pointer);
}
- Expr *getAsExpr() const { return Pointer.get<Expr *>(); }
+ Expr *getAsExpr() const { return cast<Expr *>(Pointer); }
NestedNameSpecifierLoc getTemplateQualifierLoc() const {
const auto *Template = getTemplate();
More information about the cfe-commits
mailing list