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 | 84d475a5ed105e42257720e7720ec3f3faecfdda (patch) | |
| tree | f2a45939ff57d32fc413f03269028072eac2f253 /lib/CodeGen/CGExprConstant.cpp | |
| parent | 5fb4ff534428df6daec215a0487df1d382792cb4 (diff) | |
| download | clang-84d475a5ed105e42257720e7720ec3f3faecfdda.tar.gz | |
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.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@373584 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGExprConstant.cpp')
| -rw-r--r-- | lib/CodeGen/CGExprConstant.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/CodeGen/CGExprConstant.cpp b/lib/CodeGen/CGExprConstant.cpp index 31cf2aef1b..5e51f2e310 100644 --- a/lib/CodeGen/CGExprConstant.cpp +++ b/lib/CodeGen/CGExprConstant.cpp @@ -659,7 +659,7 @@ static bool EmitDesignatedInitUpdater(ConstantEmitter &Emitter, } bool ConstStructBuilder::Build(InitListExpr *ILE, bool AllowOverwrite) { - RecordDecl *RD = ILE->getType()->getAs<RecordType>()->getDecl(); + RecordDecl *RD = ILE->getType()->castAs<RecordType>()->getDecl(); const ASTRecordLayout &Layout = CGM.getContext().getASTRecordLayout(RD); unsigned FieldNo = -1; @@ -839,7 +839,7 @@ bool ConstStructBuilder::Build(const APValue &Val, const RecordDecl *RD, } llvm::Constant *ConstStructBuilder::Finalize(QualType Type) { - RecordDecl *RD = Type->getAs<RecordType>()->getDecl(); + RecordDecl *RD = Type->castAs<RecordType>()->getDecl(); llvm::Type *ValTy = CGM.getTypes().ConvertType(Type); return Builder.build(ValTy, RD->hasFlexibleArrayMember()); } |
