forked from OSchip/llvm-project
[analyzer] LocalizationChecker: Fix a crash on synthesized accessor stubs.
The checker was trying to analyze the body of every method in Objective-C
@implementation clause but the sythesized accessor stubs that were introduced
into it by 2073dd2d
have no bodies.
This commit is contained in:
parent
2b3f2071ec
commit
b01012b7c8
|
@ -1077,7 +1077,10 @@ void EmptyLocalizationContextChecker::checkASTDecl(
|
|||
AnalysisDeclContext *DCtx = Mgr.getAnalysisDeclContext(M);
|
||||
|
||||
const Stmt *Body = M->getBody();
|
||||
assert(Body);
|
||||
if (!Body) {
|
||||
assert(M->isSynthesizedAccessorStub());
|
||||
continue;
|
||||
}
|
||||
|
||||
MethodCrawler MC(M->getCanonicalDecl(), BR, this, Mgr, DCtx);
|
||||
MC.VisitStmt(Body);
|
||||
|
|
|
@ -293,3 +293,11 @@ NSString *ForceLocalized(NSString *str) { return str; }
|
|||
takesLocalizedString(@"not localized"); // expected-warning {{User-facing text should use localized string macro}}
|
||||
}
|
||||
@end
|
||||
|
||||
@interface SynthesizedAccessors : NSObject
|
||||
@property (assign) NSObject *obj;
|
||||
@end
|
||||
|
||||
@implementation SynthesizedAccessors
|
||||
// no-crash
|
||||
@end
|
||||
|
|
Loading…
Reference in New Issue