diff options
author | Ted Kremenek <kremenek@apple.com> | 2010-06-15 00:55:40 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2010-06-15 00:55:40 +0000 |
commit | fcd783d583d270b7ec1ec3e0fcf83cd93d30e381 (patch) | |
tree | 79bd45078d4538ab8ed1c1a335f0bb3441eb8a41 | |
parent | 99e14a04887570b11df90daf2e8a7adf84599b01 (diff) |
Change AnalysisConsumer to analyze functions created by instantiantiating a macro. Fixes PR 7361.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@105984 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/Frontend/AnalysisConsumer.cpp | 5 | ||||
-rw-r--r-- | test/Analysis/misc-ps.m | 10 |
2 files changed, 13 insertions, 2 deletions
diff --git a/lib/Frontend/AnalysisConsumer.cpp b/lib/Frontend/AnalysisConsumer.cpp index 6a4727929e..0589008033 100644 --- a/lib/Frontend/AnalysisConsumer.cpp +++ b/lib/Frontend/AnalysisConsumer.cpp @@ -278,8 +278,9 @@ void AnalysisConsumer::HandleCode(Decl *D, Stmt* Body, Actions& actions) { // Don't run the actions on declarations in header files unless // otherwise specified. - if (!Opts.AnalyzeAll && - !Ctx->getSourceManager().isFromMainFile(D->getLocation())) + SourceManager &SM = Ctx->getSourceManager(); + SourceLocation SL = SM.getInstantiationLoc(D->getLocation()); + if (!Opts.AnalyzeAll && !SM.isFromMainFile(SL)) return; // Clear the AnalysisManager of old AnalysisContexts. diff --git a/test/Analysis/misc-ps.m b/test/Analysis/misc-ps.m index 8323c62390..1beb464cd1 100644 --- a/test/Analysis/misc-ps.m +++ b/test/Analysis/misc-ps.m @@ -971,3 +971,13 @@ void r7979430(id x) { @synchronized(x) {} } +//===----------------------------------------------------------------------=== +// PR 7361 - Test that functions wrapped in macro instantiations are analyzed. +//===----------------------------------------------------------------------=== +#define MAKE_TEST_FN() \ + void test_pr7361 (char a) {\ + char* b = 0x0; *b = a;\ + } + +MAKE_TEST_FN() // expected-warning{{null pointer}} + |