Skip to content

Commit

Permalink
#12: skip unions
Browse files Browse the repository at this point in the history
  • Loading branch information
cz4rs committed Feb 12, 2021
1 parent 12dd43e commit b88e363
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/plugin/plugin.cc
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,11 @@ FieldDecl const* getSerializedField(
return dyn_cast<FieldDecl>(member_expr->getMemberDecl());
}

// std::unique_ptr<int> i_; ---> s | *i;
auto oc = dyn_cast<CXXOperatorCallExpr>(expression);
if (oc) {
auto cast = dyn_cast<ImplicitCastExpr>(*(++oc->child_begin()));
auto member_expr = dyn_cast<MemberExpr>(cast->getSubExpr());
// std::unique_ptr<int> i_; ---> s | *i;
return dyn_cast<FieldDecl>(member_expr->getMemberDecl());
}

Expand Down Expand Up @@ -122,7 +122,10 @@ std::unordered_set<FieldDecl const*>getSerializedFields(

void SanitizerMatcher::run(MatchFinder::MatchResult const& result) {
auto record = result.Nodes.getNodeAs<CXXRecordDecl>("record");
// llvm::errs() << "Processing " << record->getQualifiedNameAsString() << "\n";
if (record->isUnion()) {
return;
}

auto method = result.Nodes.getNodeAs<CXXMethodDecl>("method");
if (not method->hasBody()) {
return;
Expand Down

0 comments on commit b88e363

Please sign in to comment.