diff options
author | Simon Pilgrim <llvm-dev@redking.me.uk> | 2019-10-17 11:12:53 +0000 |
---|---|---|
committer | Simon Pilgrim <llvm-dev@redking.me.uk> | 2019-10-17 11:12:53 +0000 |
commit | d0b0f651c1d35feda31f75b5a103c93de5758a4f (patch) | |
tree | 7f23d296784941c83d7121c61c87f0b522d49fd2 | |
parent | ff564228b6a3965e56e020f0242d8b4429ce0f0b (diff) |
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.
git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@375102 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | clang-tidy/misc/RedundantExpressionCheck.cpp | 2 | ||||
-rw-r--r-- | clang-tidy/modernize/UseDefaultMemberInitCheck.cpp | 8 |
2 files changed, 5 insertions, 5 deletions
diff --git a/clang-tidy/misc/RedundantExpressionCheck.cpp b/clang-tidy/misc/RedundantExpressionCheck.cpp index 3cec1fb9..e646ee91 100644 --- a/clang-tidy/misc/RedundantExpressionCheck.cpp +++ b/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<FunctionType>()->isConst()) + !OperatorDecl->getType()->castAs<FunctionType>()->isConst()) return true; if (isNonConstReferenceType(OperatorDecl->getParamDecl(0)->getType())) diff --git a/clang-tidy/modernize/UseDefaultMemberInitCheck.cpp b/clang-tidy/modernize/UseDefaultMemberInitCheck.cpp index 3c2e0e90..1e59acb1 100644 --- a/clang-tidy/modernize/UseDefaultMemberInitCheck.cpp +++ b/clang-tidy/modernize/UseDefaultMemberInitCheck.cpp @@ -29,7 +29,7 @@ static StringRef getValueOfValueInit(const QualType InitType) { return "false"; case Type::STK_Integral: - switch (InitType->getAs<BuiltinType>()->getKind()) { + switch (InitType->castAs<BuiltinType>()->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<BuiltinType>()->getKind()) { + switch (InitType->castAs<BuiltinType>()->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<ComplexType>()->getElementType()); + InitType->castAs<ComplexType>()->getElementType()); case Type::STK_FixedPoint: - switch (InitType->getAs<BuiltinType>()->getKind()) { + switch (InitType->castAs<BuiltinType>()->getKind()) { case BuiltinType::ShortAccum: case BuiltinType::SatShortAccum: return "0.0hk"; |