forked from OSchip/llvm-project
SemaType.cpp - use castAs<> instead of getAs<> for dereferenced pointers
Fix static analyzer warnings - castAs<> will assert the type is correct, but getAs<> just returns null, which would just result in a dereferenced null pointer.
This commit is contained in:
parent
111ae220a3
commit
25f5df7e0b
|
@ -7967,7 +7967,7 @@ static void HandleOpenCLAccessAttr(QualType &CurType, const ParsedAttr &Attr,
|
|||
diag::note_opencl_typedef_access_qualifier) << PrevAccessQual;
|
||||
} else if (CurType->isPipeType()) {
|
||||
if (Attr.getSemanticSpelling() == OpenCLAccessAttr::Keyword_write_only) {
|
||||
QualType ElemType = CurType->getAs<PipeType>()->getElementType();
|
||||
QualType ElemType = CurType->castAs<PipeType>()->getElementType();
|
||||
CurType = S.Context.getWritePipeType(ElemType);
|
||||
}
|
||||
}
|
||||
|
@ -9021,7 +9021,7 @@ QualType Sema::BuildUnaryTransformType(QualType BaseType,
|
|||
return QualType();
|
||||
}
|
||||
|
||||
EnumDecl *ED = BaseType->getAs<EnumType>()->getDecl();
|
||||
EnumDecl *ED = BaseType->castAs<EnumType>()->getDecl();
|
||||
assert(ED && "EnumType has no EnumDecl");
|
||||
|
||||
DiagnoseUseOfDecl(ED, Loc);
|
||||
|
|
Loading…
Reference in New Issue