]> granicus.if.org Git - clang/commit
[analyzer] Don't emit extra context arrow after returning from an inlined call.
authorJordan Rose <jordan_rose@apple.com>
Fri, 12 Apr 2013 00:44:01 +0000 (00:44 +0000)
committerJordan Rose <jordan_rose@apple.com>
Fri, 12 Apr 2013 00:44:01 +0000 (00:44 +0000)
commit3ea09a802f973c2726b2a489ae08a4bded93410b
treeca36625443ca88f43505e25f0927ceded898d156
parente9c09701e835b8013d6d00ec7c49861ed2107313
[analyzer] Don't emit extra context arrow after returning from an inlined call.

In this code

  int getZero() {
    return 0;
  }

  void test() {
    int problem = 1 / getZero(); // expected-warning {{Division by zero}}
  }

we generate these arrows:

    +-----------------+
    |                 v
    int problem = 1 / getZero();
                  ^   |
                  +---+

where the top one represents the control flow up to the first call, and the
bottom one represents the flow to the division.* It turns out, however, that
we were generating the top arrow twice, as if attempting to "set up context"
after we had already returned from the call. This resulted in poor
highlighting in Xcode.

* Arguably the best location for the division is the '/', but that's a
  different problem.

<rdar://problem/13326040>

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@179350 91177308-0d34-0410-b5e6-96231b3b80d8
lib/StaticAnalyzer/Core/BugReporter.cpp
test/Analysis/inline-plist.c
test/Analysis/inlining/eager-reclamation-path-notes.c
test/Analysis/inlining/eager-reclamation-path-notes.cpp
test/Analysis/inlining/path-notes.c
test/Analysis/inlining/path-notes.cpp
test/Analysis/inlining/path-notes.m
test/Analysis/retain-release-path-notes.m