Lines Matching +full:auto +full:- +full:string +full:- +full:detection
1 //===- NumberObjectConversionChecker.cpp -------------------------*- C++ -*-==//
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
17 // Currently the checker supports the Objective-C NSNumber class,
18 // and the OSBoolean class found in macOS low-level code; the latter
21 // This checker has an option "Pedantic" (boolean), which enables detection of
23 // are more likely to produce false positives) - disabled by default,
24 // enabled with `-analyzer-config osx.NumberObjectConversion:Pedantic=true'.
26 //===----------------------------------------------------------------------===//
67 if (IsPedanticMatch && !C->Pedantic) in run()
70 ASTContext &ACtx = ADC->getASTContext(); in run()
76 // to zero literals in non-pedantic mode. in run()
77 // FIXME: Introduce an AST matcher to implement the macro-related logic? in run()
79 SourceLocation Loc = CheckIfNull->getBeginLoc(); in run()
90 if (CheckIfNull->IgnoreParenCasts()->EvaluateAsInt( in run()
94 if (!C->Pedantic) in run()
132 QualType ObjT = Obj->getType().getUnqualifiedType(); in run()
136 assert(ObjT.getCanonicalType()->isPointerType()); in run()
138 ObjT->getPointeeType().getCanonicalType().getUnqualifiedType()); in run()
148 std::string EuphemismForPlain = "primitive"; in run()
149 std::string SuggestedApi = IsObjC ? (IsInteger ? "" : "-boolValue") in run()
154 // FIXME: Pattern-match the integer type to make a better guess? in run()
189 ADC->getDecl(), C, "Suspicious number object conversion", "Logic error", in run()
192 Conv->getSourceRange()); in run()
199 auto CSuspiciousNumberObjectExprM = expr(ignoringParenImpCasts( in checkASTCodeBody()
205 // Currently this matches XNU kernel number-object pointers. in checkASTCodeBody()
206 auto CppSuspiciousNumberObjectExprM = in checkASTCodeBody()
218 auto ObjCSuspiciousNumberObjectExprM = in checkASTCodeBody()
227 auto SuspiciousNumberObjectExprM = anyOf( in checkASTCodeBody()
233 auto AnotherSuspiciousNumberObjectExprM = in checkASTCodeBody()
240 auto ObjCSuspiciousScalarBooleanTypeM = in checkASTCodeBody()
246 auto SuspiciousScalarBooleanTypeM = in checkASTCodeBody()
253 auto SuspiciousScalarNumberTypeM = in checkASTCodeBody()
259 auto SuspiciousScalarTypeM = in checkASTCodeBody()
263 auto SuspiciousScalarExprM = in checkASTCodeBody()
266 auto ConversionThroughAssignmentM = in checkASTCodeBody()
271 auto ConversionThroughBranchingM = in checkASTCodeBody()
277 auto ConversionThroughCallM = in checkASTCodeBody()
283 // in case it was intended to compare a pointer to 0 with a relatively-ok in checkASTCodeBody()
285 auto ConversionThroughEquivalenceM = in checkASTCodeBody()
292 auto ConversionThroughComparisonM = in checkASTCodeBody()
299 auto ConversionThroughConditionalOperatorM = in checkASTCodeBody()
308 auto ConversionThroughExclamationMarkM = in checkASTCodeBody()
313 auto ConversionThroughExplicitBooleanCastM = in checkASTCodeBody()
317 auto ConversionThroughExplicitNumberCastM = in checkASTCodeBody()
321 auto ConversionThroughInitializerM = in checkASTCodeBody()
326 auto FinalM = stmt(anyOf(ConversionThroughAssignmentM, in checkASTCodeBody()
341 F.match(*D->getBody(), AM.getASTContext()); in checkASTCodeBody()
347 Chk->Pedantic = in registerNumberObjectConversionChecker()