alexshap updated the summary for this revision. alexshap updated this revision to Diff 72132. alexshap added a comment.
Address the comments Repository: rL LLVM https://reviews.llvm.org/D24792 Files: lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp test/Analysis/NSString.m Index: test/Analysis/NSString.m =================================================================== --- test/Analysis/NSString.m +++ test/Analysis/NSString.m @@ -289,7 +289,11 @@ _Bool OSAtomicCompareAndSwapPtr( void *__oldValue, void *__newValue, void * volatile *__theValue ) { return opaque_OSAtomicCompareAndSwapPtr(__oldValue, __newValue, __theValue); } - +// Test that the analyzer doesn't crash when the farm model is used. +// The analyzer ignores the autosynthesized code. +_Bool OSAtomicCompareAndSwapEmptyFunction( void *__oldValue, void *__newValue, void * volatile *__theValue ) { + return 0; +} extern BOOL opaque_objc_atomicCompareAndSwapPtr(id predicate, id replacement, volatile id *objectLocation); extern BOOL objc_atomicCompareAndSwapPtr(id predicate, id replacement, volatile id *objectLocation) { return opaque_objc_atomicCompareAndSwapPtr(predicate, replacement, objectLocation); @@ -441,4 +445,4 @@ - (void)callValue { [self _value]; } -@end \ No newline at end of file +@end Index: lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp =================================================================== --- lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp +++ lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp @@ -688,6 +688,10 @@ if (!Mgr->getAnalysisDeclContext(D)->getAnalysis<RelaxedLiveVariables>()) return; + // Ignore autosynthesized code. + if (Mgr->getAnalysisDeclContext(D)->isBodyAutosynthesized()) + return; + ExprEngine Eng(*Mgr, ObjCGCEnabled, VisitedCallees, &FunctionSummaries,IMode); // Set the graph auditor. Index: lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp =================================================================== --- lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp +++ lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp @@ -3863,7 +3863,7 @@ // Don't process anything within synthesized bodies. const LocationContext *LCtx = Pred->getLocationContext(); if (LCtx->getAnalysisDeclContext()->isBodyAutosynthesized()) { - assert(LCtx->getParent()); + assert(!LCtx->inTopFrame()); return; }
Index: test/Analysis/NSString.m =================================================================== --- test/Analysis/NSString.m +++ test/Analysis/NSString.m @@ -289,7 +289,11 @@ _Bool OSAtomicCompareAndSwapPtr( void *__oldValue, void *__newValue, void * volatile *__theValue ) { return opaque_OSAtomicCompareAndSwapPtr(__oldValue, __newValue, __theValue); } - +// Test that the analyzer doesn't crash when the farm model is used. +// The analyzer ignores the autosynthesized code. +_Bool OSAtomicCompareAndSwapEmptyFunction( void *__oldValue, void *__newValue, void * volatile *__theValue ) { + return 0; +} extern BOOL opaque_objc_atomicCompareAndSwapPtr(id predicate, id replacement, volatile id *objectLocation); extern BOOL objc_atomicCompareAndSwapPtr(id predicate, id replacement, volatile id *objectLocation) { return opaque_objc_atomicCompareAndSwapPtr(predicate, replacement, objectLocation); @@ -441,4 +445,4 @@ - (void)callValue { [self _value]; } -@end \ No newline at end of file +@end Index: lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp =================================================================== --- lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp +++ lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp @@ -688,6 +688,10 @@ if (!Mgr->getAnalysisDeclContext(D)->getAnalysis<RelaxedLiveVariables>()) return; + // Ignore autosynthesized code. + if (Mgr->getAnalysisDeclContext(D)->isBodyAutosynthesized()) + return; + ExprEngine Eng(*Mgr, ObjCGCEnabled, VisitedCallees, &FunctionSummaries,IMode); // Set the graph auditor. Index: lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp =================================================================== --- lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp +++ lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp @@ -3863,7 +3863,7 @@ // Don't process anything within synthesized bodies. const LocationContext *LCtx = Pred->getLocationContext(); if (LCtx->getAnalysisDeclContext()->isBodyAutosynthesized()) { - assert(LCtx->getParent()); + assert(!LCtx->inTopFrame()); return; }
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits