forked from OSchip/llvm-project
[clang] CGDebugInfo::getOrCreateMethodType - use castAs<> instead of getAs<> to avoid dereference of nullptr
The pointer is always dereferenced, so assert the cast is correct instead of returning nullptr
This commit is contained in:
parent
2614de8202
commit
57fc9798d7
|
@ -1725,7 +1725,7 @@ void CGDebugInfo::CollectRecordFields(
|
||||||
llvm::DISubroutineType *
|
llvm::DISubroutineType *
|
||||||
CGDebugInfo::getOrCreateMethodType(const CXXMethodDecl *Method,
|
CGDebugInfo::getOrCreateMethodType(const CXXMethodDecl *Method,
|
||||||
llvm::DIFile *Unit, bool decl) {
|
llvm::DIFile *Unit, bool decl) {
|
||||||
const FunctionProtoType *Func = Method->getType()->getAs<FunctionProtoType>();
|
const auto *Func = Method->getType()->castAs<FunctionProtoType>();
|
||||||
if (Method->isStatic())
|
if (Method->isStatic())
|
||||||
return cast_or_null<llvm::DISubroutineType>(
|
return cast_or_null<llvm::DISubroutineType>(
|
||||||
getOrCreateType(QualType(Func, 0), Unit));
|
getOrCreateType(QualType(Func, 0), Unit));
|
||||||
|
|
Loading…
Reference in New Issue