diff options
| author | Ted Kremenek <kremenek@apple.com> | 2013-05-04 01:13:05 +0000 |
|---|---|---|
| committer | Ted Kremenek <kremenek@apple.com> | 2013-05-04 01:13:05 +0000 |
| commit | ccb6d1ea0cfc1c9f2e0ea651414ff80610fa12dc (patch) | |
| tree | 6c5f47df8117389aab3103f9e893f2c78799ff38 /clang/lib/StaticAnalyzer/Core/BugReporter.cpp | |
| parent | 6cf3c97c558ab43cc1dbd088b5f5812c927ead9d (diff) | |
| download | bcm5719-llvm-ccb6d1ea0cfc1c9f2e0ea651414ff80610fa12dc.tar.gz bcm5719-llvm-ccb6d1ea0cfc1c9f2e0ea651414ff80610fa12dc.zip | |
[analyzer; alternate edges] - merge control edges where we descend to a subexpression and pop back out.
llvm-svn: 181085
Diffstat (limited to 'clang/lib/StaticAnalyzer/Core/BugReporter.cpp')
| -rw-r--r-- | clang/lib/StaticAnalyzer/Core/BugReporter.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/clang/lib/StaticAnalyzer/Core/BugReporter.cpp b/clang/lib/StaticAnalyzer/Core/BugReporter.cpp index b3c0dac9646..827bf09b05f 100644 --- a/clang/lib/StaticAnalyzer/Core/BugReporter.cpp +++ b/clang/lib/StaticAnalyzer/Core/BugReporter.cpp @@ -1802,6 +1802,26 @@ static bool optimizeEdges(PathPieces &path, hasChanges = true; continue; } + + // Rule II. + // + // If we have two consecutive control edges where we decend to a + // subexpression and then pop out merge them. + // + // NOTE: this will be limited later in cases where we add barriers + // to prevent this optimization. + // + // For example: + // + // (1.1 -> 1.1.1) -> (1.1.1 -> 1.2) becomes (1.1 -> 1.2). + if (level1 && level2 && + level1 == level4 && + level2 == level3 && PM.getParent(level2) == level1) { + PieceI->setEndLocation(PieceNextI->getEndLocation()); + path.erase(NextI); + hasChanges = true; + continue; + } } // No changes. |

