This is an archive of the discontinued LLVM Phabricator instance.

[ASTMatchers]: fix crash in hasReturnValue
ClosedPublic

Authored by mgehre on Apr 11 2016, 1:13 PM.

Details

Summary

The crash was reproduced by the included test case. It was initially
found through a crash of clang-tidy's misc-misplaced-widening-cast
check.

Diff Detail

Repository
rL LLVM

Event Timeline

mgehre updated this revision to Diff 53311.Apr 11 2016, 1:13 PM
mgehre retitled this revision from to [ASTMatchers]: fix crash in hasReturnValue.
mgehre updated this object.
mgehre added reviewers: klimek, alexfh.
mgehre added a subscriber: cfe-commits.
alexfh accepted this revision.Apr 11 2016, 2:27 PM
alexfh edited edge metadata.

LG.

This should also fix http://llvm.org/PR27298

This revision is now accepted and ready to land.Apr 11 2016, 2:27 PM
alexfh added inline comments.Apr 11 2016, 2:31 PM
include/clang/ASTMatchers/ASTMatchers.h
5018 ↗(On Diff #53311)

nit: might be a bit clearer, if you reverse the condition:

if (const auto *RetValue = Node.getRetValue())
  return InnerMatcher.matches(*RetValue, Finder, Builder);
return false;
This revision was automatically updated to reflect the committed changes.