This is an archive of the discontinued LLVM Phabricator instance.

[analyzer] Add rudimentary handling of AtomicExpr.
ClosedPublic

Authored by dcoughlin on Jun 23 2016, 4:44 PM.

Details

Summary

This proposed patch adds crude handling of atomics to the static analyzer.
Rather than ignore AtomicExprs, as we now do, this patch causes the analyzer
to escape the arguments. This is imprecise -- and we should model the
expressions fully in the future -- but it is less wrong than ignoring their
effects altogether.

Richard: Would you mind reviewing the changes I made to AtomicExpr in the AST? I had
to add a const accessor for the subexpressions.

Anna: Would you review the static analyzer portion?

This is rdar://problem/25353187

Diff Detail

Event Timeline

dcoughlin updated this revision to Diff 61744.Jun 23 2016, 4:44 PM
dcoughlin retitled this revision from to [analyzer] Add rudimentary handling of AtomicExpr..
dcoughlin updated this object.
dcoughlin added reviewers: zaks.anna, rsmith.
dcoughlin added a subscriber: cfe-commits.
grandinj added inline comments.
test/Analysis/atomics.c
5

folly->fully

zaks.anna accepted this revision.Jul 7 2016, 10:14 AM
zaks.anna edited edge metadata.
zaks.anna added inline comments.
lib/StaticAnalyzer/Core/ExprEngine.cpp
2079

alignment is off?

This revision is now accepted and ready to land.Jul 7 2016, 10:14 AM
dcoughlin updated this revision to Diff 63096.Jul 7 2016, 11:13 AM
dcoughlin edited edge metadata.

Fix typo and bad indentation.

dcoughlin marked an inline comment as done.Jul 7 2016, 11:13 AM
dcoughlin added inline comments.
test/Analysis/atomics.c
5

Thanks! Fixed.

dcoughlin marked an inline comment as done.Jul 7 2016, 11:14 AM

Ping.

Richard: Would you be willing to take a quick look at the change to the AST?

Anna and Jordan said I should just go ahead and commit this.

NoQ accepted this revision.Jul 7 2016, 5:57 PM
NoQ added a reviewer: NoQ.
This revision was automatically updated to reflect the committed changes.