Skip to content

Commit cebfddc

Browse files
committed
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. llvm-svn: 374988
1 parent 729a2f6 commit cebfddc

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

clang/lib/CodeGen/CGExprConstant.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1269,8 +1269,8 @@ class ConstExprEmitter :
12691269
return nullptr;
12701270

12711271
// FIXME: We should not have to call getBaseElementType here.
1272-
const RecordType *RT =
1273-
CGM.getContext().getBaseElementType(Ty)->getAs<RecordType>();
1272+
const auto *RT =
1273+
CGM.getContext().getBaseElementType(Ty)->castAs<RecordType>();
12741274
const CXXRecordDecl *RD = cast<CXXRecordDecl>(RT->getDecl());
12751275

12761276
// If the class doesn't have a trivial destructor, we can't emit it as a

0 commit comments

Comments
 (0)