From 2ea8b58cb6182b0e0a8982849a1702406abfc99b Mon Sep 17 00:00:00 2001 From: Simon Pilgrim Date: Thu, 17 Oct 2019 11:12:53 +0000 Subject: [PATCH] clang-tidy - 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. llvm-svn: 375102 --- clang-tools-extra/clang-tidy/misc/RedundantExpressionCheck.cpp | 2 +- .../clang-tidy/modernize/UseDefaultMemberInitCheck.cpp | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/clang-tools-extra/clang-tidy/misc/RedundantExpressionCheck.cpp b/clang-tools-extra/clang-tidy/misc/RedundantExpressionCheck.cpp index 3cec1fb..e646ee9 100644 --- a/clang-tools-extra/clang-tidy/misc/RedundantExpressionCheck.cpp +++ b/clang-tools-extra/clang-tidy/misc/RedundantExpressionCheck.cpp @@ -478,7 +478,7 @@ canOverloadedOperatorArgsBeModified(const FunctionDecl *OperatorDecl, // These functions must be declared const in order to not be able to modify // the instance of the class they are called through. if (ParamCount == 1 && - !OperatorDecl->getType()->getAs()->isConst()) + !OperatorDecl->getType()->castAs()->isConst()) return true; if (isNonConstReferenceType(OperatorDecl->getParamDecl(0)->getType())) diff --git a/clang-tools-extra/clang-tidy/modernize/UseDefaultMemberInitCheck.cpp b/clang-tools-extra/clang-tidy/modernize/UseDefaultMemberInitCheck.cpp index 3c2e0e9..1e59acb 100644 --- a/clang-tools-extra/clang-tidy/modernize/UseDefaultMemberInitCheck.cpp +++ b/clang-tools-extra/clang-tidy/modernize/UseDefaultMemberInitCheck.cpp @@ -29,7 +29,7 @@ static StringRef getValueOfValueInit(const QualType InitType) { return "false"; case Type::STK_Integral: - switch (InitType->getAs()->getKind()) { + switch (InitType->castAs()->getKind()) { case BuiltinType::Char_U: case BuiltinType::UChar: case BuiltinType::Char_S: @@ -47,7 +47,7 @@ static StringRef getValueOfValueInit(const QualType InitType) { } case Type::STK_Floating: - switch (InitType->getAs()->getKind()) { + switch (InitType->castAs()->getKind()) { case BuiltinType::Half: case BuiltinType::Float: return "0.0f"; @@ -58,10 +58,10 @@ static StringRef getValueOfValueInit(const QualType InitType) { case Type::STK_FloatingComplex: case Type::STK_IntegralComplex: return getValueOfValueInit( - InitType->getAs()->getElementType()); + InitType->castAs()->getElementType()); case Type::STK_FixedPoint: - switch (InitType->getAs()->getKind()) { + switch (InitType->castAs()->getKind()) { case BuiltinType::ShortAccum: case BuiltinType::SatShortAccum: return "0.0hk"; -- 2.7.4