浏览代码

SemaExprCXX - silence static analyzer getAs<> null dereference warnings. NFCI.

The static analyzer is warning about potential null dereferences, 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@375101 91177308-0d34-0410-b5e6-96231b3b80d8
Simon Pilgrim 5 年之前
父节点
当前提交
5632b3f285
共有 1 个文件被更改,包括 3 次插入3 次删除
  1. 3 3
      lib/Sema/SemaExprCXX.cpp

+ 3 - 3
lib/Sema/SemaExprCXX.cpp

@@ -3302,7 +3302,7 @@ Sema::ActOnCXXDelete(SourceLocation StartLoc, bool UseGlobal,
       //        itself in this case.
       //        itself in this case.
       return ExprError();
       return ExprError();
 
 
-    QualType Pointee = Type->getAs<PointerType>()->getPointeeType();
+    QualType Pointee = Type->castAs<PointerType>()->getPointeeType();
     QualType PointeeElem = Context.getBaseElementType(Pointee);
     QualType PointeeElem = Context.getBaseElementType(Pointee);
 
 
     if (Pointee.getAddressSpace() != LangAS::Default &&
     if (Pointee.getAddressSpace() != LangAS::Default &&
@@ -4034,8 +4034,8 @@ Sema::PerformImplicitConversion(Expr *From, QualType ToType,
 
 
   case ICK_Complex_Promotion:
   case ICK_Complex_Promotion:
   case ICK_Complex_Conversion: {
   case ICK_Complex_Conversion: {
-    QualType FromEl = From->getType()->getAs<ComplexType>()->getElementType();
-    QualType ToEl = ToType->getAs<ComplexType>()->getElementType();
+    QualType FromEl = From->getType()->castAs<ComplexType>()->getElementType();
+    QualType ToEl = ToType->castAs<ComplexType>()->getElementType();
     CastKind CK;
     CastKind CK;
     if (FromEl->isRealFloatingType()) {
     if (FromEl->isRealFloatingType()) {
       if (ToEl->isRealFloatingType())
       if (ToEl->isRealFloatingType())