@@ -87,7 +87,7 @@ void PrettyDeclStackTraceEntry::print(raw_ostream &OS) const {
87
87
}
88
88
OS << Message;
89
89
90
- if (auto *ND = dyn_cast_or_null <NamedDecl>(TheDecl)) {
90
+ if (auto *ND = dyn_cast_if_present <NamedDecl>(TheDecl)) {
91
91
OS << " '" ;
92
92
ND->getNameForDiagnostic (OS, Context.getPrintingPolicy (), true );
93
93
OS << " '" ;
@@ -1948,7 +1948,7 @@ bool NamedDecl::isCXXInstanceMember() const {
1948
1948
1949
1949
if (isa<FieldDecl>(D) || isa<IndirectFieldDecl>(D) || isa<MSPropertyDecl>(D))
1950
1950
return true ;
1951
- if (const auto *MD = dyn_cast_or_null <CXXMethodDecl>(D->getAsFunction ()))
1951
+ if (const auto *MD = dyn_cast_if_present <CXXMethodDecl>(D->getAsFunction ()))
1952
1952
return MD->isInstance ();
1953
1953
return false ;
1954
1954
}
@@ -2944,7 +2944,7 @@ Expr *ParmVarDecl::getDefaultArg() {
2944
2944
" Default argument is not yet instantiated!" );
2945
2945
2946
2946
Expr *Arg = getInit ();
2947
- if (auto *E = dyn_cast_or_null <FullExpr>(Arg))
2947
+ if (auto *E = dyn_cast_if_present <FullExpr>(Arg))
2948
2948
return E->getSubExpr ();
2949
2949
2950
2950
return Arg;
@@ -2983,7 +2983,7 @@ void ParmVarDecl::setUninstantiatedDefaultArg(Expr *arg) {
2983
2983
Expr *ParmVarDecl::getUninstantiatedDefaultArg () {
2984
2984
assert (hasUninstantiatedDefaultArg () &&
2985
2985
" Wrong kind of initialization expression!" );
2986
- return cast_or_null <Expr>(Init.get <Stmt *>());
2986
+ return cast_if_present <Expr>(Init.get <Stmt *>());
2987
2987
}
2988
2988
2989
2989
bool ParmVarDecl::hasDefaultArg () const {
@@ -3950,7 +3950,7 @@ FunctionDecl::setInstantiationOfMemberFunction(ASTContext &C,
3950
3950
}
3951
3951
3952
3952
FunctionTemplateDecl *FunctionDecl::getDescribedFunctionTemplate () const {
3953
- return dyn_cast_or_null <FunctionTemplateDecl>(
3953
+ return dyn_cast_if_present <FunctionTemplateDecl>(
3954
3954
TemplateOrSpecialization.dyn_cast <NamedDecl *>());
3955
3955
}
3956
3956
@@ -3968,7 +3968,7 @@ void FunctionDecl::setInstantiatedFromDecl(FunctionDecl *FD) {
3968
3968
}
3969
3969
3970
3970
FunctionDecl *FunctionDecl::getInstantiatedFromDecl () const {
3971
- return dyn_cast_or_null <FunctionDecl>(
3971
+ return dyn_cast_if_present <FunctionDecl>(
3972
3972
TemplateOrSpecialization.dyn_cast <NamedDecl *>());
3973
3973
}
3974
3974
@@ -4452,7 +4452,7 @@ Expr *FieldDecl::getInClassInitializer() const {
4452
4452
return nullptr ;
4453
4453
4454
4454
LazyDeclStmtPtr InitPtr = BitField ? InitAndBitWidth->Init : Init;
4455
- return cast_or_null <Expr>(
4455
+ return cast_if_present <Expr>(
4456
4456
InitPtr.isOffset () ? InitPtr.get (getASTContext ().getExternalSource ())
4457
4457
: InitPtr.get (nullptr ));
4458
4458
}
0 commit comments