aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/IR/Module.cpp
diff options
context:
space:
mode:
authorManna, Soumi <soumi.manna@intel.com>2023-05-23 07:36:15 -0700
committerManna, Soumi <soumi.manna@intel.com>2023-05-23 07:42:15 -0700
commit64e9ba7048b8fb4ac72bbc72e8861c947d49f3d4 (patch)
treeaff60fa226fca1a6199ff95a989f2dd09fbb5726 /llvm/lib/IR/Module.cpp
parentcce7b816a1ee70f2d1f3c21d2a99475c17b54bd7 (diff)
downloadllvm-64e9ba7048b8fb4ac72bbc72e8861c947d49f3d4.zip
llvm-64e9ba7048b8fb4ac72bbc72e8861c947d49f3d4.tar.gz
llvm-64e9ba7048b8fb4ac72bbc72e8861c947d49f3d4.tar.bz2
[NFC][CLANG] Fix static code analyzer concerns
Reported by Static Code Analyzer Tool, Coverity: Dereference null return value Inside "ExprConstant.cpp" file, in <unnamed>::RecordExprEvaluator::VisitCXXStdInitializerListExpr(clang::CXXStdInitializerListExpr const *): Return value of function which returns null is dereferenced without checking. bool RecordExprEvaluator::VisitCXXStdInitializerListExpr( const CXXStdInitializerListExpr *E) { // returned_null: getAsConstantArrayType returns nullptr (checked 81 out of 93 times). //var_assigned: Assigning: ArrayType = nullptr return value from getAsConstantArrayType. const ConstantArrayType *ArrayType = Info.Ctx.getAsConstantArrayType(E->getSubExpr()->getType()); LValue Array; //Condition !EvaluateLValue(E->getSubExpr(), Array, this->Info, false), taking false branch. if (!EvaluateLValue(E->getSubExpr(), Array, Info)) return false; // Get a pointer to the first element of the array. //Dereference null return value (NULL_RETURNS) //dereference: Dereferencing a pointer that might be nullptr ArrayType when calling addArray. Array.addArray(Info, E, ArrayType); This patch adds an assert for unexpected type for array initializer. Reviewed By: erichkeane Differential Revision: https://reviews.llvm.org/D151040
Diffstat (limited to 'llvm/lib/IR/Module.cpp')
0 files changed, 0 insertions, 0 deletions