MCPcopy Create free account
hub / github.com/Samsung/UTopia / check

Method check

lib/inputfilter/NullPointerFilter.cpp:13–39  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

11 : InputFilter(FilterName, std::move(NextFilter)) {}
12
13bool NullPointerFilter::check(const ASTIRNode &Node) const {
14 auto *Assigned = Node.AST.getAssigned();
15 if (!Assigned)
16 return false;
17
18 auto *E = Assigned->getNode().get<Expr>();
19 if (!E)
20 return false;
21
22 auto NullValue = E->isNullPointerConstant(
23 Assigned->getASTUnit().getASTContext(),
24 clang::AbstractConditionalOperator::NPC_NeverValueDependent);
25 if (NullValue == clang::AbstractConditionalOperator::NPCK_NotNull)
26 return false;
27
28 const clang::Type *T = nullptr;
29 const auto &Assignee = Node.AST.getAssignee();
30 if (Assignee.getNodeType() == ASTNode::CALL)
31 T = Assigned->getType().getTypePtrOrNull();
32 else
33 T = Node.AST.getAssignee().getType().getTypePtrOrNull();
34
35 if (!T)
36 return false;
37
38 return T->isAnyPointerType();
39}
40
41} // namespace ftg

Callers

nothing calls this directly

Calls 3

getAssignedMethod · 0.80
getNodeTypeMethod · 0.80
getTypeMethod · 0.45

Tested by

no test coverage detected