diff options
author | Simon Pilgrim <llvm-dev@redking.me.uk> | 2019-10-03 11:22:48 +0000 |
---|---|---|
committer | Simon Pilgrim <llvm-dev@redking.me.uk> | 2019-10-03 11:22:48 +0000 |
commit | 1cd399c915a746b0426a8a094906fb5f2a6cea12 (patch) | |
tree | 2519659e9f589d3ac6bf1914046d2e7d689e1f43 /clang/lib/CodeGen/CGExprScalar.cpp | |
parent | 44bc1186e4bdb54f7f15dea8e85d9e83827bd0d0 (diff) | |
download | bcm5719-llvm-1cd399c915a746b0426a8a094906fb5f2a6cea12.tar.gz bcm5719-llvm-1cd399c915a746b0426a8a094906fb5f2a6cea12.zip |
Silence static analyzer getAs<RecordType> null dereference warnings. NFCI.
The static analyzer is warning about potential null dereferences, but in these cases we should be able to use castAs<RecordType> directly and if not assert will fire for us.
llvm-svn: 373584
Diffstat (limited to 'clang/lib/CodeGen/CGExprScalar.cpp')
-rw-r--r-- | clang/lib/CodeGen/CGExprScalar.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/clang/lib/CodeGen/CGExprScalar.cpp b/clang/lib/CodeGen/CGExprScalar.cpp index 4676be40768..bff88b2feca 100644 --- a/clang/lib/CodeGen/CGExprScalar.cpp +++ b/clang/lib/CodeGen/CGExprScalar.cpp @@ -2662,7 +2662,7 @@ Value *ScalarExprEmitter::VisitOffsetOfExpr(OffsetOfExpr *E) { case OffsetOfNode::Field: { FieldDecl *MemberDecl = ON.getField(); - RecordDecl *RD = CurrentType->getAs<RecordType>()->getDecl(); + RecordDecl *RD = CurrentType->castAs<RecordType>()->getDecl(); const ASTRecordLayout &RL = CGF.getContext().getASTRecordLayout(RD); // Compute the index of the field in its parent. @@ -2695,7 +2695,7 @@ Value *ScalarExprEmitter::VisitOffsetOfExpr(OffsetOfExpr *E) { continue; } - RecordDecl *RD = CurrentType->getAs<RecordType>()->getDecl(); + RecordDecl *RD = CurrentType->castAs<RecordType>()->getDecl(); const ASTRecordLayout &RL = CGF.getContext().getASTRecordLayout(RD); // Save the element type. |