DeclCXX/ExprCXX - silence static analyzer getAs<> null dereference warnings. NFCI.

The static analyzer is warning about potential null dereferences, but in these cases we should be able to use castAs<> directly and if not assert will fire for us.

llvm-svn: 373198
This commit is contained in:
Simon Pilgrim 2019-09-30 11:04:12 +00:00
parent fdbe5b4b6f
commit 3ca270f05b
2 changed files with 4 additions and 5 deletions

View File

@ -2236,7 +2236,7 @@ public:
const CXXRecordDecl *Decl);
Qualifiers getMethodQualifiers() const {
return getType()->getAs<FunctionProtoType>()->getMethodQuals();
return getType()->castAs<FunctionProtoType>()->getMethodQuals();
}
/// Retrieve the ref-qualifier associated with this method.
@ -2251,7 +2251,7 @@ public:
/// };
/// @endcode
RefQualifierKind getRefQualifier() const {
return getType()->getAs<FunctionProtoType>()->getRefQualifier();
return getType()->castAs<FunctionProtoType>()->getRefQualifier();
}
bool hasInlineBody() const;
@ -2905,7 +2905,7 @@ public:
/// Returns the type that this conversion function is converting to.
QualType getConversionType() const {
return getType()->getAs<FunctionType>()->getReturnType();
return getType()->castAs<FunctionType>()->getReturnType();
}
/// Determine whether this conversion function is a conversion from

View File

@ -2096,8 +2096,7 @@ public:
bool IsParenTypeId);
QualType getAllocatedType() const {
assert(getType()->isPointerType());
return getType()->getAs<PointerType>()->getPointeeType();
return getType()->castAs<PointerType>()->getPointeeType();
}
TypeSourceInfo *getAllocatedTypeSourceInfo() const {