aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Target/RISCV/Disassembler/RISCVDisassembler.cpp
diff options
context:
space:
mode:
authorManna, Soumi <soumi.manna@intel.com>2023-05-24 19:13:12 -0700
committerManna, Soumi <soumi.manna@intel.com>2023-05-24 19:17:03 -0700
commitad571e0d84b30f73fa36d6694c66d5b0fb896f97 (patch)
tree597984be6af61df75403638138d6220e33ecb216 /llvm/lib/Target/RISCV/Disassembler/RISCVDisassembler.cpp
parentd0d26ee78cde3402fbc1fe445bcbcfc7606fbcd1 (diff)
downloadllvm-ad571e0d84b30f73fa36d6694c66d5b0fb896f97.zip
llvm-ad571e0d84b30f73fa36d6694c66d5b0fb896f97.tar.gz
llvm-ad571e0d84b30f73fa36d6694c66d5b0fb896f97.tar.bz2
[NFC][CLANG] Fix issue with dereference null return value found by Coverity
Reported by Static Analyzer Tool, Coverity: Inside "SemaDeclCXX.cpp" file, in clang::Sema::CheckExplicitlyDefaultedSpecialMember(clang::CXXMethodDecl *, clang::Sema::CXXSpecialMember, clang::SourceLocation): Return value of function which returns null is dereferenced without checking. //returned_null: getAs returns nullptr (checked 117 out of 143 times). // var_assigned: Assigning: Type = nullptr return value from getAs. const FunctionProtoType *Type = MD->getType()->getAs<FunctionProtoType>(); //Dereference null return value (NULL_RETURNS) //dereference: Dereferencing a pointer that might be nullptr Type when calling getReturnType. ReturnType = Type->getReturnType(); //Dereference null return value (NULL_RETURNS) //dereference: Dereferencing a pointer that might be nullptr Type when calling getParamType. QualType ArgType = ExpectedParams ? Type->getParamType(0) : QualType(); This patch uses castAs instead of getAs which will assert if the type doesn't match. Reviewed By: erichkeane Differential Revision: https://reviews.llvm.org/D151281
Diffstat (limited to 'llvm/lib/Target/RISCV/Disassembler/RISCVDisassembler.cpp')
0 files changed, 0 insertions, 0 deletions