]> granicus.if.org Git - clang/commit
[static analyzer] Analyzer is skipping forward declared C/C++ functions
authorAnna Zaks <ganna@apple.com>
Fri, 26 Jun 2015 17:42:58 +0000 (17:42 +0000)
committerAnna Zaks <ganna@apple.com>
Fri, 26 Jun 2015 17:42:58 +0000 (17:42 +0000)
commitec216ad1c57655182034b14da7edc80f248a32bc
treea8683c78170c5308b593a2c73a95469e7dcf7a41
parente9bb2d18823816db02368bd9df0823b5c6a9e3e5
[static analyzer] Analyzer is skipping forward declared C/C++ functions

A patch by Karthik Bhat!

This patch fixes a regression introduced by r224398. Prior to r224398
we were able to analyze the following code in test-include.c and report
a null deref in this case. But post r224398 this analysis is being skipped.

E.g.
  // test-include.c
  #include "test-include.h"
  void test(int * data) {
    data = 0;
    *data = 1;
  }

   // test-include.h
  void test(int * data);

This patch uses the function body (instead of its declaration) as the location
of the function when deciding if the Decl should be analyzed with path-sensitive
analysis. (Prior to r224398, the call graph was guaranteed to have a definition
when available.)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@240800 91177308-0d34-0410-b5e6-96231b3b80d8
lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp
test/Analysis/test-include-cpp.cpp [new file with mode: 0644]
test/Analysis/test-include-cpp.h [new file with mode: 0644]
test/Analysis/test-include.c [new file with mode: 0644]
test/Analysis/test-include.h [new file with mode: 0644]