summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Pilgrim <llvm-dev@redking.me.uk>2019-10-16 10:38:40 +0000
committerSimon Pilgrim <llvm-dev@redking.me.uk>2019-10-16 10:38:40 +0000
commite606cc177eb257f38d77f8694f3d0db0a62fa942 (patch)
tree65faf33d7612d9a68d28d1db100040e41a30cd8d
parent21346630556826c9424d3dad423ad4650ffac620 (diff)
downloadclang-e606cc177eb257f38d77f8694f3d0db0a62fa942.tar.gz
CGExprConstant - silence static analyzer getAs<> null dereference warning. NFCI.
The static analyzer is warning about a potential null dereference, but in these cases we should be able to use castAs<> directly and if not assert will fire for us. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@374988 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/CodeGen/CGExprConstant.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/CodeGen/CGExprConstant.cpp b/lib/CodeGen/CGExprConstant.cpp
index 03ef4ab184..96e8c9c0d0 100644
--- a/lib/CodeGen/CGExprConstant.cpp
+++ b/lib/CodeGen/CGExprConstant.cpp
@@ -1269,8 +1269,8 @@ public:
return nullptr;
// FIXME: We should not have to call getBaseElementType here.
- const RecordType *RT =
- CGM.getContext().getBaseElementType(Ty)->getAs<RecordType>();
+ const auto *RT =
+ CGM.getContext().getBaseElementType(Ty)->castAs<RecordType>();
const CXXRecordDecl *RD = cast<CXXRecordDecl>(RT->getDecl());
// If the class doesn't have a trivial destructor, we can't emit it as a