[PATCH] Fix crash when resolving branch conditions for temporary destructor condition blocks.

Manuel Klimek klimek at google.com
Tue Apr 29 13:13:37 PDT 2014


Hi jordan_rose, krememek,

Document and simplify ResolveCondition.

1. Introduce a temporary special case for temporary desctructors when resolving
the branch condition - in an upcoming patch, alexmc will change temporary
destructor conditions to not run through this logic, in which case we can remove
this (marked as FIXME); this currently fixes a crash.

2. Simplify ResolveCondition; while documenting the function, I noticed that it
always returns the last statement - either that statement is the condition
itself (in which case the condition was returned anyway), or the rightmost
leaf is returned; for correctness, the rightmost leaf must be evaluated anyway
(which the CFG does in the last statement), thus we can just return the last
statement in that case, too. Added an assert to verify the invariant; no tests
break - please let me know if I'm missing obvious test cases here, or this
doesn't make sense for some other reason.

http://reviews.llvm.org/D3552

Files:
  lib/StaticAnalyzer/Core/ExprEngine.cpp
  test/Analysis/temporaries.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D3552.8940.patch
Type: text/x-patch
Size: 5121 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140429/4a930231/attachment.bin>


More information about the cfe-commits mailing list