[cfe-commits] r105984 - in /cfe/trunk: lib/Frontend/AnalysisConsumer.cpp test/Analysis/misc-ps.m
Ted Kremenek
kremenek at apple.com
Mon Jun 14 17:55:40 PDT 2010
Author: kremenek
Date: Mon Jun 14 19:55:40 2010
New Revision: 105984
URL: http://llvm.org/viewvc/llvm-project?rev=105984&view=rev
Log:
Change AnalysisConsumer to analyze functions created by instantiantiating a macro. Fixes PR 7361.
Modified:
cfe/trunk/lib/Frontend/AnalysisConsumer.cpp
cfe/trunk/test/Analysis/misc-ps.m
Modified: cfe/trunk/lib/Frontend/AnalysisConsumer.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/AnalysisConsumer.cpp?rev=105984&r1=105983&r2=105984&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/AnalysisConsumer.cpp (original)
+++ cfe/trunk/lib/Frontend/AnalysisConsumer.cpp Mon Jun 14 19:55:40 2010
@@ -278,8 +278,9 @@
// 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.
Modified: cfe/trunk/test/Analysis/misc-ps.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/misc-ps.m?rev=105984&r1=105983&r2=105984&view=diff
==============================================================================
--- cfe/trunk/test/Analysis/misc-ps.m (original)
+++ cfe/trunk/test/Analysis/misc-ps.m Mon Jun 14 19:55:40 2010
@@ -971,3 +971,13 @@
@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}}
+
More information about the cfe-commits
mailing list