Skip to content

Commit

Permalink
[NFC][CLANG] Fix Static Code Analyzer Concerns with dereference null …
Browse files Browse the repository at this point in the history
…return value in applyObjCTypeArgs()

This patch uses castAs instead of getAs to resolve dereference issue with nullptr boundObjC when calling
canAssignObjCInterfaces() or isObjCIdType() in applyObjCTypeArgs() since getAs returns nullptr.

Reviewed By: erichkeane

Differential Revision: https://reviews.llvm.org/D151964
  • Loading branch information
smanna12 committed Jun 2, 2023
1 parent 02ce49a commit 8265994
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion clang/lib/Sema/SemaType.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -950,7 +950,7 @@ static QualType applyObjCTypeArgs(Sema &S, SourceLocation loc, QualType type,

// Retrieve the bound.
QualType bound = typeParam->getUnderlyingType();
const auto *boundObjC = bound->getAs<ObjCObjectPointerType>();
const auto *boundObjC = bound->castAs<ObjCObjectPointerType>();

// Determine whether the type argument is substitutable for the bound.
if (typeArgObjC->isObjCIdType()) {
Expand Down

0 comments on commit 8265994

Please sign in to comment.